]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
dm mpath: flush keventd queue in destructor
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 22 Jun 2009 09:12:13 +0000 (10:12 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Mon, 22 Jun 2009 09:12:13 +0000 (10:12 +0100)
The commit fe9cf30eb8186ef267d1868dc9f12f2d0f40835a moves dm table event
submission from kmultipath queue to kernel kevent queue to avoid a
deadlock.

There is a possibility of race condition because kevent queue is not flushed
in the multipath destructor. The scenario is:
- some event happens and is queued to keventd
- keventd thread is delayed due to scheuling latency or some other work
- multipath device is destroyed
- keventd now attempts to process work_struct that is residing in already
  released memory.

The patch flushes the keventd queue in multipath constructor.
I've already fixed similar bug in dm-raid1.

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

index 838f01b1dd3093be69b02d554eee041a2eaedd3f..92bdcbb7c9356c94d15ca8458168718415502fd6 100644 (file)
@@ -848,6 +848,7 @@ static void multipath_dtr(struct dm_target *ti)
 
        flush_workqueue(kmpath_handlerd);
        flush_workqueue(kmultipathd);
+       flush_scheduled_work();
        free_multipath(m);
 }