[DRBD-cvs] r1898 - in branches/drbd-0.7: drbd user

www-data www-data at linbit.com
Tue Jul 26 09:29:51 CEST 2005


Author: lars
Date: 2005-07-26 09:29:49 +0200 (Tue, 26 Jul 2005)
New Revision: 1898

Modified:
   branches/drbd-0.7/drbd/drbd_fs.c
   branches/drbd-0.7/drbd/drbd_int.h
   branches/drbd-0.7/drbd/drbd_main.c
   branches/drbd-0.7/drbd/drbd_req.c
   branches/drbd-0.7/user/drbdadm.h
   branches/drbd-0.7/user/drbdadm_main.c
   branches/drbd-0.7/user/drbdadm_parser.y
   branches/drbd-0.7/user/drbdadm_scanner.fl
   branches/drbd-0.7/user/drbdsetup.c
Log:

on special demand of a paying customer...

 * make it possible to disable bd_claim on 2.6. kernels
   this allows for read-only (raw) access on the mirroring target (Secondary)
   your application needs to be able to cope with all distributed locking and 
   coherency issues

 * you can "disable-ip-verification" in the global section of drbd.conf,
   so the drbdadm does not bug you with warning messages if it does not find
   the configured ip on the host.

 * you may now specify a "size" parameter in the disk sections of resources
   in drbd.conf, in case you think you need it.
   I'd suggest to not use it, though.

 + still TODO: documentation update for these changes

 - took the opportunity to get rid of the useless "disable-io-hints" module
   parameter


Modified: branches/drbd-0.7/drbd/drbd_fs.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_fs.c	2005-07-25 16:10:59 UTC (rev 1897)
+++ branches/drbd-0.7/drbd/drbd_fs.c	2005-07-26 07:29:49 UTC (rev 1898)
@@ -731,6 +731,8 @@
 		 * become Secondary. */
 		if (bd_claim(mdev->this_bdev,drbd_sec_holder))
 			return -EBUSY;
+		if (disable_bd_claim)
+			bd_release(mdev->this_bdev);
 	}
 #endif
 

Modified: branches/drbd-0.7/drbd/drbd_int.h
===================================================================
--- branches/drbd-0.7/drbd/drbd_int.h	2005-07-25 16:10:59 UTC (rev 1897)
+++ branches/drbd-0.7/drbd/drbd_int.h	2005-07-26 07:29:49 UTC (rev 1898)
@@ -72,7 +72,7 @@
 
 // module parameter, defined in drbd_main.c
 extern int minor_count;
-extern int disable_io_hints;
+extern int disable_bd_claim;
 extern int major_nr;
 extern int use_nbd_major;
 

Modified: branches/drbd-0.7/drbd/drbd_main.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_main.c	2005-07-25 16:10:59 UTC (rev 1897)
+++ branches/drbd-0.7/drbd/drbd_main.c	2005-07-26 07:29:49 UTC (rev 1898)
@@ -103,13 +103,12 @@
 MODULE_PARM_DESC(use_nbd_major, "DEPRECATED! use nbd device major nr (43) "
 		                "instead of the default " __stringify(LANANA_DRBD_MAJOR) );
 MODULE_PARM_DESC(minor_count, "Maximum number of drbd devices (1-255)");
-MODULE_PARM_DESC(disable_io_hints, "Necessary if the loopback network device is used for DRBD" );
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 MODULE_PARM(use_nbd_major,"i");
 MODULE_PARM(minor_count,"i");
-MODULE_PARM(disable_io_hints,"i");
 #else
 #include <linux/moduleparam.h>
+MODULE_PARM_DESC(disable_bd_claim, "DONT USE! disables block device claiming" );
 /*
  * please somebody explain to me what the "perm" of the module_param
  * macro is good for (yes, permission for it in the "driverfs", but what
@@ -126,7 +125,7 @@
  */
 module_param(use_nbd_major,   bool,0);
 module_param(minor_count,      int,0);
-module_param(disable_io_hints,bool,0);
+module_param(disable_bd_claim,bool,0);
 #endif
 
 // module parameter, defined
@@ -137,8 +136,7 @@
 #else
 int minor_count = 8;
 #endif
-// FIXME disable_io_hints shall die
-int disable_io_hints = 0;
+int disable_bd_claim = 0;
 
 // devfs name
 char* drbd_devfs_name = "drbd";
@@ -1325,10 +1323,6 @@
 {
 	mdev->flags = 1<<DISKLESS;
 
-	/* If the UNPLUG_QUEUED flag is set but it is not
-	   actually queued the functionality is completely disabled */
-	if (disable_io_hints) mdev->flags |= 1<<UNPLUG_QUEUED;
-
 	mdev->sync_conf.rate       = 250;
 	mdev->sync_conf.al_extents = 127; // 512 MB active set
 	mdev->state                = Secondary;
@@ -1809,6 +1803,8 @@
 		if (bd_claim(mdev->this_bdev,drbd_sec_holder)) {
 			// Initial we are Secondary -> should claim myself.
 			WARN("Could not bd_claim() myself.");
+		} else if (disable_bd_claim) {
+			bd_release(mdev->this_bdev);
 		}
 
 		blk_queue_make_request(q,drbd_make_request_26);

Modified: branches/drbd-0.7/drbd/drbd_req.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_req.c	2005-07-25 16:10:59 UTC (rev 1897)
+++ branches/drbd-0.7/drbd/drbd_req.c	2005-07-26 07:29:49 UTC (rev 1898)
@@ -193,9 +193,11 @@
 	 * [ ... until we implement some shared mode, and our users confirm by
 	 * configuration, that they handle cache coherency themselves ... ]
 	 */
-	if (mdev->state != Primary) {
+	if (mdev->state != Primary &&
+		( !disable_bd_claim || rw == WRITE ) ) {
 		if (DRBD_ratelimit(5*HZ,5)) {
-			ERR("Not in Primary state, no IO requests allowed\n");
+			ERR("Not in Primary state, no %s requests allowed\n",
+					disable_bd_claim ? "WRITE" : "IO");
 		}
 		drbd_bio_IO_error(bio);
 		return 0;

Modified: branches/drbd-0.7/user/drbdadm.h
===================================================================
--- branches/drbd-0.7/user/drbdadm.h	2005-07-25 16:10:59 UTC (rev 1897)
+++ branches/drbd-0.7/user/drbdadm.h	2005-07-26 07:29:49 UTC (rev 1898)
@@ -30,9 +30,11 @@
 /* for verify_ips(): make not verifyable ips fatal */
 //#define INVALID_IP_IS_INVALID_CONF
 
+
 struct d_globals
 {
   int disable_io_hints;
+  int disable_ip_verification;
   int minor_count;
   int dialog_refresh;
 };

Modified: branches/drbd-0.7/user/drbdadm_main.c
===================================================================
--- branches/drbd-0.7/user/drbdadm_main.c	2005-07-25 16:10:59 UTC (rev 1897)
+++ branches/drbd-0.7/user/drbdadm_main.c	2005-07-26 07:29:49 UTC (rev 1898)
@@ -104,7 +104,7 @@
 struct utsname nodeinfo;
 int line=1;
 int fline, c_resource_start;
-struct d_globals global_options = { 0, 0, 1 };
+struct d_globals global_options = { 0, 0, 0, 1 };
 char *config_file = NULL;
 struct d_resource* config = NULL;
 int nr_resources;
@@ -245,17 +245,17 @@
 
 static void dump_global_info()
 {
-  if (global_options.minor_count || global_options.disable_io_hints)
-    {
-      printI("global {\n"); ++indent;
-      if (global_options.disable_io_hints)
-	printI("disable-io-hints;\n");
-      if (global_options.minor_count)
-	printI("minor-count %i;\n", global_options.minor_count);
-      if (global_options.dialog_refresh != 1)
-	printI("dialog-refresh %i;\n", global_options.dialog_refresh);
-      --indent; printI("}\n\n");
-    }
+  if (  !global_options.minor_count
+     && !global_options.disable_ip_verification
+     &&  global_options.dialog_refresh == 1 ) return;
+  printI("global {\n"); ++indent;
+  if (global_options.disable_ip_verification)
+    printI("disable-ip-verification;\n");
+  if (global_options.minor_count)
+    printI("minor-count %i;\n", global_options.minor_count);
+  if (global_options.dialog_refresh != 1)
+    printI("dialog-refresh %i;\n", global_options.dialog_refresh);
+  --indent; printI("}\n\n");
 }
 
 static void dump_host_info(struct d_host_info* hi)
@@ -987,6 +987,7 @@
   char *argv[] = { "/bin/bash", "-c", NULL, "drbdadm:verify_ips", NULL };
   int ex;
 
+  if (global_options.disable_ip_verification) return;
   if (dry_run == 1 || do_verify_ips == 0) return;
 
   if (!(res && res->me   && res->me->address

Modified: branches/drbd-0.7/user/drbdadm_parser.y
===================================================================
--- branches/drbd-0.7/user/drbdadm_parser.y	2005-07-25 16:10:59 UTC (rev 1897)
+++ branches/drbd-0.7/user/drbdadm_parser.y	2005-07-26 07:29:49 UTC (rev 1898)
@@ -322,6 +322,7 @@
 %token TK_GLOBAL TK_RESOURCE
 %token TK_ON TK_NET TK_DISK_S TK_SYNCER TK_STARTUP
 %token TK_DISABLE_IO_HINTS
+%token TK_DISABLE_IP_VERIFICATION
 %token TK_PROTOCOL TK_INCON_DEGR_CMD
 %token TK_ADDRESS TK_DISK TK_DEVICE TK_META_DISK
 %token <txt> TK_MINOR_COUNT TK_INTEGER TK_STRING
@@ -352,7 +353,14 @@
 		;
 
 glob_stmt:	  TK_DISABLE_IO_HINTS
-			{ global_options.disable_io_hints=1;   }
+		{
+		    fprintf(stderr,
+			    "%s:%d: in global section, "
+			    "useless use of no longer available option \"disable_io_hints\".\n",
+			    config_file, line);
+		}
+		|  TK_DISABLE_IP_VERIFICATION
+		{ global_options.disable_ip_verification=1; }
 		| TK_MINOR_COUNT TK_INTEGER
 		{
 			range_check(R_MINOR_COUNT,$1,$2);

Modified: branches/drbd-0.7/user/drbdadm_scanner.fl
===================================================================
--- branches/drbd-0.7/user/drbdadm_scanner.fl	2005-07-25 16:10:59 UTC (rev 1897)
+++ branches/drbd-0.7/user/drbdadm_scanner.fl	2005-07-26 07:29:49 UTC (rev 1898)
@@ -206,6 +206,7 @@
   minor[-_]count	do_assign(NUM); CP; return TK_MINOR_COUNT;
   disable[-_]io[-_]hints yy_push_state(SEMICOLON); return TK_DISABLE_IO_HINTS;
   dialog-refresh        do_assign(NUM); CP; return TK_DIALOG_REFRESH;
+  disable-ip-verification  yy_push_state(SEMICOLON); return TK_DISABLE_IP_VERIFICATION;
   {NDELIM}		expect_error("'minor-count|disable-io-hints|dialog-refresh'");
 }
 
@@ -233,6 +234,7 @@
 
 <DISK>{
   on-io-error		do_assign(IO_ERROR); CP; return TK_ON_IO_ERROR;
+  size                  do_assign(NUM_U); CP; return TK_SIZE;
   {NDELIM}		expect_error("'on-io-error'");
 }
 

Modified: branches/drbd-0.7/user/drbdsetup.c
===================================================================
--- branches/drbd-0.7/user/drbdsetup.c	2005-07-25 16:10:59 UTC (rev 1897)
+++ branches/drbd-0.7/user/drbdsetup.c	2005-07-26 07:29:49 UTC (rev 1898)
@@ -526,7 +526,7 @@
       switch(c)
 	{
 	case 'd':
-	  cn->config.disk_size = m_strtoll_range(optarg,'K', "disk-size",
+	  cn->config.disk_size = m_strtoll_range(optarg,'K', "size",
 			      DRBD_DISK_SIZE_SECT_MIN>>1,
 			      DRBD_DISK_SIZE_SECT_MAX>>1 );
 	  break;
@@ -1179,7 +1179,7 @@
 	  switch(c)
 	    {
 	    case 'd':
-	      u_size=m_strtoll_range(optarg,'K', "disk-size",
+	      u_size=m_strtoll_range(optarg,'K', "size",
 			      DRBD_DISK_SIZE_SECT_MIN>>1,
 			      DRBD_DISK_SIZE_SECT_MAX>>1 );
 	      break;



More information about the drbd-cvs mailing list