Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] PATCH: Missing state change netlink events
@ 2007-11-04 21:46 Graham, Simon
  2007-11-05 10:25 ` Philipp Reisner
  2007-11-06 12:41 ` Graham, Simon
  0 siblings, 2 replies; 4+ messages in thread
From: Graham, Simon @ 2007-11-04 21:46 UTC (permalink / raw)
  To: drbd-dev

[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]

 <<ava-3834.patch>> We have noticed that not all state changes are being
reported via netlink (as seen with the 'drbdsetup /dev/drbd0 events -a
-u' command) - the reason for this is that the state broadcast is done
in after_state_ch using the _current_ mdev state when it runs - it's
entirely possible for two state changes to occur in quick succession
before the after_state_ch worker runs which results in the same state
being broadcast twice - this is especially a problem if you are looking
to see disk Failed state changes as the state tends to change to Failed
and then to Diskless very quickly, which can result in the Diskless
state being reported twice.

I think the fix is simple - modify the code so that after_state_ch
broadcasts the new state rather than the current state (patch attached)
- I would have removed the passing of mdev completely from
drbd_bcast_state() if it weren't for the fact it is required by the
generated to_tags function. I'm testing this at the moment but it's a
little hard to be sure it's right since this requires fairly tight
timing.

Simon


[-- Attachment #2: ava-3834.patch --]
[-- Type: application/octet-stream, Size: 1581 bytes --]

Index: src/drbd/drbd_nl.c
===================================================================
--- src/drbd/drbd_nl.c	(revision 20610)
+++ src/drbd/drbd_nl.c	(working copy)
@@ -1688,7 +1688,7 @@
 
 atomic_t drbd_nl_seq = ATOMIC_INIT(2); // two.
 
-void drbd_bcast_state(drbd_dev *mdev)
+void drbd_bcast_state(drbd_dev *mdev, drbd_state_t state)
 {
 	char buffer[sizeof(struct cn_msg)+
 		    sizeof(struct drbd_nl_cfg_reply)+
@@ -1700,7 +1700,7 @@
 
 	// WARN("drbd_bcast_state() got called\n");
 
-	tl = get_state_to_tags(mdev,(struct get_state*)&mdev->state,tl);
+	tl = get_state_to_tags(mdev,(struct get_state*)&state,tl);
 	*tl++ = TT_END; /* Close the tag list */
 
 	cn_reply->id.idx = CN_IDX_DRBD;
Index: src/drbd/drbd_main.c
===================================================================
--- src/drbd/drbd_main.c	(revision 20610)
+++ src/drbd/drbd_main.c	(working copy)
@@ -872,7 +872,7 @@
 	}
 
 	/* Inform userspace about the change... */
-	drbd_bcast_state(mdev);
+	drbd_bcast_state(mdev, ns);
 
 	/* Here we have the actions that are performed after a
 	   state change. This function might sleep */
Index: src/drbd/drbd_int.h
===================================================================
--- src/drbd/drbd_int.h	(revision 20610)
+++ src/drbd/drbd_int.h	(working copy)
@@ -1415,7 +1415,7 @@
 
 void drbd_nl_cleanup(void);
 int __init drbd_nl_init(void);
-void drbd_bcast_state(drbd_dev *mdev);
+void drbd_bcast_state(drbd_dev *mdev, drbd_state_t state);
 void drbd_bcast_sync_progress(drbd_dev *mdev);
 void drbd_bcast_split_brain(drbd_dev *mdev,int flag);
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-11-06 13:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-04 21:46 [Drbd-dev] PATCH: Missing state change netlink events Graham, Simon
2007-11-05 10:25 ` Philipp Reisner
2007-11-06 12:41 ` Graham, Simon
2007-11-06 13:53   ` Philipp Reisner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox