[DRBD-cvs] svn commit by phil - r2951 - in trunk: . debian drbd
drbd/linux scripts user - Forwarded the 8.0.3 -> 8.0.4
changes to the trunk.
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Wed Jun 27 14:25:47 CEST 2007
Author: phil
Date: 2007-06-27 14:25:41 +0200 (Wed, 27 Jun 2007)
New Revision: 2951
Modified:
trunk/
trunk/ChangeLog
trunk/Makefile
trunk/debian/changelog
trunk/drbd.spec.in
trunk/drbd/drbd_actlog.c
trunk/drbd/drbd_int.h
trunk/drbd/drbd_main.c
trunk/drbd/drbd_nl.c
trunk/drbd/drbd_receiver.c
trunk/drbd/drbd_strings.c
trunk/drbd/linux/drbd.h
trunk/drbd/linux/drbd_config.h
trunk/drbd/linux/drbd_nl.h
trunk/scripts/drbd
trunk/user/drbdadm.h
trunk/user/drbdadm_adjust.c
trunk/user/drbdadm_main.c
trunk/user/drbdadm_parser.c
trunk/user/drbdmeta.c
trunk/user/drbdsetup.c
trunk/user/drbdtool_common.c
Log:
Forwarded the 8.0.3 -> 8.0.4 changes to the trunk.
Property changes on: trunk
___________________________________________________________________
Name: propagate:at:1
- 2902
+ 2950
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/ChangeLog 2007-06-27 12:25:41 UTC (rev 2951)
@@ -4,6 +4,25 @@
Cumulative changes since last tarball.
For even more detail, use "svn log" and "svn diff".
+8.0.4 (api:86/proto:86)
+--------
+ * Fixed an OOPS in case you do an invalidate on an diskless device. And
+ made invalidates on diskless devices possible by using drbdmeta.
+ * Fix for an possbile OOPS in drbd_al_to_on_disk_bm().
+ * Fix for a possible OOPS. This issue was triggered when you do an
+ attach very soon (ms) after the disk was dropped.
+ * Fix for a race condition in receive_state(). Symptom was that the
+ resync stalls at 100% on a node.
+ * Some block devices fail requests by clearing the BIO_UOTODATE flag
+ (that is ok), but not returning an error (that is strange).
+ We now deal with that correctly.
+ * Drbdadm's parser will now reject config files with resources with
+ missing "on" sections. (Instead of segfaulting)
+ * Init script continues in case the setup of a single resource failes.
+ * Improvements to the "drbdsetup events" interface: Updates about
+ the resync progress and initial state of all devices if called with "-a".
+ * The benchmark/dm program can now also create curstom bandwith loads.
+
8.0.3 (api:86/proto:86)
--------
* Fixed a race condition that could cause us to continue to traverse a bio
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/Makefile 2007-06-27 12:25:41 UTC (rev 2951)
@@ -172,6 +172,7 @@
all tools doc .filelist: drbd/drbd_buildtag.c
+export KDIR KVER O
KDIR := $(shell echo /lib/modules/`uname -r`/build)
KVER := $(shell KDIR=$(KDIR) O=$(O) scripts/get_uts_release.sh)
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/debian/changelog 2007-06-27 12:25:41 UTC (rev 2951)
@@ -1,3 +1,9 @@
+drbd8 (8.0.4-0) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Philipp Reisner <phil at linbit.com> Wed, 27 Jun 2007 10:0:00 +0200
+
drbd8 (8.0.3-0) unstable; urgency=low
* New upstream release.
Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/drbd/drbd_actlog.c 2007-06-27 12:25:41 UTC (rev 2951)
@@ -802,6 +802,7 @@
drbd_resync_finished(mdev);
drbd_bm_unlock(mdev);
}
+ drbd_bcast_sync_progress(mdev);
return 1;
}
Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/drbd/drbd_int.h 2007-06-27 12:25:41 UTC (rev 2951)
@@ -1414,6 +1414,7 @@
void drbd_nl_cleanup(void);
int __init drbd_nl_init(void);
void drbd_bcast_state(drbd_dev *mdev);
+void drbd_bcast_sync_progress(drbd_dev *mdev);
/*
* inline helper functions
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/drbd/drbd_main.c 2007-06-27 12:25:41 UTC (rev 2951)
@@ -587,8 +587,8 @@
if( ns.conn == Disconnecting && os.conn == StandAlone)
rv=SS_AlreadyStandAlone;
- if( ns.disk == Outdated && os.disk == Diskless)
- rv=SS_CanNotOutdateDL;
+ if( ns.disk > Attaching && os.disk == Diskless)
+ rv=SS_IsDiskLess;
return rv;
}
Modified: trunk/drbd/drbd_nl.c
===================================================================
--- trunk/drbd/drbd_nl.c 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/drbd/drbd_nl.c 2007-06-27 12:25:41 UTC (rev 2951)
@@ -691,7 +691,7 @@
struct inode *inode, *inode2;
struct lru_cache* resync_lru = NULL;
drbd_state_t ns,os;
- int rv;
+ int rv,ntries=0;
/* if you want to reconfigure, please tear down first */
if (mdev->state.disk > Diskless) {
@@ -699,6 +699,20 @@
goto fail;
}
+ /*
+ * We may have gotten here very quickly from a detach. Wait for a bit
+ * then fail.
+ */
+ while(mdev->bc != NULL) {
+ if(ntries++ >= 5) {
+ WARN("drbd_nl_disk_conf: mdev->bc not NULL.\n");
+ retcode=HaveDiskConfig;
+ goto fail;
+ }
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(HZ/10);
+ }
+
nbc = kmalloc(sizeof(struct drbd_backing_dev),GFP_KERNEL);
if(!nbc) {
retcode=KMallocFailed;
@@ -1239,7 +1253,7 @@
// The peer probabely wants to see us outdated.
retcode = _drbd_request_state(mdev,NS2(conn,Disconnecting,
disk,Outdated),0);
- if( retcode == SS_CanNotOutdateDL ) {
+ if( retcode == SS_IsDiskLess ) {
// We are diskless and our peer wants to outdate us.
// So, simply go away, and let the peer try to
// outdate us with its 'outdate-peer' handler later.
@@ -1732,6 +1746,56 @@
cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
}
+void drbd_bcast_sync_progress(drbd_dev *mdev)
+{
+ char buffer[sizeof(struct cn_msg)+
+ sizeof(struct drbd_nl_cfg_reply)+
+ sizeof(struct sync_progress_tag_len_struct)+
+ sizeof(short int)];
+ struct cn_msg *cn_reply = (struct cn_msg *) buffer;
+ struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply*)cn_reply->data;
+ unsigned short *tl = reply->tag_list;
+ int res;
+ unsigned long rs_left;
+
+ if (inc_local(mdev)) {
+ typecheck(unsigned long, mdev->rs_total);
+
+ rs_left = drbd_bm_total_weight(mdev) - mdev->rs_failed;
+ if (rs_left > mdev->rs_total) {
+ ERR("logic bug? rs_left=%lu > rs_total=%lu (rs_failed %lu)\n",
+ rs_left, mdev->rs_total, mdev->rs_failed);
+ res = 1000;
+ } else {
+ res = (rs_left >> 10)*1000/((mdev->rs_total >> 10) + 1);
+ }
+ dec_local(mdev);
+ res = 1000L - res;
+ *tl++ = T_sync_progress;
+ *tl++ = sizeof(int);
+ memcpy(tl, &res, sizeof(int));
+ tl=(unsigned short*)((char*)tl + sizeof(int));
+ }
+ *tl++ = TT_END; /* Close the tag list */
+
+ cn_reply->id.idx = CN_IDX_DRBD;
+ cn_reply->id.val = CN_VAL_DRBD;
+
+ cn_reply->seq = atomic_add_return(1,&drbd_nl_seq);
+ cn_reply->ack = 0; // not used here.
+ cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
+ (int)((char*)tl - (char*)reply->tag_list);
+ cn_reply->flags = 0;
+
+ reply->packet_type = P_sync_progress;
+ reply->minor = mdev_to_minor(mdev);
+ reply->ret_code = NoError;
+
+ TRACE(TraceTypeNl, TraceLvlSummary, nl_trace_reply(cn_reply););
+
+ cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
+}
+
#ifdef NETLINK_ROUTE6
int __init cn_init(void);
void __exit cn_fini(void);
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/drbd/drbd_receiver.c 2007-06-27 12:25:41 UTC (rev 2951)
@@ -2478,7 +2478,7 @@
STATIC int receive_state(drbd_dev *mdev, Drbd_Header *h)
{
Drbd_State_Packet *p = (Drbd_State_Packet*)h;
- drbd_conns_t nconn;
+ drbd_conns_t nconn,oconn;
drbd_state_t os,ns,peer_state;
int rv;
@@ -2486,12 +2486,16 @@
if (drbd_recv(mdev, h->payload, h->length) != h->length)
return FALSE;
- nconn = mdev->state.conn;
+ peer_state.i = be32_to_cpu(p->state);
+
+ spin_lock_irq(&mdev->req_lock);
+ retry:
+ oconn = nconn = mdev->state.conn;
+ spin_unlock_irq(&mdev->req_lock);
+
if (nconn == WFReportParams ) nconn = Connected;
- peer_state.i = be32_to_cpu(p->state);
-
- if (mdev->p_uuid && mdev->state.conn <= Connected &&
+ if (mdev->p_uuid && oconn <= Connected &&
inc_local_if_state(mdev,Negotiating) &&
peer_state.disk >= Negotiating) {
nconn=drbd_sync_handshake(mdev,peer_state.role,peer_state.disk);
@@ -2500,19 +2504,8 @@
if(nconn == conn_mask) return FALSE;
}
- if (mdev->state.conn > WFReportParams ) {
- if( nconn > Connected && peer_state.conn <= Connected) {
- // we want resync, peer has not yet decided to sync...
- drbd_send_uuids(mdev);
- drbd_send_state(mdev);
- }
- else if (nconn == Connected && peer_state.disk == Negotiating) {
- // peer is waiting for us to respond...
- drbd_send_state(mdev);
- }
- }
-
spin_lock_irq(&mdev->req_lock);
+ if( mdev->state.conn != oconn ) goto retry;
os = mdev->state;
ns.i = mdev->state.i;
ns.conn = nconn;
@@ -2525,15 +2518,28 @@
ns.pdsk == Negotiating ) ns.pdsk = UpToDate;
rv = _drbd_set_state(mdev,ns,ChgStateVerbose | ChgStateHard);
spin_unlock_irq(&mdev->req_lock);
- if (rv==SS_Success) {
- after_state_ch(mdev,os,ns,ChgStateVerbose | ChgStateHard);
- }
if(rv < SS_Success) {
drbd_force_state(mdev,NS(conn,Disconnecting));
return FALSE;
}
+ if (oconn > WFReportParams ) {
+ if( nconn > Connected && peer_state.conn <= Connected) {
+ // we want resync, peer has not yet decided to sync...
+ drbd_send_uuids(mdev);
+ drbd_send_state(mdev);
+ }
+ else if (nconn == Connected && peer_state.disk == Negotiating) {
+ // peer is waiting for us to respond...
+ drbd_send_state(mdev);
+ }
+ }
+
+ if (rv==SS_Success) {
+ after_state_ch(mdev,os,ns,ChgStateVerbose | ChgStateHard);
+ }
+
mdev->net_conf->want_lose = 0;
/* FIXME assertion for (gencounts do not diverge) */
Modified: trunk/drbd/drbd_strings.c
===================================================================
--- trunk/drbd/drbd_strings.c 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/drbd/drbd_strings.c 2007-06-27 12:25:41 UTC (rev 2951)
@@ -78,7 +78,8 @@
[-SS_ResyncRunning] = "Can not start resync since it is already active",
[-SS_AlreadyStandAlone] = "Can not disconnect a StandAlone device",
[-SS_CW_FailedByPeer] = "State changed was refused by peer node",
- [-SS_CanNotOutdateDL] = "Can not outdate a diskless device",
+ [-SS_IsDiskLess] =
+ "Device is diskless, the requesed operation requires a disk",
[-SS_DeviceInUse] = "Device is held open by someone"
};
Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/drbd/linux/drbd.h 2007-06-27 12:25:41 UTC (rev 2951)
@@ -210,7 +210,7 @@
SS_ResyncRunning=-8,
SS_AlreadyStandAlone=-9,
SS_CW_FailedByPeer=-10,
- SS_CanNotOutdateDL=-11,
+ SS_IsDiskLess=-11,
SS_DeviceInUse=-12
} set_st_err_t;
Modified: trunk/drbd/linux/drbd_config.h
===================================================================
--- trunk/drbd/linux/drbd_config.h 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/drbd/linux/drbd_config.h 2007-06-27 12:25:41 UTC (rev 2951)
@@ -22,7 +22,7 @@
extern const char * drbd_buildtag(void);
-#define REL_VERSION "8.0.3"
+#define REL_VERSION "8.0.4"
#define API_VERSION 86
#define PRO_VERSION 86
Modified: trunk/drbd/linux/drbd_nl.h
===================================================================
--- trunk/drbd/linux/drbd_nl.h 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/drbd/linux/drbd_nl.h 2007-06-27 12:25:41 UTC (rev 2951)
@@ -94,6 +94,10 @@
PACKET(create, 21, )
PACKET(remove, 22, )
+PACKET(sync_progress, 23,
+ INTEGER( 43, T_MAY_IGNORE, sync_progress)
+)
+
#undef PACKET
#undef INTEGER
#undef INT64
Modified: trunk/drbd.spec.in
===================================================================
--- trunk/drbd.spec.in 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/drbd.spec.in 2007-06-27 12:25:41 UTC (rev 2951)
@@ -191,6 +191,25 @@
/sbin/depmod -a -F /boot/System.map-%{kernelversion} %{kernelversion} >/dev/null 2>&1 || true
%changelog
+* Wed Jun 27 2007 10:00:00 +0200 Philipp Reisner <phil at linbit.com>
+- drbd (8.0.4-1)
+ * Fixed an OOPS in case you do an invalidate on an diskless device. And
+ made invalidates on diskless devices possible by using drbdmeta.
+ * Fix for an possbile OOPS in drbd_al_to_on_disk_bm().
+ * Fix for a possible OOPS. This issue was triggered when you do an
+ attach very soon (ms) after the disk was dropped.
+ * Fix for a race condition in receive_state(). Symptom was that the
+ resync stalls at 100% on a node.
+ * Some block devices fail requests by clearing the BIO_UOTODATE flag
+ (that is ok), but not returning an error (that is strange).
+ We now deal with that correctly.
+ * Drbdadm's parser will now reject config files with resources with
+ missing "on" sections. (Instead of segfaulting)
+ * Init script continues in case the setup of a single resource failes.
+ * Improvements to the "drbdsetup events" interface: Updates about
+ the resync progress and initial state of all devices if called with "-a".
+ * The benchmark/dm program can now also create curstom bandwith loads.
+
* Mon May 7 2007 17:10:14 +0200 Philipp Reisner <phil at linbit.com>
- drbd (8.0.3-1)
* Fixed a race condition that could cause us to continue to traverse a bio
Modified: trunk/scripts/drbd
===================================================================
--- trunk/scripts/drbd 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/scripts/drbd 2007-06-27 12:25:41 UTC (rev 2951)
@@ -61,7 +61,7 @@
fi
IFS=$IFS_O
$CMD || {
- echo -e "\ncmd $CMD failed!"; exit 20
+ echo -e "\ncmd $CMD failed - continuing!\n"
}
IFS=$NEWLINE
done
Modified: trunk/user/drbdadm.h
===================================================================
--- trunk/user/drbdadm.h 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/user/drbdadm.h 2007-06-27 12:25:41 UTC (rev 2951)
@@ -120,6 +120,14 @@
extern void convert_discard_opt(struct d_resource* res);
extern void convert_after_option(struct d_resource* res);
+enum pr_flags {
+ ThisHRequired = 1,
+ PeerHRequired = 2,
+ BothHRequired = ThisHRequired | PeerHRequired,
+ NoneHAllowed = 4,
+};
+extern struct d_resource* parse_resource(char*, enum pr_flags);
+
extern char* config_file;
extern int config_valid;
extern struct d_resource* config;
Modified: trunk/user/drbdadm_adjust.c
===================================================================
--- trunk/user/drbdadm_adjust.c 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/user/drbdadm_adjust.c 2007-06-27 12:25:41 UTC (rev 2951)
@@ -39,7 +39,6 @@
#include "drbdtool_common.h"
extern FILE* yyin;
-extern struct d_resource* parse_resource(char*);
static FILE *m_popen(int *pid,char** argv)
{
@@ -184,7 +183,7 @@
line = 1;
sprintf(config_file_dummy,"drbdsetup %s show", res->me->device);
config_file = config_file_dummy;
- running = parse_resource(config_file_dummy);
+ running = parse_resource(config_file_dummy, 0);
fclose(yyin);
waitpid(pid,0,0);
Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/user/drbdadm_main.c 2007-06-27 12:25:41 UTC (rev 2951)
@@ -208,7 +208,7 @@
{ "down", adm_generic_s, 1,1,0 },
{ "primary", adm_generic_s, 1,1,0 },
{ "secondary", adm_generic_s, 1,1,0 },
- { "invalidate", adm_generic_l, 1,1,0 },
+ { "invalidate", adm_generic_b, 1,1,0 },
{ "invalidate-remote", adm_generic_l, 1,1,1 },
{ "outdate", adm_generic_b, 1,1,0 },
{ "resize", adm_resize, 1,1,1 },
Modified: trunk/user/drbdadm_parser.c
===================================================================
--- trunk/user/drbdadm_parser.c 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/user/drbdadm_parser.c 2007-06-27 12:25:41 UTC (rev 2951)
@@ -504,7 +504,7 @@
parse_host_body(host,res,0);
}
-struct d_resource* parse_resource(char* res_name)
+struct d_resource* parse_resource(char* res_name, enum pr_flags flags)
{
struct d_resource* res;
int token;
@@ -558,12 +558,43 @@
break;
case '}':
case 0:
- return res;
+ goto exit_loop;
default:
pe_expected_got("protocol | on | disk | net | syncer |"
" startup | handler",token);
}
}
+
+ exit_loop:
+ if(flags & ThisHRequired && !res->me) {
+ config_valid = 0;
+
+ fprintf(stderr,
+ "%s:%d: in resource %s, there is no host section"
+ " for this host.\n"
+ "\tMissing 'on %s {...}' ?\n",
+ config_file, c_section_start, res->name,
+ nodeinfo.nodename);
+ }
+ if(flags & PeerHRequired && !res->peer) {
+ config_valid = 0;
+
+ fprintf(stderr,
+ "%s:%d: in resource %s, there is no host section"
+ " for the peer host.\n"
+ "\tMissing 'on <peer-name> {...}' ?\n",
+ config_file, c_section_start, res->name);
+ }
+ if(flags == NoneHAllowed && ( res->me || res->peer ) ) {
+ config_valid = 0;
+
+ fprintf(stderr,
+ "%s:%d: in the %s section, there are no host sections"
+ " allowed.\n",
+ config_file, c_section_start, res->name);
+ }
+
+ return res;
}
void my_parse(void)
@@ -578,12 +609,13 @@
break;
case TK_COMMON:
EXP('{');
- common = parse_resource("common");
+ common = parse_resource("common",NoneHAllowed);
break;
case TK_RESOURCE:
EXP(TK_STRING);
EXP('{');
- config = APPEND(config, parse_resource(yylval.txt));
+ config=APPEND(config,
+ parse_resource(yylval.txt,BothHRequired));
break;
case TK_SKIP:
parse_skip();
Modified: trunk/user/drbdmeta.c
===================================================================
--- trunk/user/drbdmeta.c 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/user/drbdmeta.c 2007-06-27 12:25:41 UTC (rev 2951)
@@ -324,6 +324,7 @@
void (*show_gi) (struct md_cpu *md);
void (*set_gi) (struct md_cpu *md, char **argv, int argc);
int (*outdate_gi) (struct md_cpu *md);
+ int (*invalidate_gi) (struct md_cpu *md);
};
void *my_mmap(const char* func, const unsigned int line, const char* what,
@@ -661,10 +662,12 @@
void m_show_gc(struct md_cpu *md);
void m_set_gc(struct md_cpu *md, char **argv, int argc);
int m_outdate_gc(struct md_cpu *md);
+int m_invalidate_gc(struct md_cpu *md);
void m_get_uuid(struct md_cpu *md);
void m_show_uuid(struct md_cpu *md);
void m_set_uuid(struct md_cpu *md, char **argv, int argc);
int m_outdate_uuid(struct md_cpu *md);
+int m_invalidate_uuid(struct md_cpu *md);
int v06_md_close(struct format *cfg);
int v06_md_cpu_to_disk(struct format *cfg);
@@ -705,6 +708,7 @@
.show_gi = m_show_gc,
.set_gi = m_set_gc,
.outdate_gi = m_outdate_gc,
+ .invalidate_gi = m_invalidate_gc,
},
[Drbd_07] = {
.name = "v07",
@@ -720,6 +724,7 @@
.show_gi = m_show_gc,
.set_gi = m_set_gc,
.outdate_gi = m_outdate_gc,
+ .invalidate_gi = m_invalidate_gc,
},
[Drbd_08] = {
.name = "v08",
@@ -735,6 +740,7 @@
.show_gi = m_show_uuid,
.set_gi = m_set_uuid,
.outdate_gi = m_outdate_uuid,
+ .invalidate_gi = m_invalidate_uuid,
},
};
@@ -774,6 +780,7 @@
int meta_create_md(struct format *cfg, char **argv, int argc);
int meta_wipe_md(struct format *cfg, char **argv, int argc);
int meta_outdate(struct format *cfg, char **argv, int argc);
+int meta_invalidate(struct format *cfg, char **argv, int argc);
int meta_set_gi(struct format *cfg, char **argv, int argc);
int meta_read_dev_uuid(struct format *cfg, char **argv, int argc);
int meta_write_dev_uuid(struct format *cfg, char **argv, int argc);
@@ -787,6 +794,7 @@
{"create-md", 0, meta_create_md, 1},
{"wipe-md", 0, meta_wipe_md, 1},
{"outdate", 0, meta_outdate, 1},
+ {"invalidate", 0, meta_invalidate, 1},
{"dstate", 0, meta_dstate, 1},
{"read-dev-uuid", "VAL", meta_read_dev_uuid, 0},
{"write-dev-uuid", "VAL", meta_write_dev_uuid, 0},
@@ -1151,7 +1159,22 @@
}
+int m_invalidate_gc(struct md_cpu *md)
+{
+ md->gc[Flags] &= ~MDF_Consistent;
+ return 5;
+}
+
+int m_invalidate_uuid(struct md_cpu *md)
+{
+ md->flags &= ~MDF_Consistent;
+ md->flags &= ~MDF_WasUpToDate;
+
+ return 0;
+}
+
+
/******************************************
begin of v06 {{{
******************************************/
@@ -2205,7 +2228,26 @@
return err;
}
+int meta_invalidate(struct format *cfg, char **argv __attribute((unused)), int argc)
+{
+ int err;
+ if (argc > 0) {
+ fprintf(stderr, "Ignoring additional arguments\n");
+ }
+
+ if (cfg->ops->open(cfg))
+ return -1;
+
+ cfg->ops->invalidate_gi(&cfg->md);
+ err = cfg->ops->md_cpu_to_disk(cfg);
+ err = cfg->ops->close(cfg) || err; // <- close always
+ if (err)
+ fprintf(stderr, "update failed\n");
+
+ return err;
+}
+
#if 0
int meta_set_size(struct format *cfg, char **argv, int argc)
{
Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/user/drbdsetup.c 2007-06-27 12:25:41 UTC (rev 2951)
@@ -1195,7 +1195,12 @@
{
drbd_state_t state;
char* str;
+ int synced = 0;
+ /* Ignore error replies */
+ if (reply->ret_code != NoError)
+ return 1;
+
switch (reply->packet_type) {
case P_get_state:
if(consume_tag_int(T_state_i,reply->tag_list,(int*)&state.i)) {
@@ -1218,11 +1223,22 @@
printf("%u UH %d %s\n", seq, reply->minor, str);
} else fprintf(stderr,"Missing tag !?\n");
break;
+ case P_sync_progress:
+ if (consume_tag_int(T_sync_progress, reply->tag_list, &synced)) {
+ printf("%u SP %d %i.%i\n",
+ seq,
+ reply->minor,
+ synced / 10,
+ synced % 10);
+ } else fprintf(stderr,"Missing tag !?\n");
+ break;
default:
printf("%u ?? %d <other message>\n",seq, reply->minor);
break;
}
+ fflush(stdout);
+
return 1;
}
@@ -1262,7 +1278,7 @@
struct drbd_tag_list *tl;
struct option *lo;
unsigned int seq=0;
- int sk_nl,c,cont=1,rr;
+ int sk_nl,c,cont=1,rr,i,last;
int unfiltered=0, all_devices=0;
int wfc_timeout=0, degr_wfc_timeout=0,timeout_ms;
struct timeval before,after;
@@ -1321,11 +1337,22 @@
timeout_ms= 1000 * ( rr ? degr_wfc_timeout : wfc_timeout) - 1;
// ask for the current state before waiting for state updates...
- tl->drbd_p_header->packet_type = P_get_state;
- tl->drbd_p_header->drbd_minor = minor;
- tl->drbd_p_header->flags = 0;
- send_cn(sk_nl,tl->nl_header,(char*)tl->tag_list_cpos-(char*)tl->nl_header);
+ if (all_devices) {
+ i = 0;
+ last = 255;
+ }
+ else {
+ i = last = minor;
+ }
+ while (i <= last) {
+ tl->drbd_p_header->packet_type = P_get_state;
+ tl->drbd_p_header->drbd_minor = i;
+ tl->drbd_p_header->flags = 0;
+ send_cn(sk_nl,tl->nl_header,(char*)tl->tag_list_cpos-(char*)tl->nl_header);
+ i++;
+ }
+
dt_unlock_drbd(lock_fd);
lock_fd=-1;
Modified: trunk/user/drbdtool_common.c
===================================================================
--- trunk/user/drbdtool_common.c 2007-06-27 12:16:04 UTC (rev 2950)
+++ trunk/user/drbdtool_common.c 2007-06-27 12:25:41 UTC (rev 2951)
@@ -338,7 +338,7 @@
"\n"
" +--< Current data generation UUID >-\n"
" | +--< Bitmap's base data generation UUID >-\n"
-" | | +--< younger historiy UUID >-\n"
+" | | +--< younger history UUID >-\n"
" | | | +-< older history >-\n"
" V V V V\n");
dt_print_uuids(uuid, flags);
More information about the drbd-cvs
mailing list