[DRBD-cvs] r1659 - branches/drbd-0.7/drbd
svn at svn.drbd.org
svn at svn.drbd.org
Fri Nov 26 15:46:13 CET 2004
Author: phil
Date: 2004-11-26 15:46:08 +0100 (Fri, 26 Nov 2004)
New Revision: 1659
Modified:
branches/drbd-0.7/drbd/drbd_int.h
branches/drbd-0.7/drbd/drbd_main.c
branches/drbd-0.7/drbd/drbd_receiver.c
Log:
The test for (rs_total != 0) was not okay. If sync was
started with the "invalidate" command on the Secondary,
it (rs_total) is set to a positive value, just after we
send the BecomeSyncSource packet to the peer.
The peer(Primary) writes its whole bitmap and sets
rs_total to a positive value afterwards.
Writes that happen on the Primary while it writes its
bitmap are mirrored to the Secondary (where they are
mared as cean in the BitMap, since rs_total is already
set here), but when the ACK comes back to the Primary
rs_total is still 0 here.
With this patch that problem is fixed, they both consider
the sync to be started when the SYNC_STARTED bit is
set on both node, and this happens with the first
ACK of the fir RSDATA packet... So the agree on the
same logic point in time.
Modified: branches/drbd-0.7/drbd/drbd_int.h
===================================================================
--- branches/drbd-0.7/drbd/drbd_int.h 2004-11-26 13:54:36 UTC (rev 1658)
+++ branches/drbd-0.7/drbd/drbd_int.h 2004-11-26 14:46:08 UTC (rev 1659)
@@ -692,6 +692,7 @@
MD_IO_ALLOWED, // EXPLAIN
SENT_DISK_FAILURE, // sending it once is enough
MD_DIRTY, // current gen counts and flags not yet on disk
+ SYNC_STARTED, // Needed to agree on the exact point in time..
};
struct drbd_bitmap; // opaque for Drbd_Conf
Modified: branches/drbd-0.7/drbd/drbd_main.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_main.c 2004-11-26 13:54:36 UTC (rev 1658)
+++ branches/drbd-0.7/drbd/drbd_main.c 2004-11-26 14:46:08 UTC (rev 1659)
@@ -466,6 +466,7 @@
* if ( ( os==SyncSource || os==SyncTarget ) && ns <= Connected ) {
*/
if ( ( os >= SyncSource ) && ns <= Connected ) {
+ clear_bit(SYNC_STARTED,&mdev->flags);
set_bit(STOP_SYNC_TIMER,&mdev->flags);
mod_timer(&mdev->resync_timer,jiffies);
}
Modified: branches/drbd-0.7/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_receiver.c 2004-11-26 13:54:36 UTC (rev 1658)
+++ branches/drbd-0.7/drbd/drbd_receiver.c 2004-11-26 14:46:08 UTC (rev 1659)
@@ -901,6 +901,7 @@
*/
}
ok = drbd_send_ack(mdev,WriteAck,e);
+ __set_bit(SYNC_STARTED,&mdev->flags);
} else {
ok = drbd_send_ack(mdev,NegAck,e);
ok&= drbd_io_error(mdev);
@@ -1021,7 +1022,7 @@
if(mdev->conf.wire_protocol == DRBD_PROT_C) {
if(likely(drbd_bio_uptodate(&e->private_bio))) {
ok=drbd_send_ack(mdev,WriteAck,e);
- if (ok && mdev->rs_total)
+ if (ok && test_bit(SYNC_STARTED,&mdev->flags) )
drbd_set_in_sync(mdev,sector,drbd_ee_get_size(e));
} else {
ok = drbd_send_ack(mdev,NegAck,e);
@@ -2037,6 +2038,7 @@
if( is_syncer_blk(mdev,p->block_id)) {
drbd_set_in_sync(mdev,sector,blksize);
+ __set_bit(SYNC_STARTED,&mdev->flags);
} else {
req=(drbd_request_t*)(long)p->block_id;
@@ -2044,7 +2046,7 @@
drbd_end_req(req, RQ_DRBD_SENT, 1, sector);
- if (mdev->rs_total &&
+ if (test_bit(SYNC_STARTED,&mdev->flags) &&
mdev->conf.wire_protocol == DRBD_PROT_C)
drbd_set_in_sync(mdev,sector,blksize);
}
More information about the drbd-cvs
mailing list