Skip to content

Commit dad845f

Browse files
fdmananamorbidrsa
authored andcommitted
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>
1 parent 00608e3 commit dad845f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

fs/btrfs/ioctl.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2829,9 +2829,13 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
28292829
if (IS_ERR_OR_NULL(di)) {
28302830
btrfs_release_path(path);
28312831
btrfs_end_transaction(trans);
2832+
if (di)
2833+
ret = PTR_ERR(di);
2834+
else
2835+
ret = -ENOENT;
28322836
btrfs_err(fs_info,
2833-
"Umm, you don't have the default diritem, this isn't going to work");
2834-
ret = -ENOENT;
2837+
"could not find default diritem for dir %llu: %d",
2838+
dir_id, ret);
28352839
goto out_free;
28362840
}
28372841

0 commit comments

Comments
 (0)