Commit 912678db authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

NFS: Move the delegation return down into nfs4_proc_remove()

Move the delegation return out of generic code and down into the
NFSv4 specific unlink code.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 9f768272
...@@ -1798,12 +1798,11 @@ static int nfs_safe_remove(struct dentry *dentry) ...@@ -1798,12 +1798,11 @@ static int nfs_safe_remove(struct dentry *dentry)
trace_nfs_remove_enter(dir, dentry); trace_nfs_remove_enter(dir, dentry);
if (inode != NULL) { if (inode != NULL) {
NFS_PROTO(inode)->return_delegation(inode); error = NFS_PROTO(dir)->remove(dir, dentry);
error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
if (error == 0) if (error == 0)
nfs_drop_nlink(inode); nfs_drop_nlink(inode);
} else } else
error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); error = NFS_PROTO(dir)->remove(dir, dentry);
if (error == -ENOENT) if (error == -ENOENT)
nfs_dentry_handle_enoent(dentry); nfs_dentry_handle_enoent(dentry);
trace_nfs_remove_exit(dir, dentry, error); trace_nfs_remove_exit(dir, dentry, error);
......
...@@ -383,11 +383,11 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ...@@ -383,11 +383,11 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
} }
static int static int
nfs3_proc_remove(struct inode *dir, const struct qstr *name) nfs3_proc_remove(struct inode *dir, struct dentry *dentry)
{ {
struct nfs_removeargs arg = { struct nfs_removeargs arg = {
.fh = NFS_FH(dir), .fh = NFS_FH(dir),
.name = *name, .name = dentry->d_name,
}; };
struct nfs_removeres res; struct nfs_removeres res;
struct rpc_message msg = { struct rpc_message msg = {
...@@ -397,7 +397,7 @@ nfs3_proc_remove(struct inode *dir, const struct qstr *name) ...@@ -397,7 +397,7 @@ nfs3_proc_remove(struct inode *dir, const struct qstr *name)
}; };
int status = -ENOMEM; int status = -ENOMEM;
dprintk("NFS call remove %s\n", name->name); dprintk("NFS call remove %pd2\n", dentry);
res.dir_attr = nfs_alloc_fattr(); res.dir_attr = nfs_alloc_fattr();
if (res.dir_attr == NULL) if (res.dir_attr == NULL)
goto out; goto out;
......
...@@ -4200,10 +4200,28 @@ static int _nfs4_proc_remove(struct inode *dir, const struct qstr *name) ...@@ -4200,10 +4200,28 @@ static int _nfs4_proc_remove(struct inode *dir, const struct qstr *name)
return status; return status;
} }
static int nfs4_proc_remove(struct inode *dir, const struct qstr *name) static int nfs4_proc_remove(struct inode *dir, struct dentry *dentry)
{
struct nfs4_exception exception = { };
struct inode *inode = d_inode(dentry);
int err;
if (inode)
nfs4_inode_return_delegation(inode);
do {
err = _nfs4_proc_remove(dir, &dentry->d_name);
trace_nfs4_remove(dir, &dentry->d_name, err);
err = nfs4_handle_exception(NFS_SERVER(dir), err,
&exception);
} while (exception.retry);
return err;
}
static int nfs4_proc_rmdir(struct inode *dir, const struct qstr *name)
{ {
struct nfs4_exception exception = { }; struct nfs4_exception exception = { };
int err; int err;
do { do {
err = _nfs4_proc_remove(dir, name); err = _nfs4_proc_remove(dir, name);
trace_nfs4_remove(dir, name, err); trace_nfs4_remove(dir, name, err);
...@@ -9601,7 +9619,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = { ...@@ -9601,7 +9619,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
.link = nfs4_proc_link, .link = nfs4_proc_link,
.symlink = nfs4_proc_symlink, .symlink = nfs4_proc_symlink,
.mkdir = nfs4_proc_mkdir, .mkdir = nfs4_proc_mkdir,
.rmdir = nfs4_proc_remove, .rmdir = nfs4_proc_rmdir,
.readdir = nfs4_proc_readdir, .readdir = nfs4_proc_readdir,
.mknod = nfs4_proc_mknod, .mknod = nfs4_proc_mknod,
.statfs = nfs4_proc_statfs, .statfs = nfs4_proc_statfs,
......
...@@ -300,11 +300,11 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ...@@ -300,11 +300,11 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
} }
static int static int
nfs_proc_remove(struct inode *dir, const struct qstr *name) nfs_proc_remove(struct inode *dir, struct dentry *dentry)
{ {
struct nfs_removeargs arg = { struct nfs_removeargs arg = {
.fh = NFS_FH(dir), .fh = NFS_FH(dir),
.name = *name, .name = dentry->d_name,
}; };
struct rpc_message msg = { struct rpc_message msg = {
.rpc_proc = &nfs_procedures[NFSPROC_REMOVE], .rpc_proc = &nfs_procedures[NFSPROC_REMOVE],
...@@ -312,7 +312,7 @@ nfs_proc_remove(struct inode *dir, const struct qstr *name) ...@@ -312,7 +312,7 @@ nfs_proc_remove(struct inode *dir, const struct qstr *name)
}; };
int status; int status;
dprintk("NFS call remove %s\n", name->name); dprintk("NFS call remove %pd2\n",dentry);
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
nfs_mark_for_revalidate(dir); nfs_mark_for_revalidate(dir);
......
...@@ -1590,7 +1590,7 @@ struct nfs_rpc_ops { ...@@ -1590,7 +1590,7 @@ struct nfs_rpc_ops {
unsigned int); unsigned int);
int (*create) (struct inode *, struct dentry *, int (*create) (struct inode *, struct dentry *,
struct iattr *, int); struct iattr *, int);
int (*remove) (struct inode *, const struct qstr *); int (*remove) (struct inode *, struct dentry *);
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 *);
......
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