mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
ntfs3: handle set_blocksize failures
ntfs3 uses buffer_heads, which don't handle block size > PAGE_SIZE well.
Without this, mounting we will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20260511071701.2456211-10-hch@lst.de
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
38a03dc2bc
commit
24f7d1824b
@@ -1174,7 +1174,10 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,
|
||||
rec->total = cpu_to_le32(sbi->record_size);
|
||||
((struct ATTRIB *)Add2Ptr(rec, ao))->type = ATTR_END;
|
||||
|
||||
sb_set_blocksize(sb, min_t(u32, sbi->cluster_size, PAGE_SIZE));
|
||||
if (!sb_set_blocksize(sb, min_t(u32, sbi->cluster_size, PAGE_SIZE))) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
sbi->block_mask = sb->s_blocksize - 1;
|
||||
sbi->blocks_per_cluster = sbi->cluster_size >> sb->s_blocksize_bits;
|
||||
@@ -1225,7 +1228,8 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,
|
||||
/*
|
||||
* Try alternative boot (last sector)
|
||||
*/
|
||||
sb_set_blocksize(sb, block_size);
|
||||
if (!sb_set_blocksize(sb, block_size))
|
||||
return -EINVAL;
|
||||
hint = "Alternative boot";
|
||||
dev_size = dev_size0; /* restore original size. */
|
||||
goto read_boot;
|
||||
|
||||
Reference in New Issue
Block a user