Re: [PATCH] xfs_io: report io error for pwrite -W and -w

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

 



On 10/12/17 3:49 PM, Liu Bo wrote:
> When IO error occurs, xfs_io -c "pwrite -W/w" doesn't report errors
> while xfs_io -c "pwrite" -c "fsync" does.
> 
> This changes "pwrite -W/w" to report errors when it should.
> 
> Signed-off-by: Liu Bo <bo.li.liu@xxxxxxxxxx>

<after looking at djwong & bfoster's comments>

Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>

> ---
>  io/pwrite.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/io/pwrite.c b/io/pwrite.c
> index 1c5dfca..71bcccc 100644
> --- a/io/pwrite.c
> +++ b/io/pwrite.c
> @@ -379,11 +379,18 @@ pwrite_f(
>  	}
>  	if (c < 0)
>  		goto done;
> -	if (Wflag)
> -		fsync(file->fd);
> -	if (wflag)
> -		fdatasync(file->fd);
> +	if (Wflag) {
> +		if (fsync(file->fd) < 0) {
> +			perror("fsync");
> +			goto done;
> +		}
> +	}
> +	if (wflag) {
> +		if (fdatasync(file->fd) < 0) {
> +			perror("fdatasync");
> +			goto done;
> +		}
> +	}
>  	if (qflag)
>  		goto done;
>  	gettimeofday(&t2, NULL);
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux