Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a16e92ed authored by J. Bruce Fields's avatar J. Bruce Fields
Browse files

knfsd: query filesystem for NFSv4 getattr of FATTR4_MAXNAME



Without this we always return 2^32-1 as the the maximum namelength.

Thanks to Andreas Gruenbacher for bug report and testing.

Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Cc: Andreas Gruenbacher <agruen@suse.de>
parent cfdcad4d
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -1475,7 +1475,8 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
	err = vfs_getattr(exp->ex_mnt, dentry, &stat);
	err = vfs_getattr(exp->ex_mnt, dentry, &stat);
	if (err)
	if (err)
		goto out_nfserr;
		goto out_nfserr;
	if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) ||
	if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL |
			FATTR4_WORD0_MAXNAME)) ||
	    (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
	    (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
		       FATTR4_WORD1_SPACE_TOTAL))) {
		       FATTR4_WORD1_SPACE_TOTAL))) {
		err = vfs_statfs(dentry, &statfs);
		err = vfs_statfs(dentry, &statfs);
@@ -1721,7 +1722,7 @@ out_acl:
	if (bmval0 & FATTR4_WORD0_MAXNAME) {
	if (bmval0 & FATTR4_WORD0_MAXNAME) {
		if ((buflen -= 4) < 0)
		if ((buflen -= 4) < 0)
			goto out_resource;
			goto out_resource;
		WRITE32(~(u32) 0);
		WRITE32(statfs.f_namelen);
	}
	}
	if (bmval0 & FATTR4_WORD0_MAXREAD) {
	if (bmval0 & FATTR4_WORD0_MAXREAD) {
		if ((buflen -= 8) < 0)
		if ((buflen -= 8) < 0)