]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bcachefs: allow passing full device path for target options
authorThomas Bertschinger <tahbertschinger@gmail.com>
Sat, 25 May 2024 19:36:19 +0000 (13:36 -0600)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 14 Jul 2024 23:00:12 +0000 (19:00 -0400)
The output of mount options such as "metadata_target" in `/proc/mounts`
uses the full path to the device.

mount(8) from util-linux uses the output from `/proc/mounts` to pass
existing mount options when performing a remount, so bcachefs should
accept as input the same form that it prints as output.

Without this change:

$ mount -t bcachefs -o metadata_target=vdb /dev/vdb /mnt
$ strace mount -o remount /mnt
...
fsconfig(4, FSCONFIG_SET_STRING, "metadata_target", "/dev/vdb", 0) = -1 EINVAL (Invalid argument)
...

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/super.c

index da735608d47c83cd504a9906c08ac97241877672..bbc9e5a926bb22bb790e679727d426f3587ebbe6 100644 (file)
@@ -2041,6 +2041,9 @@ err:
 /* return with ref on ca->ref: */
 struct bch_dev *bch2_dev_lookup(struct bch_fs *c, const char *name)
 {
+       if (!strncmp(name, "/dev/", strlen("/dev/")))
+               name += strlen("/dev/");
+
        for_each_member_device(c, ca)
                if (!strcmp(name, ca->name))
                        return ca;