]> git.baikalelectronics.ru Git - kernel.git/commit
dm snapshot: fix register_snapshot deadlock
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 30 Oct 2008 13:33:12 +0000 (13:33 +0000)
committerAlasdair G Kergon <agk@redhat.com>
Thu, 30 Oct 2008 13:33:12 +0000 (13:33 +0000)
commit080d32fbeff04c5b7d5b64518f2eb745cec68098
treea6295bec9c1fa01885ef14befa4ae3618f51ca57
parent697c030a457e3077a65ed751bf5cf3b3774e44a2
dm snapshot: fix register_snapshot deadlock

register_snapshot() performs a GFP_KERNEL allocation while holding
_origins_lock for write, but that could write out dirty pages onto a
device that attempts to acquire _origins_lock for read, resulting in
deadlock.

So move the allocation up before taking the lock.

This path is not performance-critical, so it doesn't matter that we
allocate memory and free it if we find that we won't need it.

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