提交 70f16cef 编写于 作者: F Fabian Frederick 提交者: Jan Kara

udf: allow implicit blocksize specification during mount

udf_fill_super() used udf_parse_options() to flag UDF_FLAG_BLOCKSIZE_SET
when blocksize was specified otherwise used 512 bytes
(bdev_logical_block_size) and 2048 bytes (UDF_DEFAULT_BLOCKSIZE)
IOW both 1024 and 4096 specifications were required or resulted in

"mount: wrong fs type, bad option, bad superblock on /dev/loop1"

This patch loops through different block values but also updates
udf_load_vrs() to return -EINVAL instead of 0 when udf_check_vsd()
fails (and uopt->novrs = 0).
The later being the reason for the RFC; we have that case when mounting
a 4kb blocksize against other values but maybe VRS is not mandatory
there ?

Tested with 512, 1024, 2048 and 4096 blocksize
Reported-by: NJan Kara <jack@suse.com>
Signed-off-by: NFabian Frederick <fabf@skynet.be>
Signed-off-by: NJan Kara <jack@suse.cz>
上级 1d82a56b
...@@ -1955,7 +1955,7 @@ static int udf_load_vrs(struct super_block *sb, struct udf_options *uopt, ...@@ -1955,7 +1955,7 @@ static int udf_load_vrs(struct super_block *sb, struct udf_options *uopt,
if (!nsr_off) { if (!nsr_off) {
if (!silent) if (!silent)
udf_warn(sb, "No VRS found\n"); udf_warn(sb, "No VRS found\n");
return 0; return -EINVAL;
} }
if (nsr_off == -1) if (nsr_off == -1)
udf_debug("Failed to read sector at offset %d. " udf_debug("Failed to read sector at offset %d. "
...@@ -2159,15 +2159,25 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -2159,15 +2159,25 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
ret = udf_load_vrs(sb, &uopt, silent, &fileset); ret = udf_load_vrs(sb, &uopt, silent, &fileset);
} else { } else {
uopt.blocksize = bdev_logical_block_size(sb->s_bdev); uopt.blocksize = bdev_logical_block_size(sb->s_bdev);
while (uopt.blocksize <= 4096) {
ret = udf_load_vrs(sb, &uopt, silent, &fileset); ret = udf_load_vrs(sb, &uopt, silent, &fileset);
if (ret == -EAGAIN && uopt.blocksize != UDF_DEFAULT_BLOCKSIZE) { if (ret < 0) {
if (!silent) if (!silent && ret != -EACCES) {
pr_notice("Rescanning with blocksize %d\n", pr_notice("Scanning with blocksize %d failed\n",
UDF_DEFAULT_BLOCKSIZE); uopt.blocksize);
}
brelse(sbi->s_lvid_bh); brelse(sbi->s_lvid_bh);
sbi->s_lvid_bh = NULL; sbi->s_lvid_bh = NULL;
uopt.blocksize = UDF_DEFAULT_BLOCKSIZE; /*
ret = udf_load_vrs(sb, &uopt, silent, &fileset); * EACCES is special - we want to propagate to
* upper layers that we cannot handle RW mount.
*/
if (ret == -EACCES)
break;
} else
break;
uopt.blocksize <<= 1;
} }
} }
if (ret < 0) { if (ret < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册