From: Misono Tomohiro Date: Mon, 21 May 2018 04:57:27 +0000 (+0900) Subject: btrfs: use error code returned by btrfs_read_fs_root_no_name in search ioctl X-Git-Tag: Ubuntu-5.13.0-19.19~10929^2~37 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=ad1e3d5672ddce03eaa811c3f8d728acefac9a19;p=mirror_ubuntu-jammy-kernel.git btrfs: use error code returned by btrfs_read_fs_root_no_name in search ioctl btrfs_read_fs_root_no_name() may return ERR_PTR(-ENOENT) or ERR_PTR(-ENOMEM) and therefore search_ioctl() and btrfs_search_path_in_tree() should use PTR_ERR() instead of -ENOENT, which all other callers of btrfs_read_fs_root_no_name() do. Drop the error message as it would be confusing, the caller of ioctl will likely interpret the error code and not look into the syslog. Signed-off-by: Tomohiro Misono Reviewed-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index aeef6cd8aaeb..743c4f1b8001 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2155,7 +2155,7 @@ static noinline int search_ioctl(struct inode *inode, root = btrfs_read_fs_root_no_name(info, &key); if (IS_ERR(root)) { btrfs_free_path(path); - return -ENOENT; + return PTR_ERR(root); } } @@ -2289,8 +2289,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, key.offset = (u64)-1; root = btrfs_read_fs_root_no_name(info, &key); if (IS_ERR(root)) { - btrfs_err(info, "could not find root %llu", tree_id); - ret = -ENOENT; + ret = PTR_ERR(root); goto out; }