Skip to contentSkip to conversation

nfsd: getattr for FATTR4_WORD0_FILES_AVAIL needs the statfs buffer

PATCH In review Christoph Hellwig 3 participants 3 messages May 28, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfsd: getattr for FATTR4_WORD0_FILES_AVAIL needs the statfs buffer

---
 fs/nfsd/nfs4xdr.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4xdr.c +2 -2
index d23412e..4bfe880c 100644
@@ -2049,8 +2049,8 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
 	err = vfs_getattr(&path, &stat);
 	if (err)
 		goto out_nfserr;
-	if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL |
-			FATTR4_WORD0_MAXNAME)) ||
+	if ((bmval0 & (FATTR4_WORD0_FILES_AVAIL | FATTR4_WORD0_FILES_FREE |
+			FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_MAXNAME)) ||
 	    (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
 		       FATTR4_WORD1_SPACE_TOTAL))) {
 		err = vfs_statfs(&path, &statfs);
Signature · 1 line
1.7.10.4
#1 lore raw

Thanks, applying for 3.16 and stable.

But, I don't get it: we've been returning random uninitialized data in FILES_AVAIL since forever, and nobody's noticed till now?

Oh, I see: probably every client requests at least one other thing on that list at the same time it requests FILES_AVAIL.

--b.

Quoted 23 lines · Christoph Hellwig
---
 fs/nfsd/nfs4xdr.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4xdr.c +2 -2
index d23412e..4bfe880c 100644
@@ -2049,8 +2049,8 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
 	err = vfs_getattr(&path, &stat);
 	if (err)
 		goto out_nfserr;
-	if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL |
-			FATTR4_WORD0_MAXNAME)) ||
+	if ((bmval0 & (FATTR4_WORD0_FILES_AVAIL | FATTR4_WORD0_FILES_FREE |
+			FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_MAXNAME)) ||
 	    (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
 		       FATTR4_WORD1_SPACE_TOTAL))) {
 		err = vfs_statfs(&path, &statfs);
Signature · 1 line
1.7.10.4
#2 lore raw
Quoted 7 lines · J. Bruce Fields

Thanks, applying for 3.16 and stable.

But, I don't get it: we've been returning random uninitialized data in FILES_AVAIL since forever, and nobody's noticed till now?

Oh, I see: probably every client requests at least one other thing on that list at the same time it requests FILES_AVAIL.

Yeah. I only found this when prototyping schemes to split nfsd4_encode_fattr into easier manageable chunks.