Skip to content

Commit 3ee735e

Browse files
author
Al Viro
committed
rpc_create_client_dir(): don't bother with rpc_populate()
not for a single file... Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent db83fa9 commit 3ee735e

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

net/sunrpc/rpc_pipe.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -852,19 +852,6 @@ rpc_destroy_pipe_dir_objects(struct rpc_pipe_dir_head *pdh)
852852
pdo->pdo_ops->destroy(dir, pdo);
853853
}
854854

855-
enum {
856-
RPCAUTH_info,
857-
RPCAUTH_EOF
858-
};
859-
860-
static const struct rpc_filelist authfiles[] = {
861-
[RPCAUTH_info] = {
862-
.name = "info",
863-
.i_fop = &rpc_info_operations,
864-
.mode = S_IFREG | 0400,
865-
},
866-
};
867-
868855
/**
869856
* rpc_create_client_dir - Create a new rpc_client directory in rpc_pipefs
870857
* @dentry: the parent of new directory
@@ -881,16 +868,18 @@ struct dentry *rpc_create_client_dir(struct dentry *dentry,
881868
struct rpc_clnt *rpc_client)
882869
{
883870
struct dentry *ret;
884-
int error;
871+
int err;
885872

886873
ret = rpc_new_dir(dentry, name, 0555);
887874
if (IS_ERR(ret))
888875
return ret;
889-
error = rpc_populate(ret, authfiles, RPCAUTH_info, RPCAUTH_EOF,
890-
rpc_client);
891-
if (unlikely(error)) {
876+
err = rpc_new_file(ret, "info", S_IFREG | 0400,
877+
&rpc_info_operations, rpc_client);
878+
if (err) {
879+
pr_warn("%s failed to populate directory %pd\n",
880+
__func__, ret);
892881
simple_recursive_removal(ret, NULL);
893-
return ERR_PTR(error);
882+
return ERR_PTR(err);
894883
}
895884
rpc_client->cl_pipedir_objects.pdh_dentry = ret;
896885
rpc_create_pipe_dir_objects(&rpc_client->cl_pipedir_objects);

0 commit comments

Comments
 (0)