Re: [PATCH v7 07/10] fs: make do_linkat() take struct filename
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2021-07-06 18:05:38
Also in:
linux-fsdevel
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2021-07-06 18:05:38
Also in:
linux-fsdevel
On Tue, Jul 6, 2021 at 5:49 AM Dmitry Kadashev [off-list ref] wrote:
Pass in the struct filename pointers instead of the user string, for uniformity with do_renameat2, do_unlinkat, do_mknodat, etc.
This is the only one in the series that I still react fairly negatively at.
I still just don't like how filename_lookup() used to be nice and easy
to understand ("always eat the name"), and while those semantics
remain, the new __filename_lookup() has those odd semantics of only
eating it on failure.
And there is exactly _one_ caller of that new __filename_lookup(), and it does
error = __filename_lookup(olddfd, old, how, &old_path, NULL);
if (error)
goto out_putnew;
and I don't even understand why you'd want to eat it on error, because
if if *didn't* eat it on error, it would just do
error = __filename_lookup(olddfd, old, how, &old_path, NULL);
if (error)
goto out_putnames;
and it would be much easier to understand (and the "out_putnew" label
would go away entirely)
What am I missing? You had some reason for not eating the name
unconditionally, but I look at this patch and I just don't see it.
Linus