Commit f2c2c552 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

NFS: Move delegation recall into the NFSv4 callback for rename_setup()

Move the delegation recall out of the generic code, and into the NFSv4
specific callback.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 912678db
...@@ -2020,10 +2020,6 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -2020,10 +2020,6 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
} }
} }
NFS_PROTO(old_inode)->return_delegation(old_inode);
if (new_inode != NULL)
NFS_PROTO(new_inode)->return_delegation(new_inode);
task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry, NULL); task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry, NULL);
if (IS_ERR(task)) { if (IS_ERR(task)) {
error = PTR_ERR(task); error = PTR_ERR(task);
......
...@@ -433,7 +433,9 @@ nfs3_proc_unlink_done(struct rpc_task *task, struct inode *dir) ...@@ -433,7 +433,9 @@ nfs3_proc_unlink_done(struct rpc_task *task, struct inode *dir)
} }
static void static void
nfs3_proc_rename_setup(struct rpc_message *msg, struct inode *dir) nfs3_proc_rename_setup(struct rpc_message *msg,
struct dentry *old_dentry,
struct dentry *new_dentry)
{ {
msg->rpc_proc = &nfs3_procedures[NFS3PROC_RENAME]; msg->rpc_proc = &nfs3_procedures[NFS3PROC_RENAME];
} }
......
...@@ -4267,14 +4267,21 @@ static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir) ...@@ -4267,14 +4267,21 @@ static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)
return 1; return 1;
} }
static void nfs4_proc_rename_setup(struct rpc_message *msg, struct inode *dir) static void nfs4_proc_rename_setup(struct rpc_message *msg,
struct dentry *old_dentry,
struct dentry *new_dentry)
{ {
struct nfs_server *server = NFS_SERVER(dir);
struct nfs_renameargs *arg = msg->rpc_argp; struct nfs_renameargs *arg = msg->rpc_argp;
struct nfs_renameres *res = msg->rpc_resp; struct nfs_renameres *res = msg->rpc_resp;
struct inode *old_inode = d_inode(old_dentry);
struct inode *new_inode = d_inode(new_dentry);
if (old_inode)
nfs4_inode_return_delegation(old_inode);
if (new_inode)
nfs4_inode_return_delegation(new_inode);
msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME]; msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME];
res->server = server; res->server = NFS_SB(old_dentry->d_sb);
nfs4_init_sequence(&arg->seq_args, &res->seq_res, 1); nfs4_init_sequence(&arg->seq_args, &res->seq_res, 1);
} }
......
...@@ -338,7 +338,9 @@ static int nfs_proc_unlink_done(struct rpc_task *task, struct inode *dir) ...@@ -338,7 +338,9 @@ static int nfs_proc_unlink_done(struct rpc_task *task, struct inode *dir)
} }
static void static void
nfs_proc_rename_setup(struct rpc_message *msg, struct inode *dir) nfs_proc_rename_setup(struct rpc_message *msg,
struct dentry *old_dentry,
struct dentry *new_dentry)
{ {
msg->rpc_proc = &nfs_procedures[NFSPROC_RENAME]; msg->rpc_proc = &nfs_procedures[NFSPROC_RENAME];
} }
......
...@@ -386,7 +386,7 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir, ...@@ -386,7 +386,7 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
nfs_sb_active(old_dir->i_sb); nfs_sb_active(old_dir->i_sb);
NFS_PROTO(data->old_dir)->rename_setup(&msg, old_dir); NFS_PROTO(data->old_dir)->rename_setup(&msg, old_dentry, new_dentry);
return rpc_run_task(&task_setup_data); return rpc_run_task(&task_setup_data);
} }
...@@ -463,9 +463,6 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry) ...@@ -463,9 +463,6 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
fileid = NFS_FILEID(d_inode(dentry)); fileid = NFS_FILEID(d_inode(dentry));
/* Return delegation in anticipation of the rename */
NFS_PROTO(d_inode(dentry))->return_delegation(d_inode(dentry));
sdentry = NULL; sdentry = NULL;
do { do {
int slen; int slen;
......
...@@ -1594,7 +1594,9 @@ struct nfs_rpc_ops { ...@@ -1594,7 +1594,9 @@ struct nfs_rpc_ops {
void (*unlink_setup) (struct rpc_message *, struct inode *dir); void (*unlink_setup) (struct rpc_message *, struct inode *dir);
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, struct inode *dir); void (*rename_setup) (struct rpc_message *msg,
struct dentry *old_dentry,
struct dentry *new_dentry);
void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *); void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir); int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
int (*link) (struct inode *, struct inode *, const struct qstr *); int (*link) (struct inode *, struct inode *, const struct qstr *);
......
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