]> git.baikalelectronics.ru Git - kernel.git/commit
dm snapshot: avoid having two exceptions for the same chunk
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 2 Apr 2009 18:55:26 +0000 (19:55 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Thu, 2 Apr 2009 18:55:26 +0000 (19:55 +0100)
commit60ac0a70b22b09c863e0acd2e8e25f08947cf0d2
tree40be2f357f0905573bd4d21ff59e0db3cda26442
parent38d0d4ff8779d3774eb443256c5e49b3aa7233d2
dm snapshot: avoid having two exceptions for the same chunk

We need to check if the exception was completed after dropping the lock.

After regaining the lock, __find_pending_exception checks if the exception
was already placed into &s->pending hash.

But we don't check if the exception was already completed and placed into
&s->complete hash. If the process waiting in alloc_pending_exception was
delayed at this point because of a scheduling latency and the exception
was meanwhile completed, we'd miss that and allocate another pending
exception for already completed chunk.

It would lead to a situation where two records for the same chunk exist
and potential data corruption because multiple snapshot I/Os to the
affected chunk could be redirected to different locations in the
snapshot.

Cc: stable@kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-snap.c