public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Jens Axboe <axboe@kernel.dk>
Cc: Dmitry Kadashev <dkadashev@gmail.com>,
	io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/2] fs: make do_mkdirat() take struct filename
Date: Tue, 26 Jan 2021 22:55:04 +0000	[thread overview]
Message-ID: <20210126225504.GM740243@zeniv-ca> (raw)
In-Reply-To: <027e8488-2654-12cd-d525-37f249954b4d@kernel.dk>

On Sun, Jan 24, 2021 at 09:38:19PM -0700, Jens Axboe wrote:
> On 11/15/20 9:45 PM, Dmitry Kadashev wrote:
> > Pass in the struct filename pointers instead of the user string, and
> > update the three callers to do the same. This is heavily based on
> > commit dbea8d345177 ("fs: make do_renameat2() take struct filename").
> > 
> > This behaves like do_unlinkat() and do_renameat2().
> 
> Al, are you OK with this patch? Leaving it quoted, though you should
> have the original too.

> > -static long do_mkdirat(int dfd, const char __user *pathname, umode_t mode)
> > +long do_mkdirat(int dfd, struct filename *name, umode_t mode)
> >  {
> >  	struct dentry *dentry;
> >  	struct path path;
> >  	int error;
> >  	unsigned int lookup_flags = LOOKUP_DIRECTORY;
> >  
> > +	if (IS_ERR(name))
> > +		return PTR_ERR(name);
> > +
> >  retry:
> > -	dentry = user_path_create(dfd, pathname, &path, lookup_flags);
> > -	if (IS_ERR(dentry))
> > -		return PTR_ERR(dentry);
> > +	name->refcnt++; /* filename_create() drops our ref */
> > +	dentry = filename_create(dfd, name, &path, lookup_flags);
> > +	if (IS_ERR(dentry)) {
> > +		error = PTR_ERR(dentry);
> > +		goto out;
> > +	}

No.  This is going to be a source of confusion from hell.  If anything,
you want a variant of filename_create() that does not drop name on
success.  With filename_create() itself being an inlined wrapper
for it.

  reply	other threads:[~2021-01-27 12:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16  4:45 [PATCH 0/2] io_uring: add mkdirat support Dmitry Kadashev
2020-11-16  4:45 ` [PATCH 1/2] fs: make do_mkdirat() take struct filename Dmitry Kadashev
2021-01-25  4:38   ` Jens Axboe
2021-01-26 22:55     ` Al Viro [this message]
2021-02-01 11:09       ` Dmitry Kadashev
2021-02-01 15:00         ` Al Viro
2021-02-01 15:29           ` Al Viro
2021-03-31 16:28             ` Eric W. Biederman
2021-03-31 16:46               ` Al Viro
2021-02-02  4:39           ` Dmitry Kadashev
2020-11-16  4:45 ` [PATCH 2/2] io_uring: add support for IORING_OP_MKDIRAT Dmitry Kadashev
2020-12-04 10:57 ` [PATCH 0/2] io_uring: add mkdirat support Dmitry Kadashev
2020-12-15 11:43   ` Dmitry Kadashev
2020-12-15 16:20     ` Jens Axboe
2020-12-16  6:05       ` Dmitry Kadashev
2021-01-20  8:21       ` Dmitry Kadashev
2021-01-26 22:35 ` Jens Axboe
2021-01-27 11:06   ` Dmitry Kadashev
2021-01-27 16:22     ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2020-11-11 13:25 Dmitry Kadashev
2020-11-11 13:25 ` [PATCH 1/2] fs: make do_mkdirat() take struct filename Dmitry Kadashev

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=20210126225504.GM740243@zeniv-ca \
    --to=viro@zeniv.linux.org.uk \
    --cc=axboe@kernel.dk \
    --cc=dkadashev@gmail.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /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