From: Al Viro <viro@zeniv.linux.org.uk>
To: Zhao Gongyi <zhaogongyi@bytedance.com>
Cc: brauner@kernel.org, jack@suse.cz, jlayton@kernel.org,
cel@kernel.org, neil@brown.name, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] vfs: keep the mount pinned while waiting for a parent delegation break
Date: Fri, 16 Oct 2026 19:38:45 +0100 [thread overview]
Message-ID: <20261016183845.GH989762@ZenIV> (raw)
In-Reply-To: <20261016182927.GG989762@ZenIV>
On Fri, Oct 16, 2026 at 07:29:27PM +0100, Al Viro wrote:
> On Fri, Oct 16, 2026 at 05:34:21PM +0800, Zhao Gongyi wrote:
> > filename_mknodat(), filename_mkdirat(), filename_symlinkat() and
> > filename_rmdir() can call break_deleg_wait() on a delegated parent
> > directory after dropping the struct path that pins the mount.
> > try_break_deleg() only takes an inode reference, and an inode reference
> > does not keep the superblock active.
>
> So why not have it acquire an active superblock reference at the
> same time? We don't need struct mount reference there - all it
> takes in increment of inode->i_sb->s_active on try_break_deleg()
> side and deactivate_super() on ->i_sb fetched *before* iput()
> of ->di_inode on the break_deleg_wait() side...
>
> No need to mess with every user of that thing...
I mean, something like
static inline int try_break_deleg(struct inode *inode, unsigned int flags,
struct delegated_inode *di)
{
int ret;
ret = break_deleg(inode, flags | LEASE_BREAK_NONBLOCK);
if (ret == -EWOULDBLOCK && di) {
di->di_inode = inode;
ihold(inode);
// make sure that extra reference we've just
// grabbed wont outlive the superblock
atomic_inc(inode->i_sb->s_active);
}
return ret;
}
static inline int break_deleg_wait(struct delegated_inode *di)
{
struct inode *inode = di->di_inode;
struct super_block *sb = inode->i_sb;
int ret = break_deleg(inode, 0);
iput(inode);
deactivate_super(sb);
di->di_inode = NULL;
return ret;
}
prev parent reply other threads:[~2026-10-16 18:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 9:34 [PATCH] vfs: keep the mount pinned while waiting for a parent delegation break Zhao Gongyi
2026-10-16 18:29 ` Al Viro
2026-10-16 18:38 ` 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=20261016183845.GH989762@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=brauner@kernel.org \
--cc=cel@kernel.org \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil@brown.name \
--cc=stable@vger.kernel.org \
--cc=zhaogongyi@bytedance.com \
/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.