[DRBD-cvs] svn commit by phil - r2410 - in trunk: drbd user - * DRBD crashed in /home/phil/src/drbd08/drbd/drbd_req.h

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Tue Sep 12 20:17:44 CEST 2006


Author: phil
Date: 2006-09-12 20:17:42 +0200 (Tue, 12 Sep 2006)
New Revision: 2410

Modified:
   trunk/drbd/drbd_nl.c
   trunk/drbd/drbd_req.c
   trunk/drbd/drbd_req.h
   trunk/user/Makefile
Log:
* DRBD crashed in /home/phil/src/drbd08/drbd/drbd_req.h:200 hard
  if allow-two-primaries was not set. Fixed.
  
* In case netlink failes to deliver a message to userspace, because
  the receiving process disappeared (ESRCH), do not print this to
  kernel.log
      
* Marked ee_hash_slot as 'static inline' functions. As 'static'
  functions they could end up to be instanciated with every compilation 
  unit.
  
* Added the -I($KDIR) back in when compiling drbdsetup. Simon
  suggested this.
  


Modified: trunk/drbd/drbd_nl.c
===================================================================
--- trunk/drbd/drbd_nl.c	2006-09-12 12:36:14 UTC (rev 2409)
+++ trunk/drbd/drbd_nl.c	2006-09-12 18:17:42 UTC (rev 2410)
@@ -1499,7 +1499,9 @@
 	cn_reply->flags = 0;
 
 	rr = cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
-	if(rr) printk(KERN_INFO DEVICE_NAME " cn_netlink_send()=%d\n",rr);
+	if(rr && rr != -ESRCH) {
+		printk(KERN_INFO DEVICE_NAME " cn_netlink_send()=%d\n",rr);
+	}
 	kfree(cn_reply);
 	module_put(THIS_MODULE);
 	return;
@@ -1593,6 +1595,8 @@
 	reply->ret_code = ret_code;
 
 	rr = cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
-	if(rr) printk(KERN_INFO DEVICE_NAME " cn_netlink_send()=%d\n",rr);
+	if(rr && rr != -ESRCH) {
+		printk(KERN_INFO DEVICE_NAME " cn_netlink_send()=%d\n",rr);
+	}
 }
 

Modified: trunk/drbd/drbd_req.c
===================================================================
--- trunk/drbd/drbd_req.c	2006-09-12 12:36:14 UTC (rev 2409)
+++ trunk/drbd/drbd_req.c	2006-09-12 18:17:42 UTC (rev 2410)
@@ -154,10 +154,12 @@
 			 * and maybe even hash tables? */
 #undef OVERLAPS
 #define OVERLAPS overlaps(req->sector, req->size, e->sector, e->size)
-			slot = ee_hash_slot(mdev,req->sector);
-			hlist_for_each_entry(e, n, slot, colision) {
-				if (OVERLAPS)
-					drbd_queue_work(&mdev->data.work,&e->w);
+			if(mdev->ee_hash_s) {
+				slot = ee_hash_slot(mdev,req->sector);
+				hlist_for_each_entry(e, n, slot, colision) {
+					if (OVERLAPS)
+						drbd_queue_work(&mdev->data.work,&e->w);
+				}
 			}
 #undef OVERLAPS
 		}
@@ -284,18 +286,20 @@
 	 * register in front */
 	hlist_add_head(&req->colision,slot);
 
-	/* now, check for overlapping requests with remote origin */
+	if(mdev->ee_hash_s) {
+		/* now, check for overlapping requests with remote origin */
 #undef OVERLAPS
 #define OVERLAPS overlaps(e->sector, e->size, sector, size)
-	slot = ee_hash_slot(mdev,sector);
-	hlist_for_each_entry(e, n, slot, colision) {
-		if (OVERLAPS) {
-			ALERT("%s[%u] Concurrent remote write detected!"
-			      "	[DISCARD L] new: %llu +%d; pending: %llu +%d\n",
-			      current->comm, current->pid,
-			      (unsigned long long)sector, size,
-			      e->sector, e->size);
-			return 1;
+		slot = ee_hash_slot(mdev,sector);
+		hlist_for_each_entry(e, n, slot, colision) {
+			if (OVERLAPS) {
+				ALERT("%s[%u] Concurrent remote write detected!"
+				      "	[DISCARD L] new: %llu +%d; pending: %llu +%d\n",
+				      current->comm, current->pid,
+				      (unsigned long long)sector, size,
+				      e->sector, e->size);
+				return 1;
+			}
 		}
 	}
 #undef OVERLAPS

Modified: trunk/drbd/drbd_req.h
===================================================================
--- trunk/drbd/drbd_req.h	2006-09-12 12:36:14 UTC (rev 2409)
+++ trunk/drbd/drbd_req.h	2006-09-12 18:17:42 UTC (rev 2410)
@@ -195,14 +195,14 @@
 #define RQ_NET_MASK        (((RQ_NET_OK << 1)-1) & ~RQ_LOCAL_MASK) /* 0xf8 */
 
 /* epoch entries */
-static struct hlist_head* ee_hash_slot(drbd_dev *mdev, sector_t sector)
+static inline struct hlist_head* ee_hash_slot(drbd_dev *mdev, sector_t sector)
 {
 	BUG_ON(mdev->ee_hash_s == 0);
 	return mdev->ee_hash + ((unsigned int)(sector>>HT_SHIFT) % mdev->ee_hash_s);
 }
 
 /* transfer log (drbd_request objects) */
-static struct hlist_head* tl_hash_slot(drbd_dev *mdev, sector_t sector)
+static inline struct hlist_head* tl_hash_slot(drbd_dev *mdev, sector_t sector)
 {
 	BUG_ON(mdev->tl_hash_s == 0);
 	return mdev->tl_hash +

Modified: trunk/user/Makefile
===================================================================
--- trunk/user/Makefile	2006-09-12 12:36:14 UTC (rev 2409)
+++ trunk/user/Makefile	2006-09-12 18:17:42 UTC (rev 2410)
@@ -21,6 +21,8 @@
 
 CC = gcc
 CFLAGS = -g -O2 -c -W -Wall -I../drbd
+# for the netlink connector stuff <linux/connector.h>:
+drbdsetup: CFLAGS += -I$(KDIR)/include
 
 drbdadm-obj = drbdadm_scanner.o drbdadm_parser.o drbdadm_main.o \
 	      drbdadm_adjust.o drbdtool_common.o drbdadm_usage_cnt.o \



More information about the drbd-cvs mailing list