hfsplus: free space correcly for files unlinked while open
authorChristoph Hellwig <hch@tuxera.com>
Wed, 27 Oct 2010 11:45:50 +0000 (13:45 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 27 Oct 2010 11:45:50 +0000 (13:45 +0200)
hfsplus_delete_inode only truncates away all block allocations if
i_nlink is zero.  Make sure we properly drop the unlink count even
when doing the rename hack for open but unlinked files.

Signed-off-by: Christoph Hellwig <hch@tuxera.com>
fs/hfsplus/dir.c

index d236d85..e490aaf 100644 (file)
@@ -317,8 +317,10 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
                res = hfsplus_rename_cat(inode->i_ino,
                                         dir, &dentry->d_name,
                                         sbi->hidden_dir, &str);
-               if (!res)
+               if (!res) {
                        inode->i_flags |= S_DEAD;
+                       drop_nlink(inode);
+               }
                goto out;
        }
        res = hfsplus_delete_cat(cnid, dir, &dentry->d_name);