Re: hfsplus bugs in linux-2.6.5

From: Martin Schaffner
Date: Sat May 22 2004 - 13:36:57 EST



On 22.05.2004, at 14:32, Roman Zippel wrote:

I still wasn't able to reproduce it on another partition than my Mac OS
X root partition. :-(

The symptoms are as follows: Whenever I try to write a sufficently
large file (always larger than 512k), or try to read a sufficiently
large file (say a 4 MB file) with any program, I get:

HFS+-fs: request for non-existent node 1929183232 in B*Tree

It seems you have a very fragmented volume and it goes wrong when the
driver tries to access the extent file. I tested this with HFS, but it
seems not all fixes made it to the HFS+ driver.
Fix is below.

Yes, that solved the problem! Thanks a lot for that fast fix! I'm glad that's finally resolved.


There is one more annoying thing with the hfsplus driver: the handling of HFSPLUS_VOL_INCNSTNT.
It seem that both Mac OS X's mount/unmount routines and fsck_hfs don't ever read or write this bit, in violation of Apple's own specifications. This means that when linux crashes, a mounted hfs+ volumes will from then on have the INCONSTNT bit set and linux will refuse to mount it read-write, even after Mac OS X fscked it and mounted it read/write. This situation can be resolved by running hpmount on that volume, which clears the INCONSTNT bit, but that's not user-friendly. I therefore propose this simple patch:

--- linux-2.6.6/fs/hfsplus/super.c.bak Sat May 22 20:32:05 2004
+++ linux-2.6.6/fs/hfsplus/super.c Sat May 22 20:34:48 2004
@@ -245,8 +245,7 @@
if (!(*flags & MS_RDONLY)) {
struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;

- if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_INCNSTNT)) ||
- !(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
+ if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
"running fsck.hfsplus is recommended. leaving read-only.\n");
sb->s_flags |= MS_RDONLY;
@@ -331,8 +330,7 @@
sb->s_op = &hfsplus_sops;
sb->s_maxbytes = MAX_LFS_FILESIZE;

- if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_INCNSTNT)) ||
- !(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
+ if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
if (!silent)
printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
"running fsck.hfsplus is recommended. mounting read-only.\n");

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/