mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: viro@zeniv.linux.org.uk, jack@suse.cz,
	linux-kernel@vger.kernel.org,  linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: use debug-only asserts around fd allocation and install
Date: Thu, 13 Mar 2025 09:55:17 +0100	[thread overview]
Message-ID: <20250313-rufnummer-fehlen-1184066edf75@brauner> (raw)
In-Reply-To: <CAGudoHFH70YpLYXnhJq4MDtjJ6FiY59Xn-D_kTB9xsE2UTJD_g@mail.gmail.com>

On Wed, Mar 12, 2025 at 06:21:01PM +0100, Mateusz Guzik wrote:
> On Wed, Mar 12, 2025 at 5:19 PM Mateusz Guzik <mjguzik@gmail.com> wrote:
> >
> > This also restores the check which got removed in 52732bb9abc9ee5b
> > ("fs/file.c: remove sanity_check and add likely/unlikely in alloc_fd()")
> > for performance reasons -- they no longer apply with a debug-only
> > variant.
> >
> > Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
> > ---
> >
> > I have about 0 opinion whether this should be BUG or WARN, the code was
> > already inconsistent on this front. If you want the latter, I'll have 0
> > complaints if you just sed it and commit as yours.
> >
> > This reminded me to sort out that litmus test for smp_rmb, hopefully
> > soon(tm) as it is now nagging me.
> >
> >  fs/file.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/file.c b/fs/file.c
> > index 6c159ede55f1..09460ec74ef8 100644
> > --- a/fs/file.c
> > +++ b/fs/file.c
> > @@ -582,6 +582,7 @@ static int alloc_fd(unsigned start, unsigned end, unsigned flags)
> >
> >         __set_open_fd(fd, fdt, flags & O_CLOEXEC);
> >         error = fd;
> > +       VFS_BUG_ON(rcu_access_pointer(fdt->fd[fd]) != NULL);
> >
> 
> when restoring this check i dutifully copy-pasted the original. I only
> now mentally registered it uses a rcu primitive to do the load, while
> the others do a plain load. arguably the former is closer to being
> correct and it definitely does not hurt
> 
> so this line should replace the other 2 lines below. i can send a v2
> to that effect, but given the triviality of the edit, perhaps you will
> be happy to sort it out

Yes, sure. Done!

  reply	other threads:[~2025-03-13  8:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-12 16:19 Mateusz Guzik
2025-03-12 16:35 ` Jan Kara
2025-03-12 17:21 ` Mateusz Guzik
2025-03-13  8:55   ` Christian Brauner [this message]
2025-03-13  8:54 ` Christian Brauner

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=20250313-rufnummer-fehlen-1184066edf75@brauner \
    --to=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjguzik@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®