Re: [PATCH 04/10] btrfs-progs: return -EIO properly in restore_metadump()

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

 



On Mon, Oct 19, 2015 at 07:37:54PM +0800, Eryu Guan wrote:
> Error number -EIO is assigned to ret but later ret is overwritten by
> wait_for_worker().
> 
> Signed-off-by: Eryu Guan <guaneryu@xxxxxxxxx>
> ---
>  btrfs-image.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/btrfs-image.c b/btrfs-image.c
> index 82eed05..7d3a2f8 100644
> --- a/btrfs-image.c
> +++ b/btrfs-image.c
> @@ -2465,6 +2465,7 @@ static int restore_metadump(const char *input, FILE *out, int old_restore,
>  	u64 bytenr = 0;
>  	FILE *in = NULL;
>  	int ret = 0;
> +	int err = 0;
>  
>  	if (!strcmp(input, "-")) {
>  		in = stdin;
> @@ -2526,7 +2527,7 @@ static int restore_metadump(const char *input, FILE *out, int old_restore,
>  		if (le64_to_cpu(header->magic) != HEADER_MAGIC ||
>  		    le64_to_cpu(header->bytenr) != bytenr) {
>  			fprintf(stderr, "bad header in metadump image\n");
> -			ret = -EIO;
> +			err = -EIO;

Shouldn't we do 'goto out' instead? As this looks likes the metadump is
broken anyway so there's no point in continuing.
--
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