Skip to content

Commit

Permalink
Btrfs: fix hang when failing to submit bio of directIO
Browse files Browse the repository at this point in the history
The hang is uncoverd by generic/019.

btrfs_endio_direct_write() skips the "finish_ordered_fn" part when it hits
an error, thus those added ordered extents will never get processed, which
block processes that waiting for them via btrfs_start_ordered_extent().

This fixes the above, and meanwhile finish_ordered_fn will do the space
accounting work.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Tested-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
  • Loading branch information
Liu Bo authored and Chris Mason committed Jul 2, 2015
1 parent 9c6429d commit ad9ee20
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -7872,8 +7872,6 @@ static void btrfs_endio_direct_write(struct bio *bio, int err)
struct bio *dio_bio;
int ret;

if (err)
goto out_done;
again:
ret = btrfs_dec_test_first_ordered_pending(inode, &ordered,
&ordered_offset,
Expand All @@ -7896,7 +7894,6 @@ static void btrfs_endio_direct_write(struct bio *bio, int err)
ordered = NULL;
goto again;
}
out_done:
dio_bio = dip->dio_bio;

kfree(dip);
Expand Down

0 comments on commit ad9ee20

Please sign in to comment.