Re: [patch] direct-io: bug fix in dio handling write error

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

 



On Tue, 2006-03-21 at 00:51 -0800, Chen, Kenneth W wrote:
....
> 
> Andrew - please merge this version.  Thank you.
> 
> 
> --- ./fs/direct-io.c.orig	2006-01-02 19:21:10.000000000 -0800
> +++ ./fs/direct-io.c	2006-03-21 01:28:48.704475280 -0800
> @@ -129,6 +129,7 @@ struct dio {
>  	/* AIO related stuff */
>  	struct kiocb *iocb;		/* kiocb */
>  	int is_async;			/* is IO async ? */
> +	int io_error;			/* IO error in completion path */
>  	ssize_t result;                 /* IO result */
>  };
>  
> @@ -250,6 +251,10 @@ static void finished_one_bio(struct dio 
>  			    ((offset + transferred) > dio->i_size))
>  				transferred = dio->i_size - offset;
>  
> +			/* check for error in completion path */
> +			if (dio->io_error)
> +				transferred = dio->io_error;
> +
>  			dio_complete(dio, offset, transferred);
>  
>  			/* Complete AIO later if falling back to buffered i/o */
> @@ -406,7 +411,7 @@ static int dio_bio_complete(struct dio *
>  	int page_no;
>  
>  	if (!uptodate)
> -		dio->result = -EIO;
> +		dio->io_error = -EIO;
>  
>  	if (dio->is_async && dio->rw == READ) {
>  		bio_check_pages_dirty(bio);	/* transfers ownership */
> @@ -964,6 +969,7 @@ direct_io_worker(int rw, struct kiocb *i
>  	dio->next_block_for_io = -1;
>  
>  	dio->page_errors = 0;
> +	dio->io_error = 0;
>  	dio->result = 0;
>  	dio->iocb = iocb;
>  	dio->i_size = i_size_read(inode);
> 

Ken,

I hate to do this you - but your patch breaks error handling on
synchronous DIO requests.

Since you are using "dio->io_error" instead of "dio->result" to
represent an error - you need to make sure to check that (also ?)
instead of dio->result in direct_io_worker() before calling 
dio_complete().

Isn't it ? Am I missing something ?

Thanks,
Badari

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux