[DRBD-cvs] svn commit by phil - r2134 - in trunk: . drbd drbd/linux
user - Added a fallback mechanism to unfreeze IO on a device i
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Thu Apr 6 13:03:39 CEST 2006
Author: phil
Date: 2006-04-06 13:03:37 +0200 (Thu, 06 Apr 2006)
New Revision: 2134
Modified:
trunk/ROADMAP
trunk/drbd/drbd_fs.c
trunk/drbd/drbd_strings.c
trunk/drbd/linux/drbd.h
trunk/user/drbdadm_main.c
trunk/user/drbdsetup.c
Log:
Added a fallback mechanism to unfreeze IO on a device in case
the "outdate-peer" handler fails miserably.
drbdadm suspend-io res
For sake of completness, it added "drbdadm resume-io res" as well.
Modified: trunk/ROADMAP
===================================================================
--- trunk/ROADMAP 2006-04-06 10:12:51 UTC (rev 2133)
+++ trunk/ROADMAP 2006-04-06 11:03:37 UTC (rev 2134)
@@ -195,9 +195,7 @@
* We need to store the fact that the peer is outdated/inconsistent
in the meta-data. To allow an stand allone primary to be rebooted.
- 80% DONE
- The only missing thing is a fallback mechanism to unfreeze
- IO in case the script failed.
+ 99% DONE
8 New command drbdmeta
Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c 2006-04-06 10:12:51 UTC (rev 2133)
+++ trunk/drbd/drbd_fs.c 2006-04-06 11:03:37 UTC (rev 2134)
@@ -1185,7 +1185,7 @@
int drbd_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
- int r,minor,err=0;
+ int r,minor,err=0,io_suspend=0;
long time;
struct Drbd_Conf *mdev;
struct ioctl_wait* wp;
@@ -1462,6 +1462,17 @@
case DRBD_IOCTL_RESUME_SYNC:
if(!drbd_resync_resume(mdev, UserImposed)) err = -EINPROGRESS;
break;
+
+ case DRBD_IOCTL_SUSPEND_IO:
+ io_suspend=1;
+ case DRBD_IOCTL_RESUME_IO:
+ r = drbd_request_state(mdev,NS(susp,io_suspend));
+ if( r < SS_Success ) {
+ err = put_user(r, (int *) arg);
+ if(!err) err=-EIO;
+ else err=-EINVAL;
+ }
+ break;
default:
err = -EINVAL;
Modified: trunk/drbd/drbd_strings.c
===================================================================
--- trunk/drbd/drbd_strings.c 2006-04-06 10:12:51 UTC (rev 2133)
+++ trunk/drbd/drbd_strings.c 2006-04-06 11:03:37 UTC (rev 2134)
@@ -64,7 +64,6 @@
[-SS_TowPrimaries] = "Multiple primaries now allowed by config",
[-SS_NoConsistnetDisk] =
"Refusing to be Primary without at least one consistent disk",
- [-SS_REMOVE_ME] = "Refusing to make peer Primary without disk",
[-SS_BothInconsistent] = "Refusing to be inconsistent on both nodes",
[-SS_SyncingDiskless] = "Refusing to be syncing and diskless",
[-SS_ConnectedOutdates] = "Refusing to be Outdated while Connected",
Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h 2006-04-06 10:12:51 UTC (rev 2133)
+++ trunk/drbd/linux/drbd.h 2006-04-06 11:03:37 UTC (rev 2134)
@@ -265,7 +265,6 @@
SS_UnknownError=0,
SS_TowPrimaries=-1,
SS_NoConsistnetDisk=-2,
- SS_REMOVE_ME=-3,
SS_BothInconsistent=-4,
SS_SyncingDiskless=-5,
SS_ConnectedOutdates=-6,
@@ -361,6 +360,8 @@
#define DRBD_IOCTL_GET_UUIDS _IOR( DRBD_IOCTL_LETTER, 0x16, struct ioctl_get_uuids )
#define DRBD_IOCTL_PAUSE_SYNC _IO ( DRBD_IOCTL_LETTER, 0x17)
#define DRBD_IOCTL_RESUME_SYNC _IO ( DRBD_IOCTL_LETTER, 0x18)
+#define DRBD_IOCTL_SUSPEND_IO _IOW( DRBD_IOCTL_LETTER, 0x19, int )
+#define DRBD_IOCTL_RESUME_IO _IOW( DRBD_IOCTL_LETTER, 0x1A, int )
#endif
Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c 2006-04-06 10:12:51 UTC (rev 2133)
+++ trunk/user/drbdadm_main.c 2006-04-06 11:03:37 UTC (rev 2134)
@@ -215,6 +215,8 @@
{ "pri-lost-after-sb", adm_khelper, 3,1,0 },
{ "outdate-peer", adm_khelper, 3,1,0 },
{ "set-gi", admm_generic, 4,1,0 },
+ { "suspend-io", adm_generic_s, 4,1,0 },
+ { "resume-io", adm_generic_s, 4,1,0 },
};
/*** These functions are used to the print the config ***/
Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c 2006-04-06 10:12:51 UTC (rev 2133)
+++ trunk/user/drbdsetup.c 2006-04-06 11:03:37 UTC (rev 2134)
@@ -126,7 +126,10 @@
int cmd_dstate(int drbd_fd,char** argv,int argc,struct option *options);
int cmd_show_gi(int drbd_fd,char** argv,int argc,struct option *options);
int cmd_get_gi(int drbd_fd,char** argv,int argc,struct option *options);
+int cmd_suspend_io(int drbd_fd,char** argv,int argc,struct option *options);
+int cmd_resume_io(int drbd_fd,char** argv,int argc,struct option *options);
+
struct drbd_cmd commands[] = {
{"primary", cmd_primary, 0,
(struct option[]) {
@@ -194,6 +197,8 @@
{"show-gi", cmd_show_gi, 0, 0, },
{"get-gi", cmd_get_gi, 0, 0, },
{"show", cmd_show, 0, 0, },
+ {"suspend-io", cmd_suspend_io, 0, 0, },
+ {"resume-io", cmd_resume_io, 0, 0, },
};
const char *eh_names[] = {
@@ -1505,6 +1510,46 @@
return 0;
}
+int cmd_suspend_io(int drbd_fd,char** argv __attribute((unused)),int argc __attribute((unused)),struct option *options __attribute((unused)))
+{
+ int err;
+ int reason;
+
+ err=ioctl(drbd_fd,DRBD_IOCTL_SUSPEND_IO, &reason);
+ if(err)
+ {
+ err=errno;
+ PERROR("ioctl(,DRBD_IOCTL_SUSPEND_IO) failed");
+ if(err==EIO)
+ {
+ fprintf(stderr,"%s\n",set_st_err_name(reason));
+ }
+ return 20;
+ }
+
+ return 0;
+}
+
+int cmd_resume_io(int drbd_fd,char** argv __attribute((unused)),int argc __attribute((unused)),struct option *options __attribute((unused)))
+{
+ int err;
+ int reason;
+
+ err=ioctl(drbd_fd,DRBD_IOCTL_RESUME_IO, &reason);
+ if(err)
+ {
+ err=errno;
+ PERROR("ioctl(,DRBD_IOCTL_RESUME_IO) failed");
+ if(err==EIO)
+ {
+ fprintf(stderr,"%s\n",set_st_err_name(reason));
+ }
+ return 20;
+ }
+
+ return 0;
+}
+
int main(int argc, char** argv)
{
int drbd_fd;
More information about the drbd-cvs
mailing list