• Sergei Antonov's avatar
    hfsplus: fix "unused node is not erased" error · 2cd282a1
    Sergei Antonov authored
    Zero newly allocated extents in the catalog tree if volume attributes
    tell us to.  Not doing so we risk getting the "unused node is not
    erased" error.  See kHFSUnusedNodeFix flag in Apple's source code for
    reference.
    
    There was a previous commit clearing the node when it is freed: commit
    899bed05 ("hfsplus: fix issue with unzeroed unused b-tree nodes").
    But it did not handle newly allocated extents (this patch fixes it).
    And it zeroed nodes in all trees unconditionally which is an overkill.
    
    This patch adds a condition and also switches to 'tree->node_size' as a
    simpler method of getting the length to zero.
    Signed-off-by: default avatarSergei Antonov <saproj@gmail.com>
    Cc: Anton Altaparmakov <aia21@cam.ac.uk>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
    Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
    Cc: Kyle Laracey <kalaracey@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    2cd282a1
xattr.c 22.9 KB