Skip to contentSkip to conversation

DRBD-8.1

Drbd-dev Philipp Reisner 2 participants 9 messages May 18, 2007 – Jun 12, 2007 DRBD driver

lore
Share & tools
lore

Philipp Reisner

author maintainer
#0 lore raw

Hi There,

There are a number of patches and minor features to get integrated into drbd-8. Therefore I copied over the trunk to branches/drbd-8.0.

We will integrate bugfixes in the 8.0 branch, and do the new features in the trunk which will be released as 8.1 when it is ready. (The bugfixes get merged from 8.0 to 8.1 with the svnp tool)

8.0 and 8.1 will be write protocol compatible. (If the netlink protocol will be compatible as well will turn out during the merge of the "many devices patch".)

-Phil

Signature · 3 lines
: 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 :
#1 lore raw

[Drbd-dev] Resync Stalls at 100% patch problem

Phil,
Unfortunately it seems like the patch for receive_state() in drbd_receive.c has a problem. Acquiring the req_lock at the top of this routine causes the cstate machine to get confused. To reproduce this just do:
Drbdadm detach d0;sleep 3;drbdadm attach d0 for instance. One side ends up WBTmpT and the other WbitmapS and deadlock. I am researching more but wanted to let you. If I just remove the early lock then things are OK..:(

EM--

#2 lore raw

RE: [Drbd-dev] Resync Stalls at 100% patch problem

BTW, I forgot to say that this happens only if one of the nodes is st:
Primary/Secondary.

EM--

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Montrose, Ernest
Sent: Tuesday, June 05, 2007 6:50 PM
To: Philipp Reisner; [email protected]
Subject: [Drbd-dev] Resync Stalls at 100% patch problem

Phil,
Unfortunately it seems like the patch for receive_state() in drbd_receive.c has a problem. Acquiring the req_lock at the top of this routine causes the cstate machine to get confused. To reproduce this just do:
Drbdadm detach d0;sleep 3;drbdadm attach d0 for instance. One side ends up WBTmpT and the other WbitmapS and deadlock. I am researching more but wanted to let you. If I just remove the early lock then things are OK..:(

EM--
_______________________________________________
drbd-dev mailing list
[email protected]
http://lists.linbit.com/mailman/listinfo/drbd-dev

#3 lore raw

RE: [Drbd-dev] Resync Stalls at 100% patch problem

In reply to Montrose, Ernest

Phil,
I looked into the patch issue a bit more.
This problem happens if we acquire the req_lock early. What I think is going on is this:

Primary host ---->attach---> send_state()
Peer -----> receive_state()-->after_state_ch()-->send_bitmap() Primary Host ---->receive_bitmap()***Unexpected cstate "Connected" Peer ----> send_state()
Primary Host --->receive_state() and we are deadlock.

The primary host is receiving the bitmap too early. Essentially the peer should call send_state() before calling after_state_ch()

I noticed the patch had moved that logic after calling after_state_ch() so moving it back before after_state_ch() should be OK. Any reason why it was moved down?

I tested the included patch that moved just before we call after_state_ch().
Let me know.

Thanks.

EM--

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Montrose, Ernest
Sent: Tuesday, June 05, 2007 6:50 PM
To: Philipp Reisner; [email protected]
Subject: [Drbd-dev] Resync Stalls at 100% patch problem

Phil,
Unfortunately it seems like the patch for receive_state() in drbd_receive.c has a problem. Acquiring the req_lock at the top of this routine causes the cstate machine to get confused. To reproduce this just do:
Drbdadm detach d0;sleep 3;drbdadm attach d0 for instance. One side ends up WBTmpT and the other WbitmapS and deadlock. I am researching more but wanted to let you. If I just remove the early lock then things are OK..:(

EM--
_______________________________________________
drbd-dev mailing list
[email protected]
http://lists.linbit.com/mailman/listinfo/drbd-dev

drbd_receiver.c +12 -13
Index: drbd_receiver.c
===================================================================
@@ -2431,7 +2431,18 @@
 	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 (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);
+             }
+          }
+          after_state_ch(mdev,os,ns,ChgStateVerbose | ChgStateHard);
 	}
 
 	if(rv < SS_Success) {
@@ -2439,18 +2450,6 @@
 		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);
-		}
-	}
-
 	mdev->net_conf->want_lose = 0;
 
 	/* FIXME assertion for (gencounts do not diverge) */
author maintainer
#4 lore raw

Re: [Drbd-dev] Resync Stalls at 100% patch problem

Quoted 14 lines · Ernest

Phil,
I looked into the patch issue a bit more.
This problem happens if we acquire the req_lock early. What I think is going on is this:

Primary host ---->attach---> send_state()
Peer -----> receive_state()-->after_state_ch()-->send_bitmap() Primary Host ---->receive_bitmap()***Unexpected cstate "Connected" Peer ----> send_state()
Primary Host --->receive_state() and we are deadlock.

The primary host is receiving the bitmap too early. Essentially the peer should call send_state() before calling after_state_ch()

Quoted 8 lines

I noticed the patch had moved that logic after calling after_state_ch() so moving it back before after_state_ch() should be OK. Any reason why it was moved down?

I tested the included patch that moved just before we call after_state_ch().
Let me know.

Hi Ernest,

Sorry for the slow responses recently. We had a public holiday here, and I was out in the mountains...

I have now committed a patch very similar to your suggestion.

-phil

Signature · 3 lines
: 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 :
#5 lore raw

RE: [Drbd-dev] Resync Stalls at 100% patch problem

Phil,
Ah! Vacation.. I will test it out and let you know if I find any issues.

Thanks!

EM--

-----Original Message-----
From: Philipp Reisner [mailto:[email protected]]
Sent: Friday, June 08, 2007 5:51 AM
To: [email protected]
Cc: Montrose, Ernest
Subject: Re: [Drbd-dev] Resync Stalls at 100% patch problem

Quoted 3 lines · Ernest

Phil,
I looked into the patch issue a bit more.
This problem happens if we acquire the req_lock early. What I think

is

Quoted 8 lines

going on is this:

Primary host ---->attach---> send_state()
Peer -----> receive_state()-->after_state_ch()-->send_bitmap() Primary Host ---->receive_bitmap()***Unexpected cstate "Connected" Peer ----> send_state()
Primary Host --->receive_state() and we are deadlock.

Quoted 4 lines

The primary host is receiving the bitmap too early. Essentially the peer should call send_state() before calling after_state_ch()

I noticed the patch had moved that logic after calling

after_state_ch()

Quoted 1 line

so moving it back before after_state_ch() should be OK. Any reason

why

Quoted 6 lines

it was moved down?

I tested the included patch that moved just before we call after_state_ch().
Let me know.

Hi Ernest,

Sorry for the slow responses recently. We had a public holiday here, and I was out in the mountains...

I have now committed a patch very similar to your suggestion.

-phil

Signature · 3 lines
: 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 :
#6 lore raw

[Drbd-dev] DRBD8: Panic in drbd_uuid_compare due to mdev->bc being null

In reply to Philipp Reisner

Hi all,

We are seeing a panic that occurs while syncing. Essentially if you are primary and you are syncing and get an io error then on the next attach you can panic. Especially if that attach happens quickly after the detach.

I think what's happening is this:
* The local disk dies and we transiton to "Diskless"
* After_state_ch() suppose to call drbd_free_bc() to free mdev->bc.
* But before we can free mdev->bc, mdev->local_cnt would have to be 0, in this case it was not. Not too sure why. So we wait for mdev->local_cnt to become 0.
* While waiting an "Attach" request comes in. We ASSERT that mdev->bc is not NULL but we brush it off, set a new bc and leak the old.
* The wait in after_state_ch is now over. we free the new mdev->bc that the "attach" had set.
* we call drbd_sync_handshake(), access a NULL mdev->bc and we die.

A quick thing to do is to just fail the attach request if mdev->bc is not null. Patch included

EM--

drbd_nl.c +18 -1
Index: drbd/drbd_nl.c
===================================================================
@@ -676,7 +676,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) {
@@ -684,6 +684,23 @@
 		goto fail;
 	}
 
+       /* 
+        * We may have gotten here very quickly from a detach. Wait for a bit
+        * then fail.
+        */
+       while(mdev->bc != NULL && ntries <= 5) {
+          if(ntries == 5) 
+          {
+             WARN("drbd_nl_disk_conf: mdev->bc not NULL. Giving up!\n");
+             retcode=HaveDiskConfig;
+             goto fail;
+          }
+          WARN("drbd_nl_disk_conf: mdev->bc not NULL. Waiting..\n");
+          set_current_state(TASK_INTERRUPTIBLE);
+          schedule_timeout(HZ/10);
+          ++ntries;
+       }/*End while*/
+
 	nbc = kmalloc(sizeof(struct drbd_backing_dev),GFP_KERNEL);
 	if(!nbc) {
 		retcode=KMallocFailed;
#7 lore raw

RE: [Drbd-dev] DRBD8: Panic in drbd_uuid_compare due to mdev->bc beingnull

O! BTW,
Here is the stack trace for the panic:

May 25 05:42:49 chobs kernel: drbd1: disk( Diskless -> Attaching ) 
May 25 05:42:49 chobs kernel: drbd1: Found 6 transactions (276 active
extents) in activity log.
May 25 05:42:49 chobs kernel: drbd1: ASSERT( mdev->bc == NULL ) in
/test_logs/builds/SuperNova/trunk/070525/platform/drbd/src/drbd/drbd_nl.
c:855
May 25 05:42:49 chobs kernel: drbd1: max_segment_size ( = BIO size ) =
32768
May 25 05:42:49 chobs kernel: drbd1: reading of bitmap took 1 jiffies
May 25 05:42:49 chobs kernel: drbd1: recounting of set bits took
additional 0 jiffies
May 25 05:42:49 chobs kernel: drbd1: 12 GB marked out-of-sync by on disk
bit-map.
May 25 05:42:49 chobs kernel: drbd1: Marked additional 0 KB as
out-of-sync based on AL.
May 25 05:42:49 chobs kernel: drbd1: disk( Attaching -> Negotiating ) 
May 25 05:42:49 chobs kernel: Unable to handle kernel NULL pointer
dereference at virtual address 00000024
May 25 05:42:49 chobs kernel:  printing eip:
May 25 05:42:49 chobs kernel: ee254765
May 25 05:42:49 chobs kernel: 24ab0000 -> *pde = 00000002:132ac001
May 25 05:42:49 chobs kernel: 2c8ac000 -> *pme = 00000000:00000000
May 25 05:42:49 chobs kernel: Oops: 0000 [#1]
May 25 05:42:49 chobs kernel: SMP 
May 25 05:42:49 chobs kernel: Modules linked in: drbd cn ipmi_devintf

ipmi_si ipmi_msghandler ipv6 i2c_dev i2c_core bridge binfmt_misc dm_mirror video thermal processor fan container button battery ac uhci_hcd ehci_hcd usbcore hw_random shpchp pci_hotplug bnx2 piix ide_generic mptfc scsi_transport_fc mptsas scsi_transport_sas mptspi scsi_transport_spi raid1 dm_mod ide_disk mptscsih mptbase sd_mod scsi_mod

May 25 05:42:49 chobs kernel: CPU:    0
May 25 05:42:49 chobs kernel: EIP:    0061:[<ee254765>]    Tainted: GF
VLI
May 25 05:42:49 chobs kernel: EFLAGS: 00010296  (2.6.16.38-xen #1) 
May 25 05:42:49 chobs kernel: EIP is at drbd_uuid_compare+0x15/0x410
[drbd]
May 25 05:42:49 chobs kernel: eax: 00000000  ebx: eb8e5944  ecx:
00000008  edx: e9a43f34
May 25 05:42:49 chobs kernel: esi: eb8e5944  edi: 00000008  ebp:
e9a43f10  esp: e9a43ed8
May 25 05:42:49 chobs kernel: ds: 007b  es: 007b  ss: 0069
May 25 05:42:49 chobs kernel: Process drbd1_receiver (pid: 6060,
threadinfo=e9a42000 task=ed4b1570)
May 25 05:42:49 chobs kernel: Stack: <0>e9a43ef8 e9a43ef8 e9a43efc
c016a8c5 6b458f28 eb8e59f8 00000004 eb8e5944 
May 25 05:42:49 chobs kernel:        e9a43f44 e9a43f34 eb8e5944 eb8e59f8
eb8e5944 00000008 e9a43f44 ee254b94 
May 25 05:42:49 chobs kernel:        00000000 00000000 e9a43f10 00000001
00000000 00000004 00000001 00000000 
May 25 05:42:49 chobs kernel: Call Trace:
May 25 05:42:49 chobs kernel:  [<c0105a01>] show_stack_log_lvl+0xa1/0xe0
May 25 05:42:49 chobs kernel:  [<c0105bf1>] show_registers+0x181/0x200
May 25 05:42:49 chobs kernel:  [<c0105e10>] die+0x100/0x1b0
May 25 05:42:49 chobs kernel:  [<c01168f6>] do_page_fault+0x3c6/0x8c1
May 25 05:42:49 chobs kernel:  [<c010565f>] error_code+0x2b/0x30
May 25 05:42:49 chobs kernel:  [<ee254b94>]
drbd_sync_handshake+0x34/0x570 [drbd]
May 25 05:42:49 chobs kernel:  [<ee2561f4>] receive_state+0x2c4/0x3c0
[drbd]
May 25 05:42:49 chobs kernel:  [<ee2568a2>] drbdd+0x42/0x170 [drbd]
May 25 05:42:49 chobs kernel:  [<ee257c05>] drbdd_init+0x1c5/0x210
[drbd]
May 25 05:42:49 chobs kernel:  [<ee262eac>] drbd_thread_setup+0x8c/0x100
[drbd]
May 25 05:42:49 chobs kernel:  [<c0103485>]
kernel_thread_helper+0x5/0x10
May 25 05:42:49 chobs kernel: Code: de ec d1 8b 5d f8 8b 75 fc 89 ec 5d
c3 89 f6 8d bc 27 00 00 00 00 55 89 e5 57 56 53 83 ec 2c 89 45 f0 8b 5d
f0 89 55 ec 8b 40 14 <8b> 50 24 8b 40 20 89 55 e8 89 c1 83 e1 fe 89 4d
e4 8b 83 38 03 
May 25 05:42:49 chobs kernel:  <0>Fatal exception: panic in 5 seconds

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Montrose, Ernest
Sent: Monday, June 11, 2007 4:17 PM
To: Philipp Reisner; [email protected]
Subject: [Drbd-dev] DRBD8: Panic in drbd_uuid_compare due to mdev->bc beingnull

Hi all,

We are seeing a panic that occurs while syncing. Essentially if you are primary and you are syncing and get an io error then on the next attach you can panic. Especially if that attach happens quickly after the detach.

I think what's happening is this:
* The local disk dies and we transiton to "Diskless"
* After_state_ch() suppose to call drbd_free_bc() to free mdev->bc.
* But before we can free mdev->bc, mdev->local_cnt would have to be 0, in this case it was not. Not too sure why. So we wait for mdev->local_cnt to become 0.
* While waiting an "Attach" request comes in. We ASSERT that mdev->bc is not NULL but we brush it off, set a new bc and leak the old.
* The wait in after_state_ch is now over. we free the new mdev->bc that the "attach" had set.
* we call drbd_sync_handshake(), access a NULL mdev->bc and we die.

A quick thing to do is to just fail the attach request if mdev->bc is not null. Patch included

EM--

author maintainer
#8 lore raw

Re: [Drbd-dev] DRBD8: Panic in drbd_uuid_compare due to mdev->bc being null

In reply to Montrose, Ernest
Quoted 19 lines · Ernest

Hi all,

We are seeing a panic that occurs while syncing. Essentially if you are primary and you are syncing and get an io error then on the next attach you can panic. Especially if that attach happens quickly after the detach.

I think what's happening is this:
* The local disk dies and we transiton to "Diskless"
* After_state_ch() suppose to call drbd_free_bc() to free mdev->bc.
* But before we can free mdev->bc, mdev->local_cnt would have to be 0, in this case it was not. Not too sure why. So we wait for mdev->local_cnt to become 0.
* While waiting an "Attach" request comes in. We ASSERT that mdev->bc is not NULL but we brush it off, set a new bc and leak the old.
* The wait in after_state_ch is now over. we free the new mdev->bc that the "attach" had set.
* we call drbd_sync_handshake(), access a NULL mdev->bc and we die.

Quoted 4 lines

A quick thing to do is to just fail the attach request if mdev->bc is not null. Patch included

EM--

Hi Ernest,

Thanks! I just changed it to Linux coding style, and shortened it a bit. It is commited.

-phil

Signature · 3 lines
: 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 :