| From jrnieder@gmail.com Sun Apr 29 18:07:05 2012 |
| From: Al Viro <viro@zeniv.linux.org.uk> |
| Date: Fri, 27 Apr 2012 17:42:43 -0500 |
| Subject: nfsd: fix b0rken error value for setattr on read-only mount |
| To: Al Viro <viro@zeniv.linux.org.uk> |
| Message-ID: <20120427224243.GF2821@burratino> |
| |
| |
| From: Al Viro <viro@zeniv.linux.org.uk> |
| |
| commit 96f6f98501196d46ce52c2697dd758d9300c63f5 upstream. |
| |
| ..._want_write() returns -EROFS on failure, _not_ an NFS error value. |
| |
| Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> |
| Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| |
| --- |
| fs/nfsd/nfs4proc.c | 7 ++++--- |
| 1 file changed, 4 insertions(+), 3 deletions(-) |
| |
| --- a/fs/nfsd/nfs4proc.c |
| +++ b/fs/nfsd/nfs4proc.c |
| @@ -812,6 +812,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, st |
| 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, st |
| 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, |