Message ID | c34c50a035111a83b3cb5c735f9a86a7d47a66c7.1739785941.git.wqu@suse.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | btrfs: output an error message if btrfs failed to find the seed fsid | expand |
On Mon, Feb 17, 2025 at 9:52 AM Qu Wenruo <wqu@suse.com> wrote: > > [BUG] > If btrfs failed to locate the seed device for whatever reason, mounting > the sprouted device will fail without any meaning error message: > > # mkfs.btrfs -f /dev/test/scratch1 > # btrfstune -S1 /dev/test/scratch1 > # mount /dev/test/scratch1 /mnt/btrfs > # btrfs dev add -f /dev/test/scratch2 /mnt/btrfs > # umount /mnt/btrfs > # btrfs dev scan -u > # btrfs mount /dev/test/scratch2 /mnt/btrfs > mount: /mnt/btrfs: fsconfig system call failed: No such file or directory. > dmesg(1) may have more information after failed mount system call. > # dmesg | tail -n6 > [ 1626.369520] BTRFS info (device dm-5): first mount of filesystem 64252ded-5953-4868-b962-cea48f7ac4ea > [ 1626.370348] BTRFS info (device dm-5): using crc32c (crc32c-generic) checksum algorithm > [ 1626.371099] BTRFS info (device dm-5): using free-space-tree > [ 1626.373051] BTRFS error (device dm-5): failed to read chunk tree: -2 > [ 1626.373929] BTRFS error (device dm-5): open_ctree failed: -2 > > [CAUSE] > The failure to mount is pretty straight forward, just unable to find the > seed device and its fsid, caused by `btrfs dev scan -u`. > > But the lack of any useful info is a problem. > > [FIX] > Just add an extra error message in open_seed_devices() to indicate the > error. > > Now the error message would look like this: > > [ 1926.837729] BTRFS info (device dm-5): first mount of filesystem 64252ded-5953-4868-b962-cea48f7ac4ea > [ 1926.838829] BTRFS info (device dm-5): using crc32c (crc32c-generic) checksum algorithm > [ 1926.839563] BTRFS info (device dm-5): using free-space-tree > [ 1926.840797] BTRFS error (device dm-5): failed to find fsid 1980efd3-616e-4815-bd5e-aa0d7c3586e3 > [ 1926.841632] BTRFS error (device dm-5): failed to read chunk tree: -2 > [ 1926.842563] BTRFS error (device dm-5): open_ctree failed: -2 > > Link: https://github.com/kdave/btrfs-progs/issues/959 > Signed-off-by: Qu Wenruo <wqu@suse.com> > --- > fs/btrfs/volumes.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c > index 0a0776489055..7642fce50c12 100644 > --- a/fs/btrfs/volumes.c > +++ b/fs/btrfs/volumes.c > @@ -7200,8 +7200,10 @@ static struct btrfs_fs_devices *open_seed_devices(struct btrfs_fs_info *fs_info, > > fs_devices = find_fsid(fsid, NULL); > if (!fs_devices) { > - if (!btrfs_test_opt(fs_info, DEGRADED)) > + if (!btrfs_test_opt(fs_info, DEGRADED)) { > + btrfs_err(fs_info, "failed to find fsid %pU", fsid); Perhaps add here extra information to have more context like for example: "failed to find fsid %pU when attempting to open seed devices" So that it's more clear where the failure is happening. Thanks. > return ERR_PTR(-ENOENT); > + } > > fs_devices = alloc_fs_devices(fsid); > if (IS_ERR(fs_devices)) > -- > 2.48.1 > >
On 18/2/25 01:00, Filipe Manana wrote: > On Mon, Feb 17, 2025 at 9:52 AM Qu Wenruo <wqu@suse.com> wrote: >> >> [BUG] >> If btrfs failed to locate the seed device for whatever reason, mounting >> the sprouted device will fail without any meaning error message: >> >> # mkfs.btrfs -f /dev/test/scratch1 >> # btrfstune -S1 /dev/test/scratch1 >> # mount /dev/test/scratch1 /mnt/btrfs >> # btrfs dev add -f /dev/test/scratch2 /mnt/btrfs >> # umount /mnt/btrfs >> # btrfs dev scan -u >> # btrfs mount /dev/test/scratch2 /mnt/btrfs >> mount: /mnt/btrfs: fsconfig system call failed: No such file or directory. >> dmesg(1) may have more information after failed mount system call. >> # dmesg | tail -n6 >> [ 1626.369520] BTRFS info (device dm-5): first mount of filesystem 64252ded-5953-4868-b962-cea48f7ac4ea >> [ 1626.370348] BTRFS info (device dm-5): using crc32c (crc32c-generic) checksum algorithm >> [ 1626.371099] BTRFS info (device dm-5): using free-space-tree >> [ 1626.373051] BTRFS error (device dm-5): failed to read chunk tree: -2 >> [ 1626.373929] BTRFS error (device dm-5): open_ctree failed: -2 >> >> [CAUSE] >> The failure to mount is pretty straight forward, just unable to find the >> seed device and its fsid, caused by `btrfs dev scan -u`. >> >> But the lack of any useful info is a problem. >> >> [FIX] >> Just add an extra error message in open_seed_devices() to indicate the >> error. >> >> Now the error message would look like this: >> >> [ 1926.837729] BTRFS info (device dm-5): first mount of filesystem 64252ded-5953-4868-b962-cea48f7ac4ea >> [ 1926.838829] BTRFS info (device dm-5): using crc32c (crc32c-generic) checksum algorithm >> [ 1926.839563] BTRFS info (device dm-5): using free-space-tree >> [ 1926.840797] BTRFS error (device dm-5): failed to find fsid 1980efd3-616e-4815-bd5e-aa0d7c3586e3 >> [ 1926.841632] BTRFS error (device dm-5): failed to read chunk tree: -2 >> [ 1926.842563] BTRFS error (device dm-5): open_ctree failed: -2 >> >> Link: https://github.com/kdave/btrfs-progs/issues/959 >> Signed-off-by: Qu Wenruo <wqu@suse.com> >> --- >> fs/btrfs/volumes.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c >> index 0a0776489055..7642fce50c12 100644 >> --- a/fs/btrfs/volumes.c >> +++ b/fs/btrfs/volumes.c >> @@ -7200,8 +7200,10 @@ static struct btrfs_fs_devices *open_seed_devices(struct btrfs_fs_info *fs_info, >> >> fs_devices = find_fsid(fsid, NULL); >> if (!fs_devices) { >> - if (!btrfs_test_opt(fs_info, DEGRADED)) >> + if (!btrfs_test_opt(fs_info, DEGRADED)) { >> + btrfs_err(fs_info, "failed to find fsid %pU", fsid); > > Perhaps add here extra information to have more context like for example: > > "failed to find fsid %pU when attempting to open seed devices" > > So that it's more clear where the failure is happening. > Agree. With that changed. Reviewed-by: Anand Jain <anand.jain@oracle.com> Thx. > Thanks. > >> return ERR_PTR(-ENOENT); >> + } >> >> fs_devices = alloc_fs_devices(fsid); >> if (IS_ERR(fs_devices)) >> -- >> 2.48.1 >> >>
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 0a0776489055..7642fce50c12 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -7200,8 +7200,10 @@ static struct btrfs_fs_devices *open_seed_devices(struct btrfs_fs_info *fs_info, fs_devices = find_fsid(fsid, NULL); if (!fs_devices) { - if (!btrfs_test_opt(fs_info, DEGRADED)) + if (!btrfs_test_opt(fs_info, DEGRADED)) { + btrfs_err(fs_info, "failed to find fsid %pU", fsid); return ERR_PTR(-ENOENT); + } fs_devices = alloc_fs_devices(fsid); if (IS_ERR(fs_devices))
[BUG] If btrfs failed to locate the seed device for whatever reason, mounting the sprouted device will fail without any meaning error message: # mkfs.btrfs -f /dev/test/scratch1 # btrfstune -S1 /dev/test/scratch1 # mount /dev/test/scratch1 /mnt/btrfs # btrfs dev add -f /dev/test/scratch2 /mnt/btrfs # umount /mnt/btrfs # btrfs dev scan -u # btrfs mount /dev/test/scratch2 /mnt/btrfs mount: /mnt/btrfs: fsconfig system call failed: No such file or directory. dmesg(1) may have more information after failed mount system call. # dmesg | tail -n6 [ 1626.369520] BTRFS info (device dm-5): first mount of filesystem 64252ded-5953-4868-b962-cea48f7ac4ea [ 1626.370348] BTRFS info (device dm-5): using crc32c (crc32c-generic) checksum algorithm [ 1626.371099] BTRFS info (device dm-5): using free-space-tree [ 1626.373051] BTRFS error (device dm-5): failed to read chunk tree: -2 [ 1626.373929] BTRFS error (device dm-5): open_ctree failed: -2 [CAUSE] The failure to mount is pretty straight forward, just unable to find the seed device and its fsid, caused by `btrfs dev scan -u`. But the lack of any useful info is a problem. [FIX] Just add an extra error message in open_seed_devices() to indicate the error. Now the error message would look like this: [ 1926.837729] BTRFS info (device dm-5): first mount of filesystem 64252ded-5953-4868-b962-cea48f7ac4ea [ 1926.838829] BTRFS info (device dm-5): using crc32c (crc32c-generic) checksum algorithm [ 1926.839563] BTRFS info (device dm-5): using free-space-tree [ 1926.840797] BTRFS error (device dm-5): failed to find fsid 1980efd3-616e-4815-bd5e-aa0d7c3586e3 [ 1926.841632] BTRFS error (device dm-5): failed to read chunk tree: -2 [ 1926.842563] BTRFS error (device dm-5): open_ctree failed: -2 Link: https://github.com/kdave/btrfs-progs/issues/959 Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/volumes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)