From: Jeff Layton <jlayton@kernel.org>
To: Al Viro <viro@zeniv.linux.org.uk>, linux-fsdevel@vger.kernel.org
Cc: chuck.lever@oracle.com, linux-nfs@vger.kernel.org,
neil@brown.name, torvalds@linux-foundation.org,
trondmy@kernel.org
Subject: Re: [PATCH 12/17] rpc_mkpipe_dentry(): switch to start_creating()
Date: Fri, 13 Jun 2025 15:27:39 -0400 [thread overview]
Message-ID: <6ccc761034c253704988b5a7b58d908e06127a9f.camel@kernel.org> (raw)
In-Reply-To: <20250613073432.1871345-12-viro@zeniv.linux.org.uk>
On Fri, 2025-06-13 at 08:34 +0100, Al Viro wrote:
> ... and make sure we set the rpc_pipe-private part of inode up before
> attaching it to dentry.
>
"rpc_pipe->private"
nit: subject should say "...switch to simple_start_creating()".
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> net/sunrpc/rpc_pipe.c | 83 +++++++++++++++----------------------------
> 1 file changed, 29 insertions(+), 54 deletions(-)
>
> diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
> index 8f88c75c9b30..a52fe3bbf9dc 100644
> --- a/net/sunrpc/rpc_pipe.c
> +++ b/net/sunrpc/rpc_pipe.c
> @@ -485,31 +485,6 @@ rpc_get_inode(struct super_block *sb, umode_t mode)
> return inode;
> }
>
> -static int __rpc_create_common(struct inode *dir, struct dentry *dentry,
> - umode_t mode,
> - const struct file_operations *i_fop,
> - void *private)
> -{
> - struct inode *inode;
> -
> - d_drop(dentry);
> - inode = rpc_get_inode(dir->i_sb, mode);
> - if (!inode)
> - goto out_err;
> - inode->i_ino = iunique(dir->i_sb, 100);
> - if (i_fop)
> - inode->i_fop = i_fop;
> - if (private)
> - rpc_inode_setowner(inode, private);
> - d_add(dentry, inode);
> - return 0;
> -out_err:
> - printk(KERN_WARNING "%s: %s failed to allocate inode for dentry %pd\n",
> - __FILE__, __func__, dentry);
> - dput(dentry);
> - return -ENOMEM;
> -}
> -
> static void
> init_pipe(struct rpc_pipe *pipe)
> {
> @@ -546,25 +521,6 @@ struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags)
> }
> EXPORT_SYMBOL_GPL(rpc_mkpipe_data);
>
> -static int __rpc_mkpipe_dentry(struct inode *dir, struct dentry *dentry,
> - umode_t mode,
> - const struct file_operations *i_fop,
> - void *private,
> - struct rpc_pipe *pipe)
> -{
> - struct rpc_inode *rpci;
> - int err;
> -
> - err = __rpc_create_common(dir, dentry, S_IFIFO | mode, i_fop, private);
> - if (err)
> - return err;
> - rpci = RPC_I(d_inode(dentry));
> - rpci->private = private;
> - rpci->pipe = pipe;
> - fsnotify_create(dir, dentry);
> - return 0;
> -}
> -
> static int rpc_new_file(struct dentry *parent,
> const char *name,
> umode_t mode,
> @@ -704,8 +660,10 @@ static struct dentry *rpc_mkdir_populate(struct dentry *parent,
> int rpc_mkpipe_dentry(struct dentry *parent, const char *name,
> void *private, struct rpc_pipe *pipe)
> {
> - struct dentry *dentry;
> struct inode *dir = d_inode(parent);
> + struct dentry *dentry;
> + struct inode *inode;
> + struct rpc_inode *rpci;
> umode_t umode = S_IFIFO | 0600;
> int err;
>
> @@ -715,16 +673,33 @@ int rpc_mkpipe_dentry(struct dentry *parent, const char *name,
> umode &= ~0222;
>
> dentry = simple_start_creating(parent, name);
> - if (IS_ERR(dentry))
> - return PTR_ERR(dentry);
> - err = __rpc_mkpipe_dentry(dir, dentry, umode, &rpc_pipe_fops,
> - private, pipe);
> - if (unlikely(err))
> - pr_warn("%s() failed to create pipe %pd/%s (errno = %d)\n",
> - __func__, parent, name, err);
> - else
> - pipe->dentry = dentry;
> + if (IS_ERR(dentry)) {
> + err = PTR_ERR(dentry);
> + goto failed;
> + }
> +
> + inode = rpc_get_inode(dir->i_sb, umode);
> + if (unlikely(!inode)) {
> + dput(dentry);
> + inode_unlock(dir);
> + err = -ENOMEM;
> + goto failed;
> + }
> + inode->i_ino = iunique(dir->i_sb, 100);
> + inode->i_fop = &rpc_pipe_fops;
> + rpci = RPC_I(inode);
> + rpci->private = private;
> + rpci->pipe = pipe;
> + rpc_inode_setowner(inode, private);
> + d_instantiate(dentry, inode);
> + pipe->dentry = dentry;
> + fsnotify_create(dir, dentry);
> inode_unlock(dir);
> + return 0;
> +
> +failed:
> + pr_warn("%s() failed to create pipe %pd/%s (errno = %d)\n",
> + __func__, parent, name, err);
> return err;
> }
> EXPORT_SYMBOL_GPL(rpc_mkpipe_dentry);
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2025-06-13 19:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 7:31 [PATCHES][RFC][CFT] rpc_pipefs cleanups Al Viro
2025-06-13 7:34 ` [PATCH 01/17] simple_recursive_removal(): saner interaction with fsnotify Al Viro
2025-06-13 7:34 ` [PATCH 02/17] new helper: simple_start_creating() Al Viro
2025-06-13 18:31 ` Jeff Layton
2025-06-13 22:36 ` Al Viro
2025-06-13 23:46 ` Jeff Layton
2025-06-13 7:34 ` [PATCH 03/17] rpc_pipe: clean failure exits in fill_super Al Viro
2025-06-13 7:34 ` [PATCH 04/17] rpc_{rmdir_,}depopulate(): use simple_recursive_removal() instead Al Viro
2025-06-13 7:34 ` [PATCH 05/17] rpc_unlink(): use simple_recursive_removal() Al Viro
2025-06-13 7:34 ` [PATCH 06/17] rpc_populate(): lift cleanup into callers Al Viro
2025-06-13 7:34 ` [PATCH 07/17] rpc_unlink(): saner calling conventions Al Viro
2025-06-13 7:34 ` [PATCH 08/17] rpc_mkpipe_dentry(): " Al Viro
2025-06-13 7:34 ` [PATCH 09/17] rpc_pipe: don't overdo directory locking Al Viro
2025-06-13 7:34 ` [PATCH 10/17] rpc_pipe: saner primitive for creating subdirectories Al Viro
2025-06-13 7:34 ` [PATCH 11/17] rpc_pipe: saner primitive for creating regular files Al Viro
2025-06-13 7:34 ` [PATCH 12/17] rpc_mkpipe_dentry(): switch to start_creating() Al Viro
2025-06-13 19:27 ` Jeff Layton [this message]
2025-06-16 19:26 ` Al Viro
2025-06-13 7:34 ` [PATCH 13/17] rpc_gssd_dummy_populate(): don't bother with rpc_populate() Al Viro
2025-06-13 7:34 ` [PATCH 14/17] rpc_pipe: expand the calls of rpc_mkdir_populate() Al Viro
2025-06-13 7:34 ` [PATCH 15/17] rpc_new_dir(): the last argument is always NULL Al Viro
2025-06-13 7:34 ` [PATCH 16/17] rpc_create_client_dir(): don't bother with rpc_populate() Al Viro
2025-06-13 7:34 ` [PATCH 17/17] rpc_create_client_dir(): return 0 or -E Al Viro
2025-06-13 8:19 ` [PATCH 01/17] simple_recursive_removal(): saner interaction with fsnotify Amir Goldstein
2025-06-13 19:32 ` [PATCHES][RFC][CFT] rpc_pipefs cleanups Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6ccc761034c253704988b5a7b58d908e06127a9f.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=torvalds@linux-foundation.org \
--cc=trondmy@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).