From: Al Viro Date: Fri, 27 Apr 2012 22:42:43 +0000 (-0500) Subject: nfsd: fix b0rken error value for setattr on read-only mount X-Git-Tag: firefly_0821_release~7541^2~1252 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=d2fd339e9fa7343f521e72add938fd1120f3f8d9;p=firefly-linux-kernel-4.4.55.git nfsd: fix b0rken error value for setattr on read-only mount commit 96f6f98501196d46ce52c2697dd758d9300c63f5 upstream. ..._want_write() returns -EROFS on failure, _not_ an NFS error value. Signed-off-by: Al Viro Signed-off-by: Jonathan Nieder Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 0b8830c9de73..d06a02c1b1a3 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -812,6 +812,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_setattr *setattr) { __be32 status = nfs_ok; + int err; if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { nfs4_lock_state(); @@ -823,9 +824,9 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, return status; } } - status = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt); - if (status) - return status; + err = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt); + if (err) + return nfserrno(err); status = nfs_ok; status = check_attr_support(rqstp, cstate, setattr->sa_bmval,