• Darrick J. Wong's avatar
    xfs: recheck reflink / dirty page status before freeing CoW reservations · be78ff0e
    Darrick J. Wong authored
    Eryu Guan reported seeing occasional hangs when running generic/269 with
    a new fsstress that supports clonerange/deduperange.  The cause of this
    hang is an infinite loop when we convert the CoW fork extents from
    unwritten to real just prior to writing the pages out; the infinite
    loop happens because there's nothing in the CoW fork to convert, and so
    it spins forever.
    
    The fundamental issue here is that when we go to perform these CoW fork
    conversions, we're supposed to have an extent waiting for us, but the
    low space CoW reaper has snuck in and blown them away!  There are four
    conditions that can dissuade the reaper from touching our file -- no
    reflink iflag; dirty page cache; writeback in progress; or directio in
    progress.  We check the four conditions prior to taking the locks, but
    we neglect to recheck them once we have the locks, which is how we end
    up whacking the writeback that's in progress.
    
    Therefore, refactor the four checks into a helper function and call it
    once again once we have the locks to make sure we really want to reap
    the inode.  While we're at it, add an ASSERT for this weird condition so
    that we'll fail noisily if we ever screw this up again.
    Reported-by: default avatarEryu Guan <eguan@redhat.com>
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Tested-by: default avatarEryu Guan <eguan@redhat.com>
    Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
    be78ff0e
xfs_icache.c 45.3 KB