• Dave Chinner's avatar
    xfs: avoid moving stale inodes in the AIL · de25c181
    Dave Chinner authored
    When an inode has been marked stale because the cluster is being
    freed, we don't want to (re-)insert this inode into the AIL. There
    is a race condition where the cluster buffer may be unpinned before
    the inode is inserted into the AIL during transaction committed
    processing. If the buffer is unpinned before the inode item has been
    committed and inserted, then it is possible for the buffer to be
    released and hence processthe stale inode callbacks before the inode
    is inserted into the AIL.
    
    In this case, we then insert a clean, stale inode into the AIL which
    will never get removed by an IO completion. It will, however, get
    reclaimed and that triggers an assert in xfs_inode_free()
    complaining about freeing an inode still in the AIL.
    
    This race can be avoided by not moving stale inodes forward in the AIL
    during transaction commit completion processing. This closes the
    race condition by ensuring we never insert clean stale inodes into
    the AIL. It is safe to do this because a dirty stale inode, by
    definition, must already be in the AIL.
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    de25c181
xfs_inode_item.c 28 KB