scoutfs: don't unlock err bh after validation

If block validation failed then we'd end up trying to unlock an IS_ERR
buffer_head pointer.  Fix it so that we drop the ref and set the
pointer after unlocking.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2016-08-26 16:51:47 -07:00
parent cb318982c9
commit df93073971

View File

@@ -194,14 +194,16 @@ struct buffer_head *scoutfs_block_read(struct super_block *sb, u64 blkno)
lock_buffer(bh);
if (!buffer_scoutfs_verified(bh)) {
ret = verify_block_header(sbi, bh);
if (ret < 0) {
scoutfs_block_put(bh);
bh = ERR_PTR(ret);
} else {
if (!ret)
set_buffer_scoutfs_verified(bh);
}
} else {
ret = 0;
}
unlock_buffer(bh);
if (ret < 0) {
scoutfs_block_put(bh);
bh = ERR_PTR(ret);
}
}
out: