2013-11-14 13:50:11

by Christoph Hellwig

[permalink] [raw]
Subject: [PATCH] nfsd: export proper maximum file size to the client

I noticed that we export a way to high value for the maxfilesize
attribute when debugging a client issue. The issue didn't turn
out to be related to it, but I think we should export it, so that
clients can limit what write sizes they accept before hitting
the server.

Signed-off-by: Christoph Hellwig <[email protected]>

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 9423522..a3c9347 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2488,7 +2488,7 @@ out_acl:
if (bmval0 & FATTR4_WORD0_MAXFILESIZE) {
if ((buflen -= 8) < 0)
goto out_resource;
- WRITE64(~(u64)0);
+ WRITE64(exp->ex_path.mnt->mnt_sb->s_maxbytes);
}
if (bmval0 & FATTR4_WORD0_MAXLINK) {
if ((buflen -= 4) < 0)


2013-11-14 14:18:06

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH] nfsd: export proper maximum file size to the client

On Thu, Nov 14, 2013 at 05:50:10AM -0800, Christoph Hellwig wrote:
> I noticed that we export a way to high value for the maxfilesize
> attribute when debugging a client issue. The issue didn't turn
> out to be related to it, but I think we should export it, so that
> clients can limit what write sizes they accept before hitting
> the server.

Thanks, applying.--b.

>
> Signed-off-by: Christoph Hellwig <[email protected]>
>
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 9423522..a3c9347 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -2488,7 +2488,7 @@ out_acl:
> if (bmval0 & FATTR4_WORD0_MAXFILESIZE) {
> if ((buflen -= 8) < 0)
> goto out_resource;
> - WRITE64(~(u64)0);
> + WRITE64(exp->ex_path.mnt->mnt_sb->s_maxbytes);
> }
> if (bmval0 & FATTR4_WORD0_MAXLINK) {
> if ((buflen -= 4) < 0)