aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/delegation.c2
-rw-r--r--fs/nfs/delegation.h8
-rw-r--r--fs/nfs/dir.c8
-rw-r--r--fs/nfs/inode.c2
-rw-r--r--fs/nfs/nfs3proc.c7
-rw-r--r--fs/nfs/nfs4proc.c7
-rw-r--r--fs/nfs/proc.c7
-rw-r--r--fs/nfs/unlink.c2
-rw-r--r--include/linux/nfs_xdr.h1
9 files changed, 27 insertions, 17 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 36c7c647a1d0..81c5eec3cf38 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -388,7 +388,7 @@ void nfs_inode_return_delegation_noreclaim(struct inode *inode)
388 * 388 *
389 * Returns zero on success, or a negative errno value. 389 * Returns zero on success, or a negative errno value.
390 */ 390 */
391int nfs_inode_return_delegation(struct inode *inode) 391int nfs4_inode_return_delegation(struct inode *inode)
392{ 392{
393 struct nfs_server *server = NFS_SERVER(inode); 393 struct nfs_server *server = NFS_SERVER(inode);
394 struct nfs_inode *nfsi = NFS_I(inode); 394 struct nfs_inode *nfsi = NFS_I(inode);
diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h
index d134fc5fda70..1f3ccd934635 100644
--- a/fs/nfs/delegation.h
+++ b/fs/nfs/delegation.h
@@ -33,7 +33,7 @@ enum {
33 33
34int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res); 34int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res);
35void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res); 35void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res);
36int nfs_inode_return_delegation(struct inode *inode); 36int nfs4_inode_return_delegation(struct inode *inode);
37int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *stateid); 37int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *stateid);
38void nfs_inode_return_delegation_noreclaim(struct inode *inode); 38void nfs_inode_return_delegation_noreclaim(struct inode *inode);
39 39
@@ -58,12 +58,6 @@ bool nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode, fmode_
58void nfs_mark_delegation_referenced(struct nfs_delegation *delegation); 58void nfs_mark_delegation_referenced(struct nfs_delegation *delegation);
59int nfs4_have_delegation(struct inode *inode, fmode_t flags); 59int nfs4_have_delegation(struct inode *inode, fmode_t flags);
60 60
61#else
62static inline int nfs_inode_return_delegation(struct inode *inode)
63{
64 nfs_wb_all(inode);
65 return 0;
66}
67#endif 61#endif
68 62
69static inline int nfs_have_delegated_attributes(struct inode *inode) 63static inline int nfs_have_delegated_attributes(struct inode *inode)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 4a3e23aea143..68e451f59305 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1778,7 +1778,7 @@ static int nfs_safe_remove(struct dentry *dentry)
1778 } 1778 }
1779 1779
1780 if (inode != NULL) { 1780 if (inode != NULL) {
1781 nfs_inode_return_delegation(inode); 1781 NFS_PROTO(inode)->return_delegation(inode);
1782 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); 1782 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
1783 /* The VFS may want to delete this inode */ 1783 /* The VFS may want to delete this inode */
1784 if (error == 0) 1784 if (error == 0)
@@ -1906,7 +1906,7 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
1906 old_dentry->d_parent->d_name.name, old_dentry->d_name.name, 1906 old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
1907 dentry->d_parent->d_name.name, dentry->d_name.name); 1907 dentry->d_parent->d_name.name, dentry->d_name.name);
1908 1908
1909 nfs_inode_return_delegation(inode); 1909 NFS_PROTO(inode)->return_delegation(inode);
1910 1910
1911 d_drop(dentry); 1911 d_drop(dentry);
1912 error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); 1912 error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name);
@@ -1990,9 +1990,9 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1990 } 1990 }
1991 } 1991 }
1992 1992
1993 nfs_inode_return_delegation(old_inode); 1993 NFS_PROTO(old_inode)->return_delegation(old_inode);
1994 if (new_inode != NULL) 1994 if (new_inode != NULL)
1995 nfs_inode_return_delegation(new_inode); 1995 NFS_PROTO(new_inode)->return_delegation(new_inode);
1996 1996
1997 error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name, 1997 error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name,
1998 new_dir, &new_dentry->d_name); 1998 new_dir, &new_dentry->d_name);
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 0f0b928ef252..28c9ebbe78a6 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -430,7 +430,7 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
430 * Return any delegations if we're going to change ACLs 430 * Return any delegations if we're going to change ACLs
431 */ 431 */
432 if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0) 432 if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0)
433 nfs_inode_return_delegation(inode); 433 NFS_PROTO(inode)->return_delegation(inode);
434 error = NFS_PROTO(inode)->setattr(dentry, fattr, attr); 434 error = NFS_PROTO(inode)->setattr(dentry, fattr, attr);
435 if (error == 0) 435 if (error == 0)
436 nfs_refresh_inode(inode, fattr); 436 nfs_refresh_inode(inode, fattr);
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 08f832634ef9..4749a32e54be 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -882,6 +882,12 @@ static int nfs3_have_delegation(struct inode *inode, fmode_t flags)
882 return 0; 882 return 0;
883} 883}
884 884
885static int nfs3_return_delegation(struct inode *inode)
886{
887 nfs_wb_all(inode);
888 return 0;
889}
890
885const struct nfs_rpc_ops nfs_v3_clientops = { 891const struct nfs_rpc_ops nfs_v3_clientops = {
886 .version = 3, /* protocol version */ 892 .version = 3, /* protocol version */
887 .dentry_ops = &nfs_dentry_operations, 893 .dentry_ops = &nfs_dentry_operations,
@@ -927,5 +933,6 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
927 .clear_acl_cache = nfs3_forget_cached_acls, 933 .clear_acl_cache = nfs3_forget_cached_acls,
928 .close_context = nfs_close_context, 934 .close_context = nfs_close_context,
929 .have_delegation = nfs3_have_delegation, 935 .have_delegation = nfs3_have_delegation,
936 .return_delegation = nfs3_return_delegation,
930 .init_client = nfs_init_client, 937 .init_client = nfs_init_client,
931}; 938};
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 86f428bb5e07..035f7a0829ec 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -295,7 +295,7 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc
295 return 0; 295 return 0;
296 case -NFS4ERR_OPENMODE: 296 case -NFS4ERR_OPENMODE:
297 if (inode && nfs4_have_delegation(inode, FMODE_READ)) { 297 if (inode && nfs4_have_delegation(inode, FMODE_READ)) {
298 nfs_inode_return_delegation(inode); 298 nfs4_inode_return_delegation(inode);
299 exception->retry = 1; 299 exception->retry = 1;
300 return 0; 300 return 0;
301 } 301 }
@@ -1065,7 +1065,7 @@ static void nfs4_return_incompatible_delegation(struct inode *inode, fmode_t fmo
1065 return; 1065 return;
1066 } 1066 }
1067 rcu_read_unlock(); 1067 rcu_read_unlock();
1068 nfs_inode_return_delegation(inode); 1068 nfs4_inode_return_delegation(inode);
1069} 1069}
1070 1070
1071static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata) 1071static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata)
@@ -3870,7 +3870,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
3870 i = buf_to_pages_noslab(buf, buflen, arg.acl_pages, &arg.acl_pgbase); 3870 i = buf_to_pages_noslab(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
3871 if (i < 0) 3871 if (i < 0)
3872 return i; 3872 return i;
3873 nfs_inode_return_delegation(inode); 3873 nfs4_inode_return_delegation(inode);
3874 ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); 3874 ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
3875 3875
3876 /* 3876 /*
@@ -6805,6 +6805,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
6805 .close_context = nfs4_close_context, 6805 .close_context = nfs4_close_context,
6806 .open_context = nfs4_atomic_open, 6806 .open_context = nfs4_atomic_open,
6807 .have_delegation = nfs4_have_delegation, 6807 .have_delegation = nfs4_have_delegation,
6808 .return_delegation = nfs4_inode_return_delegation,
6808 .init_client = nfs4_init_client, 6809 .init_client = nfs4_init_client,
6809}; 6810};
6810 6811
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 4aed3ddf9bba..16632930abd2 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -739,6 +739,12 @@ static int nfs_have_delegation(struct inode *inode, fmode_t flags)
739 return 0; 739 return 0;
740} 740}
741 741
742static int nfs_return_delegation(struct inode *inode)
743{
744 nfs_wb_all(inode);
745 return 0;
746}
747
742const struct nfs_rpc_ops nfs_v2_clientops = { 748const struct nfs_rpc_ops nfs_v2_clientops = {
743 .version = 2, /* protocol version */ 749 .version = 2, /* protocol version */
744 .dentry_ops = &nfs_dentry_operations, 750 .dentry_ops = &nfs_dentry_operations,
@@ -783,5 +789,6 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
783 .lock_check_bounds = nfs_lock_check_bounds, 789 .lock_check_bounds = nfs_lock_check_bounds,
784 .close_context = nfs_close_context, 790 .close_context = nfs_close_context,
785 .have_delegation = nfs_have_delegation, 791 .have_delegation = nfs_have_delegation,
792 .return_delegation = nfs_return_delegation,
786 .init_client = nfs_init_client, 793 .init_client = nfs_init_client,
787}; 794};
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 3210a03342f9..13cea637eff8 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -501,7 +501,7 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
501 (unsigned long long)NFS_FILEID(dentry->d_inode)); 501 (unsigned long long)NFS_FILEID(dentry->d_inode));
502 502
503 /* Return delegation in anticipation of the rename */ 503 /* Return delegation in anticipation of the rename */
504 nfs_inode_return_delegation(dentry->d_inode); 504 NFS_PROTO(dentry->d_inode)->return_delegation(dentry->d_inode);
505 505
506 sdentry = NULL; 506 sdentry = NULL;
507 do { 507 do {
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 8787f77c64b3..62235be07fb8 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1423,6 +1423,7 @@ struct nfs_rpc_ops {
1423 int open_flags, 1423 int open_flags,
1424 struct iattr *iattr); 1424 struct iattr *iattr);
1425 int (*have_delegation)(struct inode *, fmode_t); 1425 int (*have_delegation)(struct inode *, fmode_t);
1426 int (*return_delegation)(struct inode *);
1426 struct nfs_client * 1427 struct nfs_client *
1427 (*init_client) (struct nfs_client *, const struct rpc_timeout *, 1428 (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1428 const char *, rpc_authflavor_t); 1429 const char *, rpc_authflavor_t);