• Dave Chinner's avatar
    xfs: xfs_buf cache destroy isn't RCU safe · 231f91ab
    Dave Chinner authored
    Darrick and Sachin Sant reported that xfs/435 and xfs/436 would
    report an non-empty xfs_buf slab on module remove. This isn't easily
    to reproduce, but is clearly a side effect of converting the buffer
    caceh to RUC freeing and lockless lookups. Sachin bisected and
    Darrick hit it when testing the patchset directly.
    
    Turns out that the xfs_buf slab is not destroyed when all the other
    XFS slab caches are destroyed. Instead, it's got it's own little
    wrapper function that gets called separately, and so it doesn't have
    an rcu_barrier() call in it that is needed to drain all the rcu
    callbacks before the slab is destroyed.
    
    Fix it by removing the xfs_buf_init/terminate wrappers that just
    allocate and destroy the xfs_buf slab, and move them to the same
    place that all the other slab caches are set up and destroyed.
    Reported-and-tested-by: default avatarSachin Sant <sachinp@linux.ibm.com>
    Fixes: 298f3422 ("xfs: lockless buffer lookup")
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    231f91ab
xfs_super.c 59.7 KB