Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+14 -36
+2 -10
fs/nfs/blocklayout/rpc_pipefs.c
··· 154 154 return dentry; 155 155 } 156 156 157 - static void nfs4blocklayout_unregister_sb(struct super_block *sb, 158 - struct rpc_pipe *pipe) 159 - { 160 - if (pipe->dentry) 161 - rpc_unlink(pipe->dentry); 162 - } 163 - 164 157 static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event, 165 158 void *ptr) 166 159 { ··· 181 188 nn->bl_device_pipe->dentry = dentry; 182 189 break; 183 190 case RPC_PIPEFS_UMOUNT: 184 - if (nn->bl_device_pipe->dentry) 185 - nfs4blocklayout_unregister_sb(sb, nn->bl_device_pipe); 191 + rpc_unlink(nn->bl_device_pipe); 186 192 break; 187 193 default: 188 194 ret = -ENOTSUPP; ··· 216 224 217 225 pipefs_sb = rpc_get_sb_net(net); 218 226 if (pipefs_sb) { 219 - nfs4blocklayout_unregister_sb(pipefs_sb, pipe); 227 + rpc_unlink(pipe); 220 228 rpc_put_sb_net(net); 221 229 } 222 230 }
+1 -5
fs/nfs/nfs4idmap.c
··· 424 424 struct rpc_pipe_dir_object *pdo) 425 425 { 426 426 struct idmap *idmap = pdo->pdo_data; 427 - struct rpc_pipe *pipe = idmap->idmap_pipe; 428 427 429 - if (pipe->dentry) { 430 - rpc_unlink(pipe->dentry); 431 - pipe->dentry = NULL; 432 - } 428 + rpc_unlink(idmap->idmap_pipe); 433 429 } 434 430 435 431 static int nfs_idmap_pipe_create(struct dentry *dir,
+2 -10
fs/nfsd/nfs4recover.c
··· 963 963 return dentry; 964 964 } 965 965 966 - static void 967 - nfsd4_cld_unregister_sb(struct rpc_pipe *pipe) 968 - { 969 - if (pipe->dentry) 970 - rpc_unlink(pipe->dentry); 971 - } 972 - 973 966 static struct dentry * 974 967 nfsd4_cld_register_net(struct net *net, struct rpc_pipe *pipe) 975 968 { ··· 984 991 985 992 sb = rpc_get_sb_net(net); 986 993 if (sb) { 987 - nfsd4_cld_unregister_sb(pipe); 994 + rpc_unlink(pipe); 988 995 rpc_put_sb_net(net); 989 996 } 990 997 } ··· 2135 2142 cn->cn_pipe->dentry = dentry; 2136 2143 break; 2137 2144 case RPC_PIPEFS_UMOUNT: 2138 - if (cn->cn_pipe->dentry) 2139 - nfsd4_cld_unregister_sb(cn->cn_pipe); 2145 + rpc_unlink(cn->cn_pipe); 2140 2146 break; 2141 2147 default: 2142 2148 ret = -ENOTSUPP;
+1 -1
include/linux/sunrpc/rpc_pipe_fs.h
··· 129 129 void rpc_destroy_pipe_data(struct rpc_pipe *pipe); 130 130 extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *, 131 131 struct rpc_pipe *); 132 - extern int rpc_unlink(struct dentry *); 132 + extern void rpc_unlink(struct rpc_pipe *); 133 133 extern int register_rpc_pipefs(void); 134 134 extern void unregister_rpc_pipefs(void); 135 135
+1 -5
net/sunrpc/auth_gss/auth_gss.c
··· 887 887 struct rpc_pipe_dir_object *pdo) 888 888 { 889 889 struct gss_pipe *gss_pipe = pdo->pdo_data; 890 - struct rpc_pipe *pipe = gss_pipe->pipe; 891 890 892 - if (pipe->dentry != NULL) { 893 - rpc_unlink(pipe->dentry); 894 - pipe->dentry = NULL; 895 - } 891 + rpc_unlink(gss_pipe->pipe); 896 892 } 897 893 898 894 static int gss_pipe_dentry_create(struct dentry *dir,
+7 -5
net/sunrpc/rpc_pipe.c
··· 737 737 738 738 /** 739 739 * rpc_unlink - remove a pipe 740 - * @dentry: dentry for the pipe, as returned from rpc_mkpipe 740 + * @pipe: the pipe to be removed 741 741 * 742 742 * After this call, lookups will no longer find the pipe, and any 743 743 * attempts to read or write using preexisting opens of the pipe will 744 744 * return -EPIPE. 745 745 */ 746 - int 747 - rpc_unlink(struct dentry *dentry) 746 + void 747 + rpc_unlink(struct rpc_pipe *pipe) 748 748 { 749 - simple_recursive_removal(dentry, rpc_close_pipes); 750 - return 0; 749 + if (pipe->dentry) { 750 + simple_recursive_removal(pipe->dentry, rpc_close_pipes); 751 + pipe->dentry = NULL; 752 + } 751 753 } 752 754 EXPORT_SYMBOL_GPL(rpc_unlink); 753 755