From: Al Viro <viro@zeniv.linux.org.uk>
To: Jeff Layton <jlayton@kernel.org>
Cc: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
Christian Brauner <brauner@kernel.org>,
ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH RFC] ntfs3: remove atomic_open
Date: Fri, 22 Mar 2024 02:35:15 +0000 [thread overview]
Message-ID: <20240322023515.GK538574@ZenIV> (raw)
In-Reply-To: <20240318-ntfs3-atomic-open-v1-1-57afed48fe86@kernel.org>
On Mon, Mar 18, 2024 at 02:28:50PM -0400, Jeff Layton wrote:
> atomic_open is an optional VFS operation, and is primarily for network
> filesystems. NFS (for instance) can just send an open call for the last
> path component rather than doing a lookup and then having to follow that
> up with an open when it doesn't have a dentry in cache.
>
> ntfs3 is a local filesystem however, and its atomic_open just does a
> typical lookup + open, but in a convoluted way. atomic_open will also
> make directory leases more difficult to implement on the filesystem.
FWIW, I'm not sure they are actually doing it correctly, but in any
case - there's no reason whatsoever for implementing that sucker on
a local filesystem. Kill it.
> - inode = ntfs_create_inode(file_mnt_idmap(file), dir, dentry, uni,
> - mode, 0, NULL, 0, fnd);
> - err = IS_ERR(inode) ? PTR_ERR(inode) :
> - finish_open(file, dentry, ntfs_file_open);
... incidentally, this ntfs_create_inode() thing should not have the
calling conventions it has.
It does create inode, all right - and attaches it to dentry. Then it
proceeds to return the pointer to that new inode, with dentry->d_inode
being the only thing that keeps it alive. That would be defendable
(we are holding a reference to dentry and nobody else could turn
it negative under us), but... look at the callers.
4 out of 5 are of the same form:
inode = ntfs_create_inode(....);
return IS_ERR(inode) ? PTR_ERR(inode) : 0;
The fifth one is the crap above and there we *also* never look at the
return value downstream of that IS_ERR(inode) ? PTR_ERR(inode) : ...;
Which is to say, all callers of that thing don't give a damn about
the pointer per se - they only want to know if it's ERR_PTR(-E...)
or not and if it is, what error had been wrapped into that ERR_PTR().
Simply make it return 0 or -E... - if some future caller really
wants a reference to struct inode that had been created, they can
bloody well pick it from dentry->d_inode.
In any case, this caller should simply die - ->atomic_open() instance
does not buy *anything* here.
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
prev parent reply other threads:[~2024-03-22 2:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 18:28 [PATCH RFC] ntfs3: remove atomic_open Jeff Layton
2024-03-19 15:29 ` Christian Brauner
2024-03-22 2:35 ` Al Viro [this message]
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=20240322023515.GK538574@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=brauner@kernel.org \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.