[Drbd-dev] DRBD8: Receive_state() won't dec_local after a disk failure on peer.

Montrose, Ernest Ernest.Montrose at stratus.com
Mon Jul 2 14:18:51 CEST 2007

Though this approach is really cute, it is error prone though.
Actually, the next guy that adds to the conditional might break us
again.  Maybe add a comment to say that the inc_local() must be last.
Hopefully the next guy will read it :)

-----Original Message-----
From: Philipp Reisner [mailto:philipp.reisner at linbit.com] 
Sent: Monday, July 02, 2007 5:58 AM
To: drbd-dev at linbit.com
Cc: Montrose, Ernest
Subject: Re: [Drbd-dev] DRBD8: Receive_state() won't dec_local after a
disk failure on peer.

On Friday 29 June 2007 23:40:45 Montrose, Ernest wrote:
> Hi all,
> We have been seeing a problem where a cluster of two systems, X and Y.
> X is Primary and gets a disk fault.  X goes Diskless.
> Y now is forced to be Primary.
> X recovers from the fault.
> But now Y gets a disk fault and goes Diskless but Stay Primary.
> At this point I/O from r0 hangs on Y!
> A check on /proc/<ip>/wchan for the worker thread reveals that we are
> waiting forever for local_cnt to become 0 in after_state_ch(). So the
> worker thread will process the Net_read.  What happened is that after
> the first failure on X, receive_state() on Y failed to call
> The pdisk received state is Diskless therefore we won't dec_local().
> included patch illustrates the problem and attempts to fix it.
> Thanks.
> EM--


I changed the patch to:

--- branches/drbd-8.0/drbd/drbd_receiver.c      2007-07-02 08:44:22 UTC
(rev 2962)
+++ branches/drbd-8.0/drbd/drbd_receiver.c      2007-07-02 09:54:58 UTC
(rev 2963)
@@ -2408,8 +2408,8 @@
        if (nconn == WFReportParams ) nconn = Connected;
        if (mdev->p_uuid && oconn <= Connected &&
-           inc_local_if_state(mdev,Negotiating) &&
-           peer_state.disk >= Negotiating) {
+           peer_state.disk >= Negotiating &&
+           inc_local_if_state(mdev,Negotiating) ) {
since C guarantees us the evaluate the right argument of && only if
the left argument is true.

: Dipl-Ing Philipp Reisner                      Tel +43-1-8178292-50 :
: LINBIT Information Technologies GmbH          Fax +43-1-8178292-82 :
: Vivenotgasse 48, 1120 Vienna, Austria        http://www.linbit.com :

More information about the drbd-dev mailing list