• KaiGai Kohei's avatar
    [JFFS2][XATTR] Fix xd->refcnt race condition · c6e8c6cc
    KaiGai Kohei authored
    When xd->refcnt is checked whether this xdatum should be released
    or not, atomic_dec_and_lock() is used to ensure holding the
    c->erase_completion_lock.
    
    This fix change a specification of delete_xattr_datum().
    Previously, it's only called when xd->refcnt equals zero.
    (calling it with positive xd->refcnt cause a BUG())
    If you applied this patch, the function checks whether
    xd->refcnt is zero or not under the spinlock if necessary.
    Then, it marks xd DEAD flahs and links with xattr_dead_list
    or releases it immediately when xd->refcnt become zero.
    Signed-off-by: default avatarKaiGai Kohei <kaigai@ak.jp.nec.com>
    Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
    c6e8c6cc
xattr.c 37.6 KB