aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-10-01 17:50:56 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-11-07 19:31:31 -0500
commitae7095a7c44b4cda963e3d4059788ff60e119684 (patch)
treea4da75ea9fa82e7af2fd6a6735337243e1dacfd8 /fs
parent3c40794b2dd0f355ef4e6bf8d85af5dcd7da7ece (diff)
nfsd4: helper function for getting mounted_on ino
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4xdr.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index fd548d15508..af65fda7685 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2014,6 +2014,22 @@ static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)
2014 return 0; 2014 return 0;
2015} 2015}
2016 2016
2017
2018static int get_parent_attributes(struct svc_export *exp, struct kstat *stat)
2019{
2020 struct path path = exp->ex_path;
2021 int err;
2022
2023 path_get(&path);
2024 while (follow_up(&path)) {
2025 if (path.dentry != path.mnt->mnt_root)
2026 break;
2027 }
2028 err = vfs_getattr(path.mnt, path.dentry, stat);
2029 path_put(&path);
2030 return err;
2031}
2032
2017/* 2033/*
2018 * Note: @fhp can be NULL; in this case, we might have to compose the filehandle 2034 * Note: @fhp can be NULL; in this case, we might have to compose the filehandle
2019 * ourselves. 2035 * ourselves.
@@ -2430,18 +2446,8 @@ out_acl:
2430 * and this is the root of a cross-mounted filesystem. 2446 * and this is the root of a cross-mounted filesystem.
2431 */ 2447 */
2432 if (ignore_crossmnt == 0 && 2448 if (ignore_crossmnt == 0 &&
2433 dentry == exp->ex_path.mnt->mnt_root) { 2449 dentry == exp->ex_path.mnt->mnt_root)
2434 struct path path = exp->ex_path; 2450 get_parent_attributes(exp, &stat);
2435 path_get(&path);
2436 while (follow_up(&path)) {
2437 if (path.dentry != path.mnt->mnt_root)
2438 break;
2439 }
2440 err = vfs_getattr(path.mnt, path.dentry, &stat);
2441 path_put(&path);
2442 if (err)
2443 goto out_nfserr;
2444 }
2445 WRITE64(stat.ino); 2451 WRITE64(stat.ino);
2446 } 2452 }
2447 if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) { 2453 if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {