Commit 977fcc2b authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

NFS: Add a delegation return into nfs4_proc_unlink_setup()

Ensure that when we do finally delete the file, then we return the
delegation.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent f2c2c552
...@@ -411,7 +411,7 @@ nfs3_proc_remove(struct inode *dir, struct dentry *dentry) ...@@ -411,7 +411,7 @@ nfs3_proc_remove(struct inode *dir, struct dentry *dentry)
} }
static void static void
nfs3_proc_unlink_setup(struct rpc_message *msg, struct inode *dir) nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dentry)
{ {
msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE]; msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE];
} }
......
...@@ -4231,17 +4231,20 @@ static int nfs4_proc_rmdir(struct inode *dir, const struct qstr *name) ...@@ -4231,17 +4231,20 @@ static int nfs4_proc_rmdir(struct inode *dir, const struct qstr *name)
return err; return err;
} }
static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct inode *dir) static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dentry)
{ {
struct nfs_server *server = NFS_SERVER(dir);
struct nfs_removeargs *args = msg->rpc_argp; struct nfs_removeargs *args = msg->rpc_argp;
struct nfs_removeres *res = msg->rpc_resp; struct nfs_removeres *res = msg->rpc_resp;
struct inode *inode = d_inode(dentry);
res->server = server; res->server = NFS_SB(dentry->d_sb);
msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE]; msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE];
nfs4_init_sequence(&args->seq_args, &res->seq_res, 1); nfs4_init_sequence(&args->seq_args, &res->seq_res, 1);
nfs_fattr_init(res->dir_attr); nfs_fattr_init(res->dir_attr);
if (inode)
nfs4_inode_return_delegation(inode);
} }
static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinkdata *data) static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinkdata *data)
......
...@@ -321,7 +321,7 @@ nfs_proc_remove(struct inode *dir, struct dentry *dentry) ...@@ -321,7 +321,7 @@ nfs_proc_remove(struct inode *dir, struct dentry *dentry)
} }
static void static void
nfs_proc_unlink_setup(struct rpc_message *msg, struct inode *dir) nfs_proc_unlink_setup(struct rpc_message *msg, struct dentry *dentry)
{ {
msg->rpc_proc = &nfs_procedures[NFSPROC_REMOVE]; msg->rpc_proc = &nfs_procedures[NFSPROC_REMOVE];
} }
......
...@@ -105,7 +105,7 @@ static void nfs_do_call_unlink(struct nfs_unlinkdata *data) ...@@ -105,7 +105,7 @@ static void nfs_do_call_unlink(struct nfs_unlinkdata *data)
data->args.fh = NFS_FH(dir); data->args.fh = NFS_FH(dir);
nfs_fattr_init(data->res.dir_attr); nfs_fattr_init(data->res.dir_attr);
NFS_PROTO(dir)->unlink_setup(&msg, dir); NFS_PROTO(dir)->unlink_setup(&msg, data->dentry);
task_setup_data.rpc_client = NFS_CLIENT(dir); task_setup_data.rpc_client = NFS_CLIENT(dir);
task = rpc_run_task(&task_setup_data); task = rpc_run_task(&task_setup_data);
......
...@@ -1591,7 +1591,7 @@ struct nfs_rpc_ops { ...@@ -1591,7 +1591,7 @@ struct nfs_rpc_ops {
int (*create) (struct inode *, struct dentry *, int (*create) (struct inode *, struct dentry *,
struct iattr *, int); struct iattr *, int);
int (*remove) (struct inode *, struct dentry *); int (*remove) (struct inode *, struct dentry *);
void (*unlink_setup) (struct rpc_message *, struct inode *dir); void (*unlink_setup) (struct rpc_message *, struct dentry *);
void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *); void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
int (*unlink_done) (struct rpc_task *, struct inode *); int (*unlink_done) (struct rpc_task *, struct inode *);
void (*rename_setup) (struct rpc_message *msg, void (*rename_setup) (struct rpc_message *msg,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment