From: Dmitry Kadashev <[email protected]>
To: Linus Torvalds <[email protected]>
Cc: Jens Axboe <[email protected]>, Al Viro <[email protected]>,
io-uring <[email protected]>
Subject: Re: [GIT PULL] io_uring updates for 5.14-rc1
Date: Sat, 3 Jul 2021 22:26:50 +0700 [thread overview]
Message-ID: <CAOKbgA6x-qPK4jTmH4AO_GPy=tTRw1uMuD7wyiVFM7q0WQ5WbQ@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wgye_GuQ5cBFC=UOPHkd0o8-Nrau7GNZHTZVuGO2tincw@mail.gmail.com>
On Sat, Jul 3, 2021 at 1:33 AM Linus Torvalds
<[email protected]> wrote:
>
> I wonder if the semantics couldn't be that __filename_create() never
> eats the name, and filename_create() keeps the old semantics?
This is how I originally thought it is going to be, but Al suggested
that it eats the name on the failure. Now that I spent slightly
more time with it I *suspect* the reason (or a part of it) is making it
keep the name on failure would require A LOT of changes, since a lot of
functions that __filename_create() calls eat the name on failure.
How about we change the functions (__filename_create(),
__filename_lookup()) to do what filename_parentat() does since
5c31b6cedb675 ("namei: saner calling conventions for
filename_parentat()"), namely return struct filename *.
The nice thing here is we end up having the functions working the same
way, so it's much easier to reason about. In particular, all of the
functions seem to be expected to consume struct filename that was passed
to it. And it is going to be the same with these two new ones instead of
introducing a class of functions that do not do that.
The not-so-nice thing is for __filename_create we'd have to move struct
dentry to args. But as far as I can see there are quite a few "out" args
anyway, and struct path is an "out" arg already. So maybe it's not a big
deal. Maybe it is. Comments are welcome.
The code in question then will look like this:
old = __filename_lookup(olddfd, old, how, &old_path, NULL);
if (IS_ERR(old))
goto out_putnames;
new = __filename_create(newdfd, new, &new_path, &new_dentry,
(how & LOOKUP_REVAL));
if (IS_ERR(new))
goto out_putpath;
Thoughts?
--
Dmitry Kadashev
next prev parent reply other threads:[~2021-07-03 15:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-29 20:43 [GIT PULL] io_uring updates for 5.14-rc1 Jens Axboe
2021-06-30 20:05 ` Linus Torvalds
2021-06-30 20:14 ` Jens Axboe
2021-06-30 20:18 ` Linus Torvalds
2021-06-30 20:21 ` Jens Axboe
2021-07-02 11:32 ` Dmitry Kadashev
2021-07-02 18:33 ` Linus Torvalds
2021-07-03 15:26 ` Dmitry Kadashev [this message]
2021-07-05 21:40 ` Linus Torvalds
2021-07-06 12:06 ` Dmitry Kadashev
-- strict thread matches above, loose matches on Subject: below --
2021-07-01 15:24 Jens Axboe
2021-07-01 19:20 ` pr-tracker-bot
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='CAOKbgA6x-qPK4jTmH4AO_GPy=tTRw1uMuD7wyiVFM7q0WQ5WbQ@mail.gmail.com' \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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