mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-08 09:07:30 +00:00
scoutfs: warn if we try IO outside the device
We've had bugs in allocators that return success and crazy block numbers. The bad block numbers eventually make their way down to the context-free kernel warning that IO was attempted outside the device. This at least gives us a stack trace to help find where it's coming from. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -69,6 +69,7 @@ void scoutfs_bio_submit(struct super_block *sb, int rw, struct page **pages,
|
||||
{
|
||||
unsigned int nr_pages = DIV_ROUND_UP(nr_blocks,
|
||||
SCOUTFS_BLOCKS_PER_PAGE);
|
||||
struct scoutfs_super_block *super = &SCOUTFS_SB(sb)->super;
|
||||
struct bio_end_io_args *args;
|
||||
struct blk_plug plug;
|
||||
unsigned int bytes;
|
||||
@@ -77,6 +78,12 @@ void scoutfs_bio_submit(struct super_block *sb, int rw, struct page **pages,
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
if (super->total_blocks &&
|
||||
WARN_ON_ONCE(blkno >= le64_to_cpu(super->total_blocks))) {
|
||||
end_io(sb, data, -EIO);
|
||||
return;
|
||||
}
|
||||
|
||||
args = kmalloc(sizeof(struct bio_end_io_args), GFP_NOFS);
|
||||
if (!args) {
|
||||
end_io(sb, data, -ENOMEM);
|
||||
|
||||
Reference in New Issue
Block a user