[DRBD-cvs] svn commit by phil - r2525 - in trunk: drbd user - * Made drbdsetup to have a positive exit code in case a

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Wed Oct 11 16:23:40 CEST 2006


Author: phil
Date: 2006-10-11 16:23:39 +0200 (Wed, 11 Oct 2006)
New Revision: 2525

Modified:
   trunk/drbd/drbd_main.c
   trunk/user/drbdsetup.c
Log:
* Made drbdsetup to have a positive exit code in case a config 
  command fails.
* The explicit clearing of the STOP_SYNC_TIMER bit should make
  it less likely to run into problem with fast resolving
  after dependencies.


Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2006-10-11 08:59:21 UTC (rev 2524)
+++ trunk/drbd/drbd_main.c	2006-10-11 14:23:39 UTC (rev 2525)
@@ -806,6 +806,7 @@
 		mdev->rs_paused += (long)jiffies-(long)mdev->rs_mark_time;
 		if( ns.conn == SyncTarget ) {
 			D_ASSERT(!test_bit(STOP_SYNC_TIMER,&mdev->flags));
+			clear_bit(STOP_SYNC_TIMER,&mdev->flags);
 			mod_timer(&mdev->resync_timer,jiffies);
 		}
 	}

Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c	2006-10-11 08:59:21 UTC (rev 2524)
+++ trunk/user/drbdsetup.c	2006-10-11 14:23:39 UTC (rev 2525)
@@ -689,31 +689,37 @@
 	return NULL;
 }
 
-void print_config_error( struct drbd_nl_cfg_reply *reply)
+int print_config_error( struct drbd_nl_cfg_reply *reply)
 {
 	int err_no = reply->ret_code;
+	int rv=0;
 
-	if (err_no == NoError) return;
-	if (err_no == SS_Success) return;
+	if (err_no == NoError) return rv;
+	if (err_no == SS_Success) return rv;
 
 	if ( ( err_no >= AfterLastRetCode || err_no <= RetCodeBase ) &&
 	     ( err_no > SS_CW_NoNeed || err_no < SS_CW_FailedByPeer) ) {
 		fprintf(stderr,"Error code %d unknown.\n"
 			"You should updated the drbd userland tools.\n",err_no);
+		rv = 20;
 	} else {
 		if(err_no > RetCodeBase ) {
 			fprintf(stderr,"Failure: (%d) %s\n",err_no,
 				error_messages[err_no-RetCodeBase]);
+			rv = 10;
 		} else if (err_no == SS_UnknownError) {
 			fprintf(stderr,"State change failed: (%d)"
 				"unknown error.\n", err_no);
+			rv = 11;
 		} else if (err_no > SS_TowPrimaries) {
 			// Ignore SS_Success, SS_NothingToDo, SS_CW_Success... 
 		} else {
 			fprintf(stderr,"State change failed: (%d) %s\n",
 				err_no, set_st_err_name(err_no));
+			rv = 11;
 		}
 	}
+	return rv;
 }
 
 #define RCV_SIZE NLMSG_SPACE(sizeof(struct cn_msg)+sizeof(struct drbd_nl_cfg_reply))
@@ -778,7 +784,7 @@
 
 		reply = (struct drbd_nl_cfg_reply *)
 			((struct cn_msg *)NLMSG_DATA(buffer))->data;
-		print_config_error(reply);
+		rv = print_config_error(reply);
 	}
 	free_tag_list(tl);
 



More information about the drbd-cvs mailing list