nfsd4: helper function for getting mounted_on ino

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
J. Bruce Fields 2012-10-01 17:50:56 -04:00
Родитель 3c40794b2d
Коммит ae7095a7c4
1 изменённых файлов: 18 добавлений и 12 удалений

Просмотреть файл

@ -2014,6 +2014,22 @@ static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)
return 0; return 0;
} }
static int get_parent_attributes(struct svc_export *exp, struct kstat *stat)
{
struct path path = exp->ex_path;
int err;
path_get(&path);
while (follow_up(&path)) {
if (path.dentry != path.mnt->mnt_root)
break;
}
err = vfs_getattr(path.mnt, path.dentry, stat);
path_put(&path);
return err;
}
/* /*
* Note: @fhp can be NULL; in this case, we might have to compose the filehandle * Note: @fhp can be NULL; in this case, we might have to compose the filehandle
* ourselves. * ourselves.
@ -2430,18 +2446,8 @@ out_acl:
* and this is the root of a cross-mounted filesystem. * and this is the root of a cross-mounted filesystem.
*/ */
if (ignore_crossmnt == 0 && if (ignore_crossmnt == 0 &&
dentry == exp->ex_path.mnt->mnt_root) { dentry == exp->ex_path.mnt->mnt_root)
struct path path = exp->ex_path; get_parent_attributes(exp, &stat);
path_get(&path);
while (follow_up(&path)) {
if (path.dentry != path.mnt->mnt_root)
break;
}
err = vfs_getattr(path.mnt, path.dentry, &stat);
path_put(&path);
if (err)
goto out_nfserr;
}
WRITE64(stat.ino); WRITE64(stat.ino);
} }
if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) { if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {