diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2014-06-17 06:58:59 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-08-19 11:36:24 -0400 |
commit | 7a5c3c9be1059feed0e470c6dc0994dcaed4f12c (patch) | |
tree | 4db44a245a5dfdd21c84d31f7b8dfaace72ef34e /fs/btrfs | |
parent | 8d875f95da43c6a8f18f77869f2ef26e9594fecc (diff) |
Btrfs: fix put dio bio twice when we submit dio bio fail
The caller of btrfs_submit_direct_hook() will put the original dio bio
when btrfs_submit_direct_hook() return a error number, so we needn't
put the original bio in btrfs_submit_direct_hook().
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 73098328d040..33c05188cbf0 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -7306,10 +7306,8 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | |||
7306 | map_length = orig_bio->bi_iter.bi_size; | 7306 | map_length = orig_bio->bi_iter.bi_size; |
7307 | ret = btrfs_map_block(root->fs_info, rw, start_sector << 9, | 7307 | ret = btrfs_map_block(root->fs_info, rw, start_sector << 9, |
7308 | &map_length, NULL, 0); | 7308 | &map_length, NULL, 0); |
7309 | if (ret) { | 7309 | if (ret) |
7310 | bio_put(orig_bio); | ||
7311 | return -EIO; | 7310 | return -EIO; |
7312 | } | ||
7313 | 7311 | ||
7314 | if (map_length >= orig_bio->bi_iter.bi_size) { | 7312 | if (map_length >= orig_bio->bi_iter.bi_size) { |
7315 | bio = orig_bio; | 7313 | bio = orig_bio; |
@@ -7326,6 +7324,7 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | |||
7326 | bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); | 7324 | bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); |
7327 | if (!bio) | 7325 | if (!bio) |
7328 | return -ENOMEM; | 7326 | return -ENOMEM; |
7327 | |||
7329 | bio->bi_private = dip; | 7328 | bio->bi_private = dip; |
7330 | bio->bi_end_io = btrfs_end_dio_bio; | 7329 | bio->bi_end_io = btrfs_end_dio_bio; |
7331 | atomic_inc(&dip->pending_bios); | 7330 | atomic_inc(&dip->pending_bios); |