]> www.pilppa.org Git - linux-2.6-omap-h63xx.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)
commit60c856c8e2f57a3f69c505735ef66e3719ea0bd6
treea6295bec9c1fa01885ef14befa4ae3618f51ca57
parentb34578a48459ed1bd5396631aaa4a65d6bcc7726
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