mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
nfsd: make sure to balance get/put_write_access
commit987da47910
upstream. Use a straight goto error label style in nfsd_setattr to make sure we always do the put_write_access call after we got it earlier. Note that the we have been failing to do that in the case nfsd_break_lease() returns an error, a bug introduced into 2.6.38 with6a76bebefe
"nfsd4: break lease on nfsd setattr". Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6ee4fd2614
commit
107bb3cc6b
1 changed files with 15 additions and 14 deletions
|
@ -443,27 +443,28 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
|
|||
|
||||
iap->ia_valid |= ATTR_CTIME;
|
||||
|
||||
err = nfserr_notsync;
|
||||
if (!check_guard || guardtime == inode->i_ctime.tv_sec) {
|
||||
host_err = nfsd_break_lease(inode);
|
||||
if (host_err)
|
||||
goto out_nfserr;
|
||||
fh_lock(fhp);
|
||||
|
||||
host_err = notify_change(dentry, iap);
|
||||
err = nfserrno(host_err);
|
||||
fh_unlock(fhp);
|
||||
if (check_guard && guardtime != inode->i_ctime.tv_sec) {
|
||||
err = nfserr_notsync;
|
||||
goto out_put_write_access;
|
||||
}
|
||||
|
||||
host_err = nfsd_break_lease(inode);
|
||||
if (host_err)
|
||||
goto out_put_write_access_nfserror;
|
||||
|
||||
fh_lock(fhp);
|
||||
host_err = notify_change(dentry, iap);
|
||||
fh_unlock(fhp);
|
||||
|
||||
out_put_write_access_nfserror:
|
||||
err = nfserrno(host_err);
|
||||
out_put_write_access:
|
||||
if (size_change)
|
||||
put_write_access(inode);
|
||||
if (!err)
|
||||
commit_metadata(fhp);
|
||||
out:
|
||||
return err;
|
||||
|
||||
out_nfserr:
|
||||
err = nfserrno(host_err);
|
||||
goto out;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_NFSD_V2_ACL) || \
|
||||
|
|
Loading…
Reference in a new issue