From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <wqu@suse.com>,
linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz
Subject: Re: [PATCH v2 6/6] btrfs: implement remove_bdev super operation callback
Date: Tue, 1 Jul 2025 16:21:06 +0800 [thread overview]
Message-ID: <d0d7243d-4254-41a3-85c6-887f9fb0db36@oracle.com> (raw)
In-Reply-To: <5c1f7441e3e2985143eb42e980cdcf081fdef61e.1751347436.git.wqu@suse.com>
> +#ifdef CONFIG_BTRFS_EXPERIMENTAL
> +static void btrfs_remove_bdev(struct super_block *sb, struct block_device *bdev)
> +{
> + struct btrfs_fs_info *fs_info = btrfs_sb(sb);
> + struct btrfs_device *device;
> + struct btrfs_dev_lookup_args lookup_args = { .devt = bdev->bd_dev };
> + bool can_rw;
> +
> + mutex_lock(&fs_info->fs_devices->device_list_mutex);
> + device = btrfs_find_device(fs_info->fs_devices, &lookup_args);
> + if (!device) {
> + btrfs_warn(fs_info, "unable to find btrfs device for block device '%pg'",
> + bdev);
> + mutex_unlock(&fs_info->fs_devices->device_list_mutex);
> + return;
> + }
> + set_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state);
> + device->fs_devices->missing_devices++;
Where do we ensure that the block device wasn't already marked as
missing? If there's no such check, could missing_devices end up
exceeding total_devices?
Thanks, Anand
next prev parent reply other threads:[~2025-07-01 8:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 5:32 [PATCH v2 0/6] btrfs: add remove_bdev() callback Qu Wenruo
2025-07-01 5:32 ` [PATCH v2 1/6] fs: enhance and rename shutdown() callback to remove_bdev() Qu Wenruo
2025-07-01 5:54 ` Darrick J. Wong
2025-07-01 6:14 ` Christoph Hellwig
2025-07-01 6:35 ` Qu Wenruo
2025-07-01 6:40 ` Christoph Hellwig
2025-07-01 8:41 ` Christian Brauner
2025-07-01 8:46 ` Qu Wenruo
2025-07-01 7:52 ` Jan Kara
2025-07-01 5:32 ` [PATCH v2 2/6] btrfs: introduce a new fs state, EMERGENCY_SHUTDOWN Qu Wenruo
2025-07-01 5:32 ` [PATCH v2 3/6] btrfs: reject file operations if in shutdown state Qu Wenruo
2025-07-01 5:32 ` [PATCH v2 4/6] btrfs: reject delalloc ranges " Qu Wenruo
2025-07-01 5:32 ` [PATCH v2 5/6] btrfs: implement shutdown ioctl Qu Wenruo
2025-07-02 9:38 ` kernel test robot
2025-07-01 5:32 ` [PATCH v2 6/6] btrfs: implement remove_bdev super operation callback Qu Wenruo
2025-07-01 8:21 ` Anand Jain [this message]
2025-07-01 8:30 ` Qu Wenruo
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=d0d7243d-4254-41a3-85c6-887f9fb0db36@oracle.com \
--to=anand.jain@oracle.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=wqu@suse.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 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).