summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2026-06-01 12:45:14 +0300
committerJohannes Thumshirn <johannes.thumshirn@wdc.com>2026-06-09 19:22:46 +0300
commitdad845f192eb2684ec0c4cb72d184de4cef0808c (patch)
treeaf5f24e648ad21ddf941cfbc202c0acd0bf6937e
parent00608e34167faca9dabc8baabc6ea0813dd7e2ae (diff)
downloadlinux-dad845f192eb2684ec0c4cb72d184de4cef0808c.tar.xz
btrfs: return real error after lookup failure in btrfs_ioctl_default_subvol()
If we fail to lookup the dir item, we are always returning -ENOENT but that may not be the reason for the failure, as btrfs_lookup_dir_item() can return many different errors, such as -EIO or -ENOMEM for example. Fix this by returning the real error, and also fixup the silly error message, including the id of the directory and the error. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/ioctl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 561f4a90981b..9d47d16394fc 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2829,9 +2829,13 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
if (IS_ERR_OR_NULL(di)) {
btrfs_release_path(path);
btrfs_end_transaction(trans);
+ if (di)
+ ret = PTR_ERR(di);
+ else
+ ret = -ENOENT;
btrfs_err(fs_info,
- "Umm, you don't have the default diritem, this isn't going to work");
- ret = -ENOENT;
+ "could not find default diritem for dir %llu: %d",
+ dir_id, ret);
goto out_free;
}