From 84d702cf58c3d077d250a5e1c469a086eb6a4737 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Mon, 1 Oct 2012 17:50:56 -0400 Subject: [PATCH] --- yaml --- r: 347627 b: refs/heads/master c: ae7095a7c44b4cda963e3d4059788ff60e119684 h: refs/heads/master i: 347625: f4e443f3ff8fef5eab23cb1c89b0cfef2d43d336 347623: 5c96db0c18cd17fa9fe856b111526576e771c82a v: v3 --- [refs] | 2 +- trunk/fs/nfsd/nfs4xdr.c | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index a6147d5d4d7d..c6c66611b82e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3c40794b2dd0f355ef4e6bf8d85af5dcd7da7ece +refs/heads/master: ae7095a7c44b4cda963e3d4059788ff60e119684 diff --git a/trunk/fs/nfsd/nfs4xdr.c b/trunk/fs/nfsd/nfs4xdr.c index fd548d155088..af65fda7685a 100644 --- a/trunk/fs/nfsd/nfs4xdr.c +++ b/trunk/fs/nfsd/nfs4xdr.c @@ -2014,6 +2014,22 @@ static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) 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 * ourselves. @@ -2430,18 +2446,8 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, * and this is the root of a cross-mounted filesystem. */ if (ignore_crossmnt == 0 && - dentry == exp->ex_path.mnt->mnt_root) { - struct path path = exp->ex_path; - 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; - } + dentry == exp->ex_path.mnt->mnt_root) + get_parent_attributes(exp, &stat); WRITE64(stat.ino); } if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {