mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-07 12:35:28 +00:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user