• M
    dm snapshot: fix race during exception creation · a8d41b59
    Mikulas Patocka 提交于
    Fix a race condition that returns incorrect data when a write causes an
    exception to be allocated whilst a read is still in flight.
    
    The race condition happens as follows:
    * A read to non-reallocated sector in the snapshot is submitted so that the
      read is routed to the original device.
    * A write to the original device is submitted. The write causes an exception
      that reallocates the block.  The write proceeds.
    * The original read is dequeued and reads the wrong data.
    
    This race can be triggered with CFQ scheduler and one thread writing and
    multiple threads reading simultaneously.
    
    (This patch relies upon the earlier dm-kcopyd-per-device.patch to avoid a
    deadlock.)
    Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
    a8d41b59
dm-snap.c 31.9 KB