[DRBD-cvs] svn commit by lars - r2444 - trunk/drbd - remove device_mutex, current usage does not make sense

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Thu Sep 21 14:03:56 CEST 2006


Author: lars
Date: 2006-09-21 14:03:54 +0200 (Thu, 21 Sep 2006)
New Revision: 2444

Modified:
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_receiver.c
Log:

remove device_mutex, current usage does not make sense any more.
remove unnecessary loop in drbd_cleanup



Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2006-09-21 09:52:49 UTC (rev 2443)
+++ trunk/drbd/drbd_int.h	2006-09-21 12:03:54 UTC (rev 2444)
@@ -795,9 +795,6 @@
 	/* things that are stored as / read from meta data on disk */
 	unsigned long flags;
 
-	/* config data protected by: */
-	struct semaphore device_mutex;
-
 	/* configured by drbdsetup */
 	struct net_conf *net_conf; // protected by inc_net() and dec_net()
 	struct syncer_conf sync_conf;

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2006-09-21 09:52:49 UTC (rev 2443)
+++ trunk/drbd/drbd_main.c	2006-09-21 12:03:54 UTC (rev 2444)
@@ -2142,19 +2142,6 @@
 	drbd_nl_cleanup();
 
 	if (minor_table) {
-		for (i = 0; i < minor_count; i++) {
-			drbd_dev    *mdev = minor_to_mdev(i);
-			if(!mdev) continue;
-
-			down(&mdev->device_mutex);
-			/* shouldn't this be an assert only?
-			 * we are removing the module here! */
-			drbd_set_role(mdev,Secondary,0);
-			up(&mdev->device_mutex);
-			drbd_sync_me(mdev);
-			drbd_thread_stop(&mdev->receiver);
-		}
-
 		if (drbd_proc)
 			remove_proc_entry("drbd",&proc_root);
 		i=minor_count;
@@ -2293,7 +2280,6 @@
 
 	if (drbd_bm_init(mdev)) goto Enomem;
 	// no need to lock access, we are still initializing the module.
-	init_MUTEX(&mdev->device_mutex);
 	if (!tl_init(mdev)) goto Enomem;
 
 	mdev->app_reads_hash=kmalloc(APP_R_HSIZE*sizeof(void*),GFP_KERNEL);

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2006-09-21 09:52:49 UTC (rev 2443)
+++ trunk/drbd/drbd_receiver.c	2006-09-21 12:03:54 UTC (rev 2444)
@@ -1614,16 +1614,14 @@
 	case PanicPrimary:
 		hg = drbd_asb_recover_0p(mdev);
 		if( hg == -1 && mdev->state.role==Primary) {
-			int got_mutex=!down_interruptible(&mdev->device_mutex);
-			if (got_mutex) self = drbd_set_role(mdev,Secondary,0);
-			if (self != SS_Success || !got_mutex) {
+			self = drbd_set_role(mdev,Secondary,0);
+			if (self != SS_Success) {
 				drbd_khelper(mdev,"pri-lost-after-sb");
 				drbd_panic("Panic by after-sb-1pri handler\n");
 			} else {
 				WARN("Sucessfully gave up primary role.\n");
 				rv = hg;
 			}
-			if (got_mutex) up(&mdev->device_mutex);
 		} else rv = hg;
 	}
 	return rv;
@@ -1651,16 +1649,14 @@
 	case PanicPrimary:
 		hg = drbd_asb_recover_0p(mdev);
 		if( hg == -1 ) {
-			int got_mutex=!down_interruptible(&mdev->device_mutex);
-			if (got_mutex) self = drbd_set_role(mdev,Secondary,0);
-			if (self != SS_Success || !got_mutex) {
+			self = drbd_set_role(mdev,Secondary,0);
+			if (self != SS_Success) {
 				drbd_khelper(mdev,"pri-lost-after-sb");
 				drbd_panic("Panic by after-sb-2pri handler\n");
 			} else {
 				WARN("Sucessfully gave up primary role.\n");
 				rv = hg;
 			}
-			if (got_mutex) up(&mdev->device_mutex);
 		} else rv = hg;
 	}
 	return rv;



More information about the drbd-cvs mailing list