[PATCH] Fix HFS+ to free up the space when a file is deleted.
authorPeter Wainwright <peter.wainwright@hpa-rp.org.uk>
Wed, 26 Oct 2005 08:59:02 +0000 (01:59 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 26 Oct 2005 17:39:43 +0000 (10:39 -0700)
fsck_hfs reveals lots of temporary files accumulating in the hidden
directory "\000\000\000HFS+ Private Data".  According to the HFS+
documentation these are files which are unlinked while in use.  However,
there may be a bug in the Linux hfsplus implementation which causes this to
happen even when the files are not in use.  It looks like the "opencnt"
field is never initialized as (I think) it should be in hfsplus_read_inode.
 This means that a file can appear to be still in use when in fact it has
been closed.  This patch seems to fix it for me.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/hfsplus/super.c

index fd0f0f050e1d5f3643f7b6e7273af4d7ade0448e..452fc1fdbd32b9d3342c5e1c4f02e7b56664a718 100644 (file)
@@ -50,6 +50,7 @@ static void hfsplus_read_inode(struct inode *inode)
        init_MUTEX(&HFSPLUS_I(inode).extents_lock);
        HFSPLUS_I(inode).flags = 0;
        HFSPLUS_I(inode).rsrc_inode = NULL;
+       atomic_set(&HFSPLUS_I(inode).opencnt, 0);
 
        if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID) {
        read_inode: