• Darrick J. Wong's avatar
    xfs: fix reflink source file racing with directio writes · 5d888b48
    Darrick J. Wong authored
    While trawling through the dedupe file comparison code trying to fix
    page deadlocking problems, Dave Chinner noticed that the reflink code
    only takes shared IOLOCK/MMAPLOCKs on the source file.  Because
    page_mkwrite and directio writes do not take the EXCL versions of those
    locks, this means that reflink can race with writer processes.
    
    For pure remapping this can lead to undefined behavior and file
    corruption; for dedupe this means that we cannot be sure that the
    contents are identical when we decide to go ahead with the remapping.
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    5d888b48
xfs_reflink.c 45.5 KB