aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-03-05 16:40:31 -0500
committerJ. Bruce Fields <bfields@redhat.com>2014-01-07 16:01:15 -0500
commit208d0acc49cbf22a71d32b40a69e199717a76687 (patch)
tree2f884738d02f0ab5da93e85198dc8458c1fe5b9c /fs
parent60810e5489dffd0bd12e4f99fe9fc330c9a636e1 (diff)
nfsd4: break only delegations when appropriate
As a temporary fix, nfsd was breaking all leases on unlink, link, rename, and setattr. Now that we can distinguish between leases and delegations, we can be nicer and break only the delegations, and not bother lease-holders with operations they don't care about. And we get to delete some code while we're at it. Note that in the presence of delegations the vfs calls here all return -EWOULDBLOCK instead of blocking, so nfsd threads will not get stuck waiting for delegation returns. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/vfs.c30
1 files changed, 0 insertions, 30 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index c8aa6ff99259..e85b463fac4a 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -273,13 +273,6 @@ out:
273 return err; 273 return err;
274} 274}
275 275
276static int nfsd_break_lease(struct inode *inode)
277{
278 if (!S_ISREG(inode->i_mode))
279 return 0;
280 return break_lease(inode, O_WRONLY | O_NONBLOCK);
281}
282
283/* 276/*
284 * Commit metadata changes to stable storage. 277 * Commit metadata changes to stable storage.
285 */ 278 */
@@ -448,16 +441,10 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
448 goto out_put_write_access; 441 goto out_put_write_access;
449 } 442 }
450 443
451 host_err = nfsd_break_lease(inode);
452 if (host_err)
453 goto out_put_write_access_nfserror;
454
455 fh_lock(fhp); 444 fh_lock(fhp);
456 host_err = notify_change(dentry, iap, NULL); 445 host_err = notify_change(dentry, iap, NULL);
457 fh_unlock(fhp); 446 fh_unlock(fhp);
458 447
459out_put_write_access_nfserror:
460 err = nfserrno(host_err);
461out_put_write_access: 448out_put_write_access:
462 if (size_change) 449 if (size_change)
463 put_write_access(inode); 450 put_write_access(inode);
@@ -1759,11 +1746,6 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1759 err = nfserr_noent; 1746 err = nfserr_noent;
1760 if (!dold->d_inode) 1747 if (!dold->d_inode)
1761 goto out_dput; 1748 goto out_dput;
1762 host_err = nfsd_break_lease(dold->d_inode);
1763 if (host_err) {
1764 err = nfserrno(host_err);
1765 goto out_dput;
1766 }
1767 host_err = vfs_link(dold, dirp, dnew, NULL); 1749 host_err = vfs_link(dold, dirp, dnew, NULL);
1768 if (!host_err) { 1750 if (!host_err) {
1769 err = nfserrno(commit_metadata(ffhp)); 1751 err = nfserrno(commit_metadata(ffhp));
@@ -1857,14 +1839,6 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1857 if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry) 1839 if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry)
1858 goto out_dput_new; 1840 goto out_dput_new;
1859 1841
1860 host_err = nfsd_break_lease(odentry->d_inode);
1861 if (host_err)
1862 goto out_dput_new;
1863 if (ndentry->d_inode) {
1864 host_err = nfsd_break_lease(ndentry->d_inode);
1865 if (host_err)
1866 goto out_dput_new;
1867 }
1868 host_err = vfs_rename(fdir, odentry, tdir, ndentry, NULL); 1842 host_err = vfs_rename(fdir, odentry, tdir, ndentry, NULL);
1869 if (!host_err) { 1843 if (!host_err) {
1870 host_err = commit_metadata(tfhp); 1844 host_err = commit_metadata(tfhp);
@@ -1934,16 +1908,12 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
1934 if (!type) 1908 if (!type)
1935 type = rdentry->d_inode->i_mode & S_IFMT; 1909 type = rdentry->d_inode->i_mode & S_IFMT;
1936 1910
1937 host_err = nfsd_break_lease(rdentry->d_inode);
1938 if (host_err)
1939 goto out_put;
1940 if (type != S_IFDIR) 1911 if (type != S_IFDIR)
1941 host_err = vfs_unlink(dirp, rdentry, NULL); 1912 host_err = vfs_unlink(dirp, rdentry, NULL);
1942 else 1913 else
1943 host_err = vfs_rmdir(dirp, rdentry); 1914 host_err = vfs_rmdir(dirp, rdentry);
1944 if (!host_err) 1915 if (!host_err)
1945 host_err = commit_metadata(fhp); 1916 host_err = commit_metadata(fhp);
1946out_put:
1947 dput(rdentry); 1917 dput(rdentry);
1948 1918
1949out_nfserr: 1919out_nfserr: