Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull UDF fixes and a reiserfs fix from Jan Kara:
"A couple of udf fixes (most notably a bug in parsing UDF partitions
which led to inability to mount recent Windows installation media) and
a reiserfs fix for handling kstrdup failure"

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
reiserfs: check kstrdup failure
udf: Use correct partition reference number for metadata
udf: Use IS_ERR when loading metadata mirror file entry
udf: Don't BUG on missing metadata partition descriptor

+33 -16
+7 -2
fs/reiserfs/super.c
··· 1393 1393 unsigned long safe_mask = 0; 1394 1394 unsigned int commit_max_age = (unsigned int)-1; 1395 1395 struct reiserfs_journal *journal = SB_JOURNAL(s); 1396 - char *new_opts = kstrdup(arg, GFP_KERNEL); 1396 + char *new_opts; 1397 1397 int err; 1398 1398 char *qf_names[REISERFS_MAXQUOTAS]; 1399 1399 unsigned int qfmt = 0; 1400 1400 #ifdef CONFIG_QUOTA 1401 1401 int i; 1402 1402 #endif 1403 + 1404 + new_opts = kstrdup(arg, GFP_KERNEL); 1405 + if (arg && !new_opts) 1406 + return -ENOMEM; 1403 1407 1404 1408 sync_filesystem(s); 1405 1409 reiserfs_write_lock(s); ··· 1550 1546 } 1551 1547 1552 1548 out_ok_unlocked: 1553 - replace_mount_options(s, new_opts); 1549 + if (new_opts) 1550 + replace_mount_options(s, new_opts); 1554 1551 return 0; 1555 1552 1556 1553 out_err_unlock:
+9 -4
fs/udf/partition.c
··· 295 295 map = &UDF_SB(sb)->s_partmaps[partition]; 296 296 /* map to sparable/physical partition desc */ 297 297 phyblock = udf_get_pblock(sb, eloc.logicalBlockNum, 298 - map->s_partition_num, ext_offset + offset); 298 + map->s_type_specific.s_metadata.s_phys_partition_ref, 299 + ext_offset + offset); 299 300 } 300 301 301 302 brelse(epos.bh); ··· 318 317 mdata = &map->s_type_specific.s_metadata; 319 318 inode = mdata->s_metadata_fe ? : mdata->s_mirror_fe; 320 319 321 - /* We shouldn't mount such media... */ 322 - BUG_ON(!inode); 320 + if (!inode) 321 + return 0xFFFFFFFF; 322 + 323 323 retblk = udf_try_read_meta(inode, block, partition, offset); 324 324 if (retblk == 0xFFFFFFFF && mdata->s_metadata_fe) { 325 325 udf_warn(sb, "error reading from METADATA, trying to read from MIRROR\n"); 326 326 if (!(mdata->s_flags & MF_MIRROR_FE_LOADED)) { 327 327 mdata->s_mirror_fe = udf_find_metadata_inode_efe(sb, 328 - mdata->s_mirror_file_loc, map->s_partition_num); 328 + mdata->s_mirror_file_loc, 329 + mdata->s_phys_partition_ref); 330 + if (IS_ERR(mdata->s_mirror_fe)) 331 + mdata->s_mirror_fe = NULL; 329 332 mdata->s_flags |= MF_MIRROR_FE_LOADED; 330 333 } 331 334
+12 -10
fs/udf/super.c
··· 951 951 } 952 952 953 953 struct inode *udf_find_metadata_inode_efe(struct super_block *sb, 954 - u32 meta_file_loc, u32 partition_num) 954 + u32 meta_file_loc, u32 partition_ref) 955 955 { 956 956 struct kernel_lb_addr addr; 957 957 struct inode *metadata_fe; 958 958 959 959 addr.logicalBlockNum = meta_file_loc; 960 - addr.partitionReferenceNum = partition_num; 960 + addr.partitionReferenceNum = partition_ref; 961 961 962 962 metadata_fe = udf_iget_special(sb, &addr); 963 963 ··· 974 974 return metadata_fe; 975 975 } 976 976 977 - static int udf_load_metadata_files(struct super_block *sb, int partition) 977 + static int udf_load_metadata_files(struct super_block *sb, int partition, 978 + int type1_index) 978 979 { 979 980 struct udf_sb_info *sbi = UDF_SB(sb); 980 981 struct udf_part_map *map; ··· 985 984 986 985 map = &sbi->s_partmaps[partition]; 987 986 mdata = &map->s_type_specific.s_metadata; 987 + mdata->s_phys_partition_ref = type1_index; 988 988 989 989 /* metadata address */ 990 990 udf_debug("Metadata file location: block = %d part = %d\n", 991 - mdata->s_meta_file_loc, map->s_partition_num); 991 + mdata->s_meta_file_loc, mdata->s_phys_partition_ref); 992 992 993 993 fe = udf_find_metadata_inode_efe(sb, mdata->s_meta_file_loc, 994 - map->s_partition_num); 994 + mdata->s_phys_partition_ref); 995 995 if (IS_ERR(fe)) { 996 996 /* mirror file entry */ 997 997 udf_debug("Mirror metadata file location: block = %d part = %d\n", 998 - mdata->s_mirror_file_loc, map->s_partition_num); 998 + mdata->s_mirror_file_loc, mdata->s_phys_partition_ref); 999 999 1000 1000 fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc, 1001 - map->s_partition_num); 1001 + mdata->s_phys_partition_ref); 1002 1002 1003 1003 if (IS_ERR(fe)) { 1004 1004 udf_err(sb, "Both metadata and mirror metadata inode efe can not found\n"); ··· 1017 1015 */ 1018 1016 if (mdata->s_bitmap_file_loc != 0xFFFFFFFF) { 1019 1017 addr.logicalBlockNum = mdata->s_bitmap_file_loc; 1020 - addr.partitionReferenceNum = map->s_partition_num; 1018 + addr.partitionReferenceNum = mdata->s_phys_partition_ref; 1021 1019 1022 1020 udf_debug("Bitmap file location: block = %d part = %d\n", 1023 1021 addr.logicalBlockNum, addr.partitionReferenceNum); ··· 1285 1283 p = (struct partitionDesc *)bh->b_data; 1286 1284 partitionNumber = le16_to_cpu(p->partitionNumber); 1287 1285 1288 - /* First scan for TYPE1, SPARABLE and METADATA partitions */ 1286 + /* First scan for TYPE1 and SPARABLE partitions */ 1289 1287 for (i = 0; i < sbi->s_partitions; i++) { 1290 1288 map = &sbi->s_partmaps[i]; 1291 1289 udf_debug("Searching map: (%d == %d)\n", ··· 1335 1333 goto out_bh; 1336 1334 1337 1335 if (map->s_partition_type == UDF_METADATA_MAP25) { 1338 - ret = udf_load_metadata_files(sb, i); 1336 + ret = udf_load_metadata_files(sb, i, type1_idx); 1339 1337 if (ret < 0) { 1340 1338 udf_err(sb, "error loading MetaData partition map %d\n", 1341 1339 i);
+5
fs/udf/udf_sb.h
··· 61 61 __u32 s_bitmap_file_loc; 62 62 __u32 s_alloc_unit_size; 63 63 __u16 s_align_unit_size; 64 + /* 65 + * Partition Reference Number of the associated physical / sparable 66 + * partition 67 + */ 68 + __u16 s_phys_partition_ref; 64 69 int s_flags; 65 70 struct inode *s_metadata_fe; 66 71 struct inode *s_mirror_fe;