Skip to content

Commit

Permalink
drbd: remove /proc/drbd before unregistering from netlink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lars Ellenberg authored and Philipp Reisner committed Mar 10, 2011
1 parent 3da127f commit 17a93f3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions drivers/block/drbd/drbd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3174,11 +3174,20 @@ static void drbd_cleanup(void)

unregister_reboot_notifier(&drbd_notifier);

/* first remove proc,
* drbdsetup uses it's presence to detect
* whether DRBD is loaded.
* If we would get stuck in proc removal,
* but have netlink already deregistered,
* some drbdsetup commands may wait forever
* for an answer.
*/
if (drbd_proc)
remove_proc_entry("drbd", NULL);

drbd_nl_cleanup();

if (minor_table) {
if (drbd_proc)
remove_proc_entry("drbd", NULL);
i = minor_count;
while (i--)
drbd_delete_device(i);
Expand Down

0 comments on commit 17a93f3

Please sign in to comment.