Btrfs: fix missing error handler if submiting re-read bio fails
authorMiao Xie <miaox@cn.fujitsu.com>
Fri, 12 Sep 2014 10:43:57 +0000 (18:43 +0800)
committerChris Mason <clm@fb.com>
Wed, 17 Sep 2014 20:38:54 +0000 (13:38 -0700)
We forgot to free failure record and bio after submitting re-read bio failed,
fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/extent_io.c

index ad04f85ac45d17257b2accb1de44369947992c06..dc501a9ca2276dbf694b7dad658f6b63d3309d5f 100644 (file)
@@ -2348,6 +2348,11 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
        ret = tree->ops->submit_bio_hook(inode, read_mode, bio,
                                         failrec->this_mirror,
                                         failrec->bio_flags, 0);
+       if (ret) {
+               free_io_failure(inode, failrec, 0);
+               bio_put(bio);
+       }
+
        return ret;
 }