mirror of https://github.com/torvalds/linux.git
rpc_unlink(): saner calling conventions
1) pass it pipe instead of pipe->dentry 2) zero pipe->dentry afterwards 3) it always returns 0; why bother? Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
8be22c4964
commit
bccea4ed06
|
|
@ -154,13 +154,6 @@ static struct dentry *nfs4blocklayout_register_sb(struct super_block *sb,
|
||||||
return dentry;
|
return dentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nfs4blocklayout_unregister_sb(struct super_block *sb,
|
|
||||||
struct rpc_pipe *pipe)
|
|
||||||
{
|
|
||||||
if (pipe->dentry)
|
|
||||||
rpc_unlink(pipe->dentry);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event,
|
static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event,
|
||||||
void *ptr)
|
void *ptr)
|
||||||
{
|
{
|
||||||
|
|
@ -188,8 +181,7 @@ static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event,
|
||||||
nn->bl_device_pipe->dentry = dentry;
|
nn->bl_device_pipe->dentry = dentry;
|
||||||
break;
|
break;
|
||||||
case RPC_PIPEFS_UMOUNT:
|
case RPC_PIPEFS_UMOUNT:
|
||||||
if (nn->bl_device_pipe->dentry)
|
rpc_unlink(nn->bl_device_pipe);
|
||||||
nfs4blocklayout_unregister_sb(sb, nn->bl_device_pipe);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -ENOTSUPP;
|
ret = -ENOTSUPP;
|
||||||
|
|
@ -224,7 +216,7 @@ static void nfs4blocklayout_unregister_net(struct net *net,
|
||||||
|
|
||||||
pipefs_sb = rpc_get_sb_net(net);
|
pipefs_sb = rpc_get_sb_net(net);
|
||||||
if (pipefs_sb) {
|
if (pipefs_sb) {
|
||||||
nfs4blocklayout_unregister_sb(pipefs_sb, pipe);
|
rpc_unlink(pipe);
|
||||||
rpc_put_sb_net(net);
|
rpc_put_sb_net(net);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -424,12 +424,8 @@ static void nfs_idmap_pipe_destroy(struct dentry *dir,
|
||||||
struct rpc_pipe_dir_object *pdo)
|
struct rpc_pipe_dir_object *pdo)
|
||||||
{
|
{
|
||||||
struct idmap *idmap = pdo->pdo_data;
|
struct idmap *idmap = pdo->pdo_data;
|
||||||
struct rpc_pipe *pipe = idmap->idmap_pipe;
|
|
||||||
|
|
||||||
if (pipe->dentry) {
|
rpc_unlink(idmap->idmap_pipe);
|
||||||
rpc_unlink(pipe->dentry);
|
|
||||||
pipe->dentry = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nfs_idmap_pipe_create(struct dentry *dir,
|
static int nfs_idmap_pipe_create(struct dentry *dir,
|
||||||
|
|
|
||||||
|
|
@ -963,13 +963,6 @@ nfsd4_cld_register_sb(struct super_block *sb, struct rpc_pipe *pipe)
|
||||||
return dentry;
|
return dentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
nfsd4_cld_unregister_sb(struct rpc_pipe *pipe)
|
|
||||||
{
|
|
||||||
if (pipe->dentry)
|
|
||||||
rpc_unlink(pipe->dentry);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct dentry *
|
static struct dentry *
|
||||||
nfsd4_cld_register_net(struct net *net, struct rpc_pipe *pipe)
|
nfsd4_cld_register_net(struct net *net, struct rpc_pipe *pipe)
|
||||||
{
|
{
|
||||||
|
|
@ -991,7 +984,7 @@ nfsd4_cld_unregister_net(struct net *net, struct rpc_pipe *pipe)
|
||||||
|
|
||||||
sb = rpc_get_sb_net(net);
|
sb = rpc_get_sb_net(net);
|
||||||
if (sb) {
|
if (sb) {
|
||||||
nfsd4_cld_unregister_sb(pipe);
|
rpc_unlink(pipe);
|
||||||
rpc_put_sb_net(net);
|
rpc_put_sb_net(net);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2142,8 +2135,7 @@ rpc_pipefs_event(struct notifier_block *nb, unsigned long event, void *ptr)
|
||||||
cn->cn_pipe->dentry = dentry;
|
cn->cn_pipe->dentry = dentry;
|
||||||
break;
|
break;
|
||||||
case RPC_PIPEFS_UMOUNT:
|
case RPC_PIPEFS_UMOUNT:
|
||||||
if (cn->cn_pipe->dentry)
|
rpc_unlink(cn->cn_pipe);
|
||||||
nfsd4_cld_unregister_sb(cn->cn_pipe);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -ENOTSUPP;
|
ret = -ENOTSUPP;
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags);
|
||||||
void rpc_destroy_pipe_data(struct rpc_pipe *pipe);
|
void rpc_destroy_pipe_data(struct rpc_pipe *pipe);
|
||||||
extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *,
|
extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *,
|
||||||
struct rpc_pipe *);
|
struct rpc_pipe *);
|
||||||
extern int rpc_unlink(struct dentry *);
|
extern void rpc_unlink(struct rpc_pipe *);
|
||||||
extern int register_rpc_pipefs(void);
|
extern int register_rpc_pipefs(void);
|
||||||
extern void unregister_rpc_pipefs(void);
|
extern void unregister_rpc_pipefs(void);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -887,12 +887,8 @@ static void gss_pipe_dentry_destroy(struct dentry *dir,
|
||||||
struct rpc_pipe_dir_object *pdo)
|
struct rpc_pipe_dir_object *pdo)
|
||||||
{
|
{
|
||||||
struct gss_pipe *gss_pipe = pdo->pdo_data;
|
struct gss_pipe *gss_pipe = pdo->pdo_data;
|
||||||
struct rpc_pipe *pipe = gss_pipe->pipe;
|
|
||||||
|
|
||||||
if (pipe->dentry != NULL) {
|
rpc_unlink(gss_pipe->pipe);
|
||||||
rpc_unlink(pipe->dentry);
|
|
||||||
pipe->dentry = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gss_pipe_dentry_create(struct dentry *dir,
|
static int gss_pipe_dentry_create(struct dentry *dir,
|
||||||
|
|
|
||||||
|
|
@ -737,17 +737,19 @@ EXPORT_SYMBOL_GPL(rpc_mkpipe_dentry);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rpc_unlink - remove a pipe
|
* rpc_unlink - remove a pipe
|
||||||
* @dentry: dentry for the pipe, as returned from rpc_mkpipe
|
* @pipe: the pipe to be removed
|
||||||
*
|
*
|
||||||
* After this call, lookups will no longer find the pipe, and any
|
* After this call, lookups will no longer find the pipe, and any
|
||||||
* attempts to read or write using preexisting opens of the pipe will
|
* attempts to read or write using preexisting opens of the pipe will
|
||||||
* return -EPIPE.
|
* return -EPIPE.
|
||||||
*/
|
*/
|
||||||
int
|
void
|
||||||
rpc_unlink(struct dentry *dentry)
|
rpc_unlink(struct rpc_pipe *pipe)
|
||||||
{
|
{
|
||||||
simple_recursive_removal(dentry, rpc_close_pipes);
|
if (pipe->dentry) {
|
||||||
return 0;
|
simple_recursive_removal(pipe->dentry, rpc_close_pipes);
|
||||||
|
pipe->dentry = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rpc_unlink);
|
EXPORT_SYMBOL_GPL(rpc_unlink);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue