linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Daniil Lunev <dlunev@chromium.org>
Cc: linux-fsdevel@vger.kernel.org, miklos@szeredi.hu,
	viro@zeniv.linux.org.uk, hch@infradead.org, tytso@mit.edu,
	fuse-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] fs/super: function to prevent super re-use
Date: Tue, 31 May 2022 00:24:39 -0700	[thread overview]
Message-ID: <YpXCt14eL2edq6IB@infradead.org> (raw)
In-Reply-To: <20220530113953.v3.1.I0e579520b03aa244906b8fe2ef1ec63f2ab7eecf@changeid>

On Mon, May 30, 2022 at 11:39:57AM +1000, Daniil Lunev wrote:
> +void retire_super(struct super_block *sb)
> +{
> +	down_write(&sb->s_umount);
> +	if (sb->s_bdi != &noop_backing_dev_info) {
> +		if (sb->s_iflags & SB_I_PERSB_BDI && !(sb->s_iflags & SB_I_RETIRED))

SB_I_PERSB_BDI can't be set for noop_backing_dev_info, so that check
should not be needed.  Which also conveniently fixes the overly long
line.

Also this should clear SB_I_PERSB_BDI as the only place that checks
it is the unregistration.

>  	spin_lock(&sb_lock);
> -	/* should be initialized for __put_super_and_need_restart() */

This is a completely unrelated change.  While the function is gone
it might be worth to check what it got renamed to or folded in, or
if the initialization is still needed.  But all that is for a separate
patch.

>  	up_write(&sb->s_umount);
>  	if (sb->s_bdi != &noop_backing_dev_info) {
> -		if (sb->s_iflags & SB_I_PERSB_BDI)
> +		/* retire should have already unregistered bdi */
> +		if (sb->s_iflags & SB_I_PERSB_BDI && !(sb->s_iflags & SB_I_RETIRED))
>  			bdi_unregister(sb->s_bdi);
>  		bdi_put(sb->s_bdi);

And once SB_I_PERSB_BDI is dropped when retiring we don't need this
change.

  reply	other threads:[~2022-05-31  7:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-30  1:39 [PATCH v3 0/2] Prevent re-use of FUSE superblock after force unmount Daniil Lunev
2022-05-30  1:39 ` [PATCH v3 1/2] fs/super: function to prevent super re-use Daniil Lunev
2022-05-31  7:24   ` Christoph Hellwig [this message]
2022-06-01  1:11     ` Daniil Lunev
2022-05-30  1:39 ` [PATCH v3 2/2] FUSE: Retire superblock on force unmount Daniil Lunev

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=YpXCt14eL2edq6IB@infradead.org \
    --to=hch@infradead.org \
    --cc=dlunev@chromium.org \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=tytso@mit.edu \
    --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;
as well as URLs for NNTP newsgroup(s).