diff mbox series

[1/2] btrfs-progs: allow btrfs device scan -u on dead dev

Message ID a53859401bc98e7266808ecfa32af54d7ea43851.1709231441.git.boris@bur.io (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: forget removed devices | expand

Commit Message

Boris Burkov Feb. 29, 2024, 6:36 p.m. UTC
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 mbox series

Patch

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;