aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2010-11-24 04:37:35 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:35:12 -0500
commit17a93f3007c13003c739a19d0814cb5c2d21daba (patch)
treea3b6bd04eeecc0da14f20e6766495b3b06e7ce57
parent3da127fa887e5187ede702b835770634d705f8b2 (diff)
drbd: remove /proc/drbd before unregistering from netlink
There still exists a (theoretical) race on module unload, where /proc/drbd may still exist, but the netlink callback has been unregistered already, allowing drbdsetup to shout without listeners, and get no reply. Reorder remove_proc_entry and unregister of netlink callback. drbdsetup first checks for existence of the proc entry, and if that is missing, won't even try to contact the module. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r--drivers/block/drbd/drbd_main.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 8b8a38dc6492..150ed16d26ef 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -3174,11 +3174,20 @@ static void drbd_cleanup(void)
3174 3174
3175 unregister_reboot_notifier(&drbd_notifier); 3175 unregister_reboot_notifier(&drbd_notifier);
3176 3176
3177 /* first remove proc,
3178 * drbdsetup uses it's presence to detect
3179 * whether DRBD is loaded.
3180 * If we would get stuck in proc removal,
3181 * but have netlink already deregistered,
3182 * some drbdsetup commands may wait forever
3183 * for an answer.
3184 */
3185 if (drbd_proc)
3186 remove_proc_entry("drbd", NULL);
3187
3177 drbd_nl_cleanup(); 3188 drbd_nl_cleanup();
3178 3189
3179 if (minor_table) { 3190 if (minor_table) {
3180 if (drbd_proc)
3181 remove_proc_entry("drbd", NULL);
3182 i = minor_count; 3191 i = minor_count;
3183 while (i--) 3192 while (i--)
3184 drbd_delete_device(i); 3193 drbd_delete_device(i);