Bug 9204

Summary: unlink broken in hfsplus - hard links
Product: File System Reporter: till busch (buti)
Component: HFS/HFSPLUSAssignee: Roman Zippel (zippel)
Status: CLOSED CODE_FIX    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.22 Subsystem:
Regression: --- Bisected commit-id:

Description till busch 2007-10-21 09:14:13 UTC
Most recent kernel where this bug did not occur:
Distribution: kubuntu 7.10 gutsy
Hardware Environment: MacBookPro 3.1
Software Environment: /home partition shared with OSX
Problem Description:


i'm using hfsplus for my /home (it is shared with osx). i'm having problems with hard links on hfsplus.
the link count for a file with hard links drops from n to 0 when removing one linked file.

Steps to reproduce:

install diskdev-cmds from:
 http://gentoo.osuosl.org/distfiles/diskdev_cmds-332.14.tar.gz
 http://gentoo.osuosl.org/distfiles/diskdev_cmds-332.14.patch.bz2

 make -f Makefile.lnx
interesting binaries are in newfs_hfs.tproj/ and fsck_hfs.tproj/

create a filesystem:
 dd if=/dev/zero of=/tmp/hfsplus bs=1M count=2
 newfs_hfs /tmp/hfsplus
 mkdir /tmp/mnt
 mount -oloop /tmp/hfsplus /tmp/mnt
 cd /tmp/mnt
 echo foo > foo
 ln foo foo1
 ln foo foo2
 ln foo foo3

# now check the link count:
 ls -laFi
# it is ok

# now unlink foo3
 rm foo3
# check link count again
 ls -laFi
# link count is down to 0
Comment 1 till busch 2008-08-13 01:56:08 UTC
fixed as of 2008-04-10

see following commit by Roman Zippel:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=76b0c26af2736b7e5b87e6ed7ab63901483d5736