All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 1/2] btrfs-progs: allow btrfs device scan -u on dead dev
Date: Thu, 29 Feb 2024 10:36:54 -0800	[thread overview]
Message-ID: <a53859401bc98e7266808ecfa32af54d7ea43851.1709231441.git.boris@bur.io> (raw)
In-Reply-To: <cover.1709231441.git.boris@bur.io>

If a device has been removed from the system, it lingers on in the btrfs
stale device cache. It is useful to be able to forget it, so allow that
by not checking for the file being a proper device file for the forget
path. Kernels that don't handle dead devices by name will do a devt
lookup which will fail, if there is no device, so this isn't a strictly
necessary check, so this isn't a strictly necessary check, so this isn't
a strictly necessary check.

Signed-off-by: Boris Burkov <boris@bur.io>
---
 cmds/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmds/device.c b/cmds/device.c
index 4b34300b5..d52bde2e3 100644
--- a/cmds/device.c
+++ b/cmds/device.c
@@ -487,7 +487,7 @@ static int cmd_device_scan(const struct cmd_struct *cmd, int argc, char **argv)
 	for( i = devstart ; i < argc ; i++ ){
 		char *path;
 
-		if (path_is_block_device(argv[i]) != 1) {
+		if (!forget && path_is_block_device(argv[i]) != 1) {
 			error("not a block device: %s", argv[i]);
 			ret = 1;
 			goto out;
-- 
2.43.0


  reply	other threads:[~2024-02-29 18:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 18:36 [PATCH 0/2] btrfs-progs: forget removed devices Boris Burkov
2024-02-29 18:36 ` Boris Burkov [this message]
2024-02-29 18:36 ` [PATCH 2/2] btrfs-progs: add udev rule to forget removed device Boris Burkov
2024-02-29 19:53   ` David Sterba
2024-02-29 20:34     ` Boris Burkov
2024-03-01  2:31 ` [PATCH 0/2] btrfs-progs: forget removed devices Anand Jain
2024-03-01 11:54   ` David Sterba
2024-03-01 15:44     ` Boris Burkov
2024-03-04 18:07       ` David Sterba
2024-03-04 21:27         ` Boris Burkov

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=a53859401bc98e7266808ecfa32af54d7ea43851.1709231441.git.boris@bur.io \
    --to=boris@bur.io \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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.