Re: [PATCH] btrfs: Fix to use original error code of btrfs_read_fs_root_no_name()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 21, 2018 at 01:57:27PM +0900, Misono Tomohiro wrote:
> 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.
> 
> Signed-off-by: Tomohiro Misono <misono.tomohiro@xxxxxxxxxxxxxx>
> ---
>  fs/btrfs/ioctl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 8f7c1b9a2db7..0f90e68ca512 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);
>  		}
>  	}
>  
> @@ -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

Reviewed-by: David Sterba <dsterba@xxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux