Bug 109761
Summary: | FreeBSD UFS2 file systems are not recognized on MS DOS (MBR) partitions | ||
---|---|---|---|
Product: | File System | Reporter: | Richard Narron (richard) |
Component: | Other | Assignee: | fs_other |
Status: | CLOSED CODE_FIX | ||
Severity: | high | CC: | szg00000 |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 4.4-rc6 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
Patch to block/partitions/msdos.c for FreeBSD partitions
prettier patch to block/partitions/msdos.c for FreeBSD partitions Linux 4.12-rc3 version of the patch |
I have tested the patch on Slackware current Linux 4.4-rc6, 4.4-RC5 and 4.1.15 And on Slackware 14.1 Linux 3.10.94 Needless to say the patch can be back ported to earlier kernels... Created attachment 198461 [details]
prettier patch to block/partitions/msdos.c for FreeBSD partitions
This patch is "prettier" per the scripts/checkpatch.pl script.
prettier version of the patch: --- linux/block/partitions/msdos.c.orig 2015-12-27 18:17:37.000000000 -0800 +++ linux/block/partitions/msdos.c 2015-12-29 10:44:25.813773357 -0800 @@ -300,6 +300,8 @@ static void parse_bsd(struct parsed_part continue; bsd_start = le32_to_cpu(p->p_offset); bsd_size = le32_to_cpu(p->p_size); + if (memcmp(flavour, "bsd\0", 4) == 0) + bsd_start = bsd_start + offset; if (offset == bsd_start && size == bsd_size) /* full parent partition, we have it already */ continue; The patch still works on current kernels (4.4.68 4.9.28 4.12.1-rc1) This is now fixed in Linux-4.12-rc3 It was submitted to the kernel-block forum and thanks to Christoph Hellwig and Jens Axboe it was accepted by Linus. Created attachment 256817 [details]
Linux 4.12-rc3 version of the patch
Attached is the Linux 4.12-rc3 version of the patch that was accepted by Linus.
This is fixed. |
Created attachment 197951 [details] Patch to block/partitions/msdos.c for FreeBSD partitions The code in block/partitions/msdos.c recognizes FreeBSD, OpenBSD and NetBSD partitions and does a reasonable job picking out OpenBSD and NetBSD UFS subpartitions But for FreeBSD the subpartitions are always "bad". Kernel: <bsd:bad subpartition - ignored Though all 3 of these BSD systems use UFS as a file system, only FreeBSD uses relative start addresses in the subpartition declarations. The following patch fixes this for FreeBSD partitions and leaves the code for OpenBSD and NetBSD intact: --- block/partitions/msdos.c.orig 2015-12-13 17:42:58.000000000 -0800 +++ block/partitions/msdos.c 2015-12-17 18:32:21.832267195 -0800 @@ -300,6 +300,9 @@ continue; bsd_start = le32_to_cpu(p->p_offset); bsd_size = le32_to_cpu(p->p_size); + if (memcmp(flavour,"bsd\0",4) == 0) { + bsd_start = bsd_start + offset; + } if (offset == bsd_start && size == bsd_size) /* full parent partition, we have it already */ continue;