Commit 0a2050d7 authored by Kinglong Mee's avatar Kinglong Mee Committed by J. Bruce Fields

NFSD: Store parent's stat in a separate value

After commit ae7095a7 (nfsd4: helper function for getting mounted_on
ino) we ignore the return value from get_parent_attributes().

Also, the following FATTR4_WORD2_LAYOUT_BLKSIZE uses stat.blksize, so to
avoid overwriting that, use an independent value for the parent's
attributes.
Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent e5386747
...@@ -2675,6 +2675,9 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, ...@@ -2675,6 +2675,9 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
*p++ = cpu_to_be32(stat.mtime.tv_nsec); *p++ = cpu_to_be32(stat.mtime.tv_nsec);
} }
if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) { if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) {
struct kstat parent_stat;
u64 ino = stat.ino;
p = xdr_reserve_space(xdr, 8); p = xdr_reserve_space(xdr, 8);
if (!p) if (!p)
goto out_resource; goto out_resource;
...@@ -2683,9 +2686,13 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, ...@@ -2683,9 +2686,13 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
* 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) {
get_parent_attributes(exp, &stat); err = get_parent_attributes(exp, &parent_stat);
p = xdr_encode_hyper(p, stat.ino); if (err)
goto out_nfserr;
ino = parent_stat.ino;
}
p = xdr_encode_hyper(p, ino);
} }
#ifdef CONFIG_NFSD_PNFS #ifdef CONFIG_NFSD_PNFS
if ((bmval1 & FATTR4_WORD1_FS_LAYOUT_TYPES) || if ((bmval1 & FATTR4_WORD1_FS_LAYOUT_TYPES) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment