[DRBD-cvs] svn commit by phil - r2271 - in trunk: . drbd - Now
detach uses the "cluster wide" state change as well
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Wed Jul 12 10:08:57 CEST 2006
Author: phil
Date: 2006-07-12 10:08:55 +0200 (Wed, 12 Jul 2006)
New Revision: 2271
Modified:
trunk/ROADMAP
trunk/drbd/drbd_fs.c
trunk/drbd/drbd_main.c
trunk/drbd/drbd_receiver.c
Log:
Now detach uses the "cluster wide" state change as well...
Modified: trunk/ROADMAP
===================================================================
--- trunk/ROADMAP 2006-07-11 14:17:49 UTC (rev 2270)
+++ trunk/ROADMAP 2006-07-12 08:08:55 UTC (rev 2271)
@@ -727,14 +727,11 @@
Connected -> SyncSource in the cluster.
role <- primary
- disk <- inconsistent (conn <- SyncTarget) **
- pdsk <- inconsistent (conn <- SyncSource)
+ conn <- StartingSyncT (disk <- inconsistent)
+ conn <- StartingSyncS (pdsk <- inconsistent)
disk <- Diskless (as long as it happens as administrative command)
pdsk <- Outdated (= a 'disconnect' issued on a primary node)
- ** It is more feasable to make the change on disk/pdsk cluster
- wide atomic than working with the connection state.
-
* When a state change might sleep ( reuqest_state() ) and it is
to be cluster wide atomic ( pre_state_checks() determines this!).
1. Aquire the cluster state change lock (bit & waitqueue) ?
@@ -781,9 +778,9 @@
Evaluate if it is possible to use it for starting resync. (invalidate)
Evaluate it for the other cases...
- 80 % Is implemented. Changing the role to primary already uses this
+ 90 % Is implemented. Changing the role to primary already uses this
mechanism. Starting resync with invalidate and invalidate_remote
- now also uses this method.
+ now also uses this method. Detaching now also uses this mechanism.
34 Improve the initial hand-shake, to identify the sockets (and TCP-
links) by an initial message, and not only by the connection timming.
Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c 2006-07-11 14:17:49 UTC (rev 2270)
+++ trunk/drbd/drbd_fs.c 2006-07-12 08:08:55 UTC (rev 2271)
@@ -1070,14 +1070,9 @@
STATIC int drbd_detach_ioctl(drbd_dev *mdev)
{
- int interrupted,r;
- drbd_state_t os,ns;
+ int r;
- spin_lock_irq(&mdev->req_lock);
- os = mdev->state;
- r = _drbd_set_state(mdev,_NS(disk,Diskless),ChgStateVerbose);
- ns = mdev->state;
- spin_unlock_irq(&mdev->req_lock);
+ r = drbd_request_state(mdev,NS(disk,Diskless));
if( r == SS_NothingToDo ) { return 0; }
if( r < SS_Success ) {
@@ -1089,19 +1084,12 @@
/* since inc_local() only works as long as disk >= Inconsistent,
and it is Diskless here, local_cnt can only go down, it can
not increase... It will reach zero */
- interrupted = wait_event_interruptible(mdev->cstate_wait,
- !atomic_read(&mdev->local_cnt));
- if ( interrupted ) {
- drbd_force_state(mdev,NS(disk,os.disk));
- return -EINTR;
- }
+ wait_event(mdev->cstate_wait, !atomic_read(&mdev->local_cnt));
drbd_free_bc(mdev->bc); mdev->bc = NULL;
lc_free(mdev->resync); mdev->resync = NULL;
lc_free(mdev->act_log); mdev->act_log = NULL;
- after_state_ch(mdev, os, ns, ChgStateVerbose);
-
return 0;
}
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2006-07-11 14:17:49 UTC (rev 2270)
+++ trunk/drbd/drbd_main.c 2006-07-12 08:08:55 UTC (rev 2271)
@@ -540,7 +540,7 @@
( ( os.role != Primary && ns.role == Primary ) ||
( os.conn != StartingSyncT && ns.conn == StartingSyncT ) ||
( os.conn != StartingSyncS && ns.conn == StartingSyncS ) ||
- // ( os.disk != Diskless && ns.role == Diskless ) ||
+ ( os.disk != Diskless && ns.disk == Diskless ) ||
// ( os.conn != TearDown && ns.conn == TearDown ) ||
0
) );
@@ -951,7 +951,7 @@
dec_local(mdev);
}
- if(mdev->bc) {
+ if( ns.disk >= Inconsistent ) {
mdf = mdev->bc->md.flags & ~(MDF_Consistent|MDF_PrimaryInd|
MDF_ConnectedInd|MDF_WasUpToDate|
MDF_PeerOutDated );
@@ -960,7 +960,8 @@
if (mdev->state.conn > WFReportParams) mdf |= MDF_ConnectedInd;
if (mdev->state.disk > Inconsistent) mdf |= MDF_Consistent;
if (mdev->state.disk > Outdated) mdf |= MDF_WasUpToDate;
- if (mdev->state.pdsk <= Outdated) mdf |= MDF_PeerOutDated;
+ if (mdev->state.pdsk <= Outdated &&
+ mdev->state.pdsk >= Inconsistent) mdf |= MDF_PeerOutDated;
if( mdf != mdev->bc->md.flags) {
mdev->bc->md.flags = mdf;
@@ -1016,12 +1017,6 @@
}
}
- /* Removed disk, tell peer. */
- if ( os.disk >= Inconsistent && ns.disk == Diskless &&
- ns.conn >= Connected ) {
- drbd_send_state(mdev);
- }
-
/* We want to pause resync, tell peer. */
if ( ( os.aftr_isp == 0 && ns.aftr_isp == 1 ) ||
( os.user_isp == 0 && ns.user_isp == 1 ) ) {
@@ -1084,7 +1079,6 @@
drbd_bm_unlock(mdev);
}
-
/* it feels better to have the module_put last ... */
if ( (os.disk > Diskless || os.conn > StandAlone) &&
ns.disk == Diskless && ns.conn == StandAlone ) {
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2006-07-11 14:17:49 UTC (rev 2270)
+++ trunk/drbd/drbd_receiver.c 2006-07-12 08:08:55 UTC (rev 2271)
@@ -713,7 +713,7 @@
case HandShakeM:
if(msock) sock_release(msock);
msock = s;
- if(sock) set_bit(UNIQUE, &mdev->flags);
+ set_bit(UNIQUE, &mdev->flags);
break;
default:
WARN("Error receiving initial packet\n");
More information about the drbd-cvs
mailing list