btrfs: Fix to use original error code of btrfs_read_fs_root_no_name()
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 btrfs: Fix to use original error code of btrfs_read_fs_root_no_name()
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() does.
--- fs/btrfs/ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/ioctl.c +2 -2
@@ -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); } }
@@ -2290,7 +2290,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, 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; }
Signature · 1 line
2.14.3
Quoted 6 lines · Misono Tomohiro
btrfs_read_fs_root_no_name()may returnERR_PTR(-ENOENT)orERR_PTR(-ENOMEM)and thereforesearch_ioctl()andbtrfs_search_path_in_tree()should usePTR_ERR()instead of-ENOENT, which all other callers ofbtrfs_read_fs_root_no_name()does.Signed-off-by Tomohiro Misono <[email protected]>
Thanks,
Qu
Quoted 27 lines
--- fs/btrfs/ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/btrfs/ioctl.c +2
-2@@ -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); } }@@ -2290,7 +2290,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, 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; }
Quoted 24 lines · Misono Tomohiro
btrfs_read_fs_root_no_name()may returnERR_PTR(-ENOENT)orERR_PTR(-ENOMEM)and thereforesearch_ioctl()andbtrfs_search_path_in_tree()should usePTR_ERR()instead of-ENOENT, which all other callers ofbtrfs_read_fs_root_no_name()does.Signed-off-by Tomohiro Misono <[email protected]>--- fs/btrfs/ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/btrfs/ioctl.c +1
-1@@ -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); } }
fs/btrfs/ioctl.c static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, · line 2292
Quoted 3 lines
fs/btrfs/ioctl.c +0
-0@@ -2290,7 +2290,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, root =btrfs_read_fs_root_no_name (info, &key);if (IS_ERR (root)) {btrfs_err (info,"could not find root %llu" , tree_id);
We should probably drop this message too, as there are now 2 errors and "not found" after ENOMEM does not make sense.
Otherwise ok