Skip to content

Commit adb4b42

Browse files
Lance Sheltonamschuma-ntap
authored andcommitted
Return the delegation when deleting sillyrenamed files
Add a callback to return the delegation in order to allow generic NFS code to return the delegation when appropriate. Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Lance Shelton <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent d79ed37 commit adb4b42

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

fs/nfs/nfs3proc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,13 @@ static int nfs3_have_delegation(struct inode *inode, fmode_t type, int flags)
984984
return 0;
985985
}
986986

987+
static int nfs3_return_delegation(struct inode *inode)
988+
{
989+
if (S_ISREG(inode->i_mode))
990+
nfs_wb_all(inode);
991+
return 0;
992+
}
993+
987994
static const struct inode_operations nfs3_dir_inode_operations = {
988995
.create = nfs_create,
989996
.atomic_open = nfs_atomic_open_v23,
@@ -1062,6 +1069,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
10621069
.clear_acl_cache = forget_all_cached_acls,
10631070
.close_context = nfs_close_context,
10641071
.have_delegation = nfs3_have_delegation,
1072+
.return_delegation = nfs3_return_delegation,
10651073
.alloc_client = nfs_alloc_client,
10661074
.init_client = nfs_init_client,
10671075
.free_client = nfs_free_client,

fs/nfs/nfs4proc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10871,6 +10871,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
1087110871
.close_context = nfs4_close_context,
1087210872
.open_context = nfs4_atomic_open,
1087310873
.have_delegation = nfs4_have_delegation,
10874+
.return_delegation = nfs4_inode_return_delegation,
1087410875
.alloc_client = nfs4_alloc_client,
1087510876
.init_client = nfs4_init_client,
1087610877
.free_client = nfs4_free_client,

fs/nfs/proc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,13 @@ static int nfs_have_delegation(struct inode *inode, fmode_t type, int flags)
692692
return 0;
693693
}
694694

695+
static int nfs_return_delegation(struct inode *inode)
696+
{
697+
if (S_ISREG(inode->i_mode))
698+
nfs_wb_all(inode);
699+
return 0;
700+
}
701+
695702
static const struct inode_operations nfs_dir_inode_operations = {
696703
.create = nfs_create,
697704
.lookup = nfs_lookup,
@@ -757,6 +764,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
757764
.lock_check_bounds = nfs_lock_check_bounds,
758765
.close_context = nfs_close_context,
759766
.have_delegation = nfs_have_delegation,
767+
.return_delegation = nfs_return_delegation,
760768
.alloc_client = nfs_alloc_client,
761769
.init_client = nfs_init_client,
762770
.free_client = nfs_free_client,

fs/nfs/unlink.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ nfs_complete_unlink(struct dentry *dentry, struct inode *inode)
232232
dentry->d_fsdata = NULL;
233233
spin_unlock(&dentry->d_lock);
234234

235+
NFS_PROTO(inode)->return_delegation(inode);
236+
235237
if (NFS_STALE(inode) || !nfs_call_unlink(dentry, inode, data))
236238
nfs_free_unlinkdata(data);
237239
}

include/linux/nfs_xdr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,7 @@ struct nfs_rpc_ops {
18401840
struct iattr *iattr,
18411841
int *);
18421842
int (*have_delegation)(struct inode *, fmode_t, int);
1843+
int (*return_delegation)(struct inode *);
18431844
struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
18441845
struct nfs_client *(*init_client) (struct nfs_client *,
18451846
const struct nfs_client_initdata *);

0 commit comments

Comments
 (0)