nfs: remove synchronous rename code
Now that nfs_rename uses the async infrastructure, we can remove this. Signed-off-by: Jeff Layton <jlayton@redhat.com> Tested-by: Anna Schumaker <Anna.Schumaker@netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
parent
80a491fd40
commit
33912be816
|
@ -477,41 +477,6 @@ nfs3_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name,
|
|
||||||
struct inode *new_dir, struct qstr *new_name)
|
|
||||||
{
|
|
||||||
struct nfs_renameargs arg = {
|
|
||||||
.old_dir = NFS_FH(old_dir),
|
|
||||||
.old_name = old_name,
|
|
||||||
.new_dir = NFS_FH(new_dir),
|
|
||||||
.new_name = new_name,
|
|
||||||
};
|
|
||||||
struct nfs_renameres res;
|
|
||||||
struct rpc_message msg = {
|
|
||||||
.rpc_proc = &nfs3_procedures[NFS3PROC_RENAME],
|
|
||||||
.rpc_argp = &arg,
|
|
||||||
.rpc_resp = &res,
|
|
||||||
};
|
|
||||||
int status = -ENOMEM;
|
|
||||||
|
|
||||||
dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name);
|
|
||||||
|
|
||||||
res.old_fattr = nfs_alloc_fattr();
|
|
||||||
res.new_fattr = nfs_alloc_fattr();
|
|
||||||
if (res.old_fattr == NULL || res.new_fattr == NULL)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
status = rpc_call_sync(NFS_CLIENT(old_dir), &msg, 0);
|
|
||||||
nfs_post_op_update_inode(old_dir, res.old_fattr);
|
|
||||||
nfs_post_op_update_inode(new_dir, res.new_fattr);
|
|
||||||
out:
|
|
||||||
nfs_free_fattr(res.old_fattr);
|
|
||||||
nfs_free_fattr(res.new_fattr);
|
|
||||||
dprintk("NFS reply rename: %d\n", status);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nfs3_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
|
nfs3_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
|
||||||
{
|
{
|
||||||
|
@ -967,7 +932,6 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
|
||||||
.unlink_setup = nfs3_proc_unlink_setup,
|
.unlink_setup = nfs3_proc_unlink_setup,
|
||||||
.unlink_rpc_prepare = nfs3_proc_unlink_rpc_prepare,
|
.unlink_rpc_prepare = nfs3_proc_unlink_rpc_prepare,
|
||||||
.unlink_done = nfs3_proc_unlink_done,
|
.unlink_done = nfs3_proc_unlink_done,
|
||||||
.rename = nfs3_proc_rename,
|
|
||||||
.rename_setup = nfs3_proc_rename_setup,
|
.rename_setup = nfs3_proc_rename_setup,
|
||||||
.rename_rpc_prepare = nfs3_proc_rename_rpc_prepare,
|
.rename_rpc_prepare = nfs3_proc_rename_rpc_prepare,
|
||||||
.rename_done = nfs3_proc_rename_done,
|
.rename_done = nfs3_proc_rename_done,
|
||||||
|
|
|
@ -3544,49 +3544,6 @@ static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
|
|
||||||
struct inode *new_dir, struct qstr *new_name)
|
|
||||||
{
|
|
||||||
struct nfs_server *server = NFS_SERVER(old_dir);
|
|
||||||
struct nfs_renameargs arg = {
|
|
||||||
.old_dir = NFS_FH(old_dir),
|
|
||||||
.new_dir = NFS_FH(new_dir),
|
|
||||||
.old_name = old_name,
|
|
||||||
.new_name = new_name,
|
|
||||||
};
|
|
||||||
struct nfs_renameres res = {
|
|
||||||
.server = server,
|
|
||||||
};
|
|
||||||
struct rpc_message msg = {
|
|
||||||
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME],
|
|
||||||
.rpc_argp = &arg,
|
|
||||||
.rpc_resp = &res,
|
|
||||||
};
|
|
||||||
int status = -ENOMEM;
|
|
||||||
|
|
||||||
status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
|
|
||||||
if (!status) {
|
|
||||||
update_changeattr(old_dir, &res.old_cinfo);
|
|
||||||
update_changeattr(new_dir, &res.new_cinfo);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
|
|
||||||
struct inode *new_dir, struct qstr *new_name)
|
|
||||||
{
|
|
||||||
struct nfs4_exception exception = { };
|
|
||||||
int err;
|
|
||||||
do {
|
|
||||||
err = _nfs4_proc_rename(old_dir, old_name,
|
|
||||||
new_dir, new_name);
|
|
||||||
trace_nfs4_rename(old_dir, old_name, new_dir, new_name, err);
|
|
||||||
err = nfs4_handle_exception(NFS_SERVER(old_dir), err,
|
|
||||||
&exception);
|
|
||||||
} while (exception.retry);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
|
static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
|
||||||
{
|
{
|
||||||
struct nfs_server *server = NFS_SERVER(inode);
|
struct nfs_server *server = NFS_SERVER(inode);
|
||||||
|
@ -8444,7 +8401,6 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
|
||||||
.unlink_setup = nfs4_proc_unlink_setup,
|
.unlink_setup = nfs4_proc_unlink_setup,
|
||||||
.unlink_rpc_prepare = nfs4_proc_unlink_rpc_prepare,
|
.unlink_rpc_prepare = nfs4_proc_unlink_rpc_prepare,
|
||||||
.unlink_done = nfs4_proc_unlink_done,
|
.unlink_done = nfs4_proc_unlink_done,
|
||||||
.rename = nfs4_proc_rename,
|
|
||||||
.rename_setup = nfs4_proc_rename_setup,
|
.rename_setup = nfs4_proc_rename_setup,
|
||||||
.rename_rpc_prepare = nfs4_proc_rename_rpc_prepare,
|
.rename_rpc_prepare = nfs4_proc_rename_rpc_prepare,
|
||||||
.rename_done = nfs4_proc_rename_done,
|
.rename_done = nfs4_proc_rename_done,
|
||||||
|
|
|
@ -356,30 +356,6 @@ nfs_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
nfs_proc_rename(struct inode *old_dir, struct qstr *old_name,
|
|
||||||
struct inode *new_dir, struct qstr *new_name)
|
|
||||||
{
|
|
||||||
struct nfs_renameargs arg = {
|
|
||||||
.old_dir = NFS_FH(old_dir),
|
|
||||||
.old_name = old_name,
|
|
||||||
.new_dir = NFS_FH(new_dir),
|
|
||||||
.new_name = new_name,
|
|
||||||
};
|
|
||||||
struct rpc_message msg = {
|
|
||||||
.rpc_proc = &nfs_procedures[NFSPROC_RENAME],
|
|
||||||
.rpc_argp = &arg,
|
|
||||||
};
|
|
||||||
int status;
|
|
||||||
|
|
||||||
dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name);
|
|
||||||
status = rpc_call_sync(NFS_CLIENT(old_dir), &msg, 0);
|
|
||||||
nfs_mark_for_revalidate(old_dir);
|
|
||||||
nfs_mark_for_revalidate(new_dir);
|
|
||||||
dprintk("NFS reply rename: %d\n", status);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nfs_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
|
nfs_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
|
||||||
{
|
{
|
||||||
|
@ -745,7 +721,6 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
|
||||||
.unlink_setup = nfs_proc_unlink_setup,
|
.unlink_setup = nfs_proc_unlink_setup,
|
||||||
.unlink_rpc_prepare = nfs_proc_unlink_rpc_prepare,
|
.unlink_rpc_prepare = nfs_proc_unlink_rpc_prepare,
|
||||||
.unlink_done = nfs_proc_unlink_done,
|
.unlink_done = nfs_proc_unlink_done,
|
||||||
.rename = nfs_proc_rename,
|
|
||||||
.rename_setup = nfs_proc_rename_setup,
|
.rename_setup = nfs_proc_rename_setup,
|
||||||
.rename_rpc_prepare = nfs_proc_rename_rpc_prepare,
|
.rename_rpc_prepare = nfs_proc_rename_rpc_prepare,
|
||||||
.rename_done = nfs_proc_rename_done,
|
.rename_done = nfs_proc_rename_done,
|
||||||
|
|
|
@ -1440,8 +1440,6 @@ 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 *);
|
||||||
int (*rename) (struct inode *, struct qstr *,
|
|
||||||
struct inode *, struct qstr *);
|
|
||||||
void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
|
void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue