Re: [PATCH 01/15] btrfs: fix error handling when submitting direct I/O bio

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

 




On 9.03.20 г. 23:32 ч., Omar Sandoval wrote:
> From: Omar Sandoval <osandov@xxxxxx>
> 
> If we submit orig_bio in btrfs_submit_direct_hook(), we never increment
> pending_bios. Then, if btrfs_submit_dio_bio() fails, we decrement
> pending_bios to -1, and we never complete orig_bio. Fix it by
> initializing pending_bios to 1 instead of incrementing later.

nit: I'd rephrase this paragraph to put the emphasis on when this could
happen, which is when the write falls entirely within a chunk's stripe
(i.e doesn't span 64k region in case of having a block group with a
profile different than SINGLE) or doesn't span a chunk in case of a
profile different than SINGLE.

> 
> Fixing this exposes another bug: we put orig_bio prematurely and then
> put it again from end_io. Fix it by not putting orig_bio.
> 
> After this change, pending_bios is really more of a reference count, but
> I'll leave that cleanup separate to keep the fix small.
> 
> Fixes: e65e15355429 ("btrfs: fix panic caused by direct IO")
> Signed-off-by: Omar Sandoval <osandov@xxxxxx>

The changes look good, I just wonder why didn't this trip earlier...

Reviewed-by: Nikolay Borisov <nborisov@xxxxxxxx>



[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