diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-09-29 07:00:14 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:58:04 -0500 |
commit | 9bcd2521827bb7c418a83a77474c449d6496d55c (patch) | |
tree | aae5995f4d1d6b72d0a7ccd30d31fab01be29a45 /drivers/block/drbd | |
parent | 22d81140aea85f9ac388fa12768dc502ef00eaae (diff) |
drbd: fix "stalled" empty resync
With sync-after dependencies, given "lucky" timing of pause/unpause
events, and the end of an empty (0 bits set) resync was sometimes not
detected on the SyncTarget, leading to a "stalled" SyncSource state.
Fixed this by expecting not only "Inconsistent -> UpToDate" but also
"Consistent -> UpToDate" transitions for the peer disk state
to end a resync.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 8 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index e64b1c897c82..16c3710e1b9c 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -2262,7 +2262,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) | |||
2262 | 2262 | ||
2263 | if (rs.no_resync && mdev->tconn->agreed_pro_version < 93) { | 2263 | if (rs.no_resync && mdev->tconn->agreed_pro_version < 93) { |
2264 | retcode = ERR_NEED_APV_93; | 2264 | retcode = ERR_NEED_APV_93; |
2265 | goto fail; | 2265 | goto fail_ldev; |
2266 | } | 2266 | } |
2267 | 2267 | ||
2268 | rcu_read_lock(); | 2268 | rcu_read_lock(); |
@@ -2272,7 +2272,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) | |||
2272 | new_disk_conf = kmalloc(sizeof(struct disk_conf), GFP_KERNEL); | 2272 | new_disk_conf = kmalloc(sizeof(struct disk_conf), GFP_KERNEL); |
2273 | if (!new_disk_conf) { | 2273 | if (!new_disk_conf) { |
2274 | retcode = ERR_NOMEM; | 2274 | retcode = ERR_NOMEM; |
2275 | goto fail; | 2275 | goto fail_ldev; |
2276 | } | 2276 | } |
2277 | } | 2277 | } |
2278 | 2278 | ||
@@ -2310,6 +2310,10 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) | |||
2310 | fail: | 2310 | fail: |
2311 | drbd_adm_finish(info, retcode); | 2311 | drbd_adm_finish(info, retcode); |
2312 | return 0; | 2312 | return 0; |
2313 | |||
2314 | fail_ldev: | ||
2315 | put_ldev(mdev); | ||
2316 | goto fail; | ||
2313 | } | 2317 | } |
2314 | 2318 | ||
2315 | int drbd_adm_resource_opts(struct sk_buff *skb, struct genl_info *info) | 2319 | int drbd_adm_resource_opts(struct sk_buff *skb, struct genl_info *info) |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 4004a682d0ec..aba04d7dadf5 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -3748,9 +3748,14 @@ static int receive_state(struct drbd_tconn *tconn, struct packet_info *pi) | |||
3748 | os = ns = drbd_read_state(mdev); | 3748 | os = ns = drbd_read_state(mdev); |
3749 | spin_unlock_irq(&mdev->tconn->req_lock); | 3749 | spin_unlock_irq(&mdev->tconn->req_lock); |
3750 | 3750 | ||
3751 | /* peer says his disk is uptodate, while we think it is inconsistent, | 3751 | /* If this is the "end of sync" confirmation, usually the peer disk |
3752 | * and this happens while we think we have a sync going on. */ | 3752 | * transitions from D_INCONSISTENT to D_UP_TO_DATE. For empty (0 bits |
3753 | if (os.pdsk == D_INCONSISTENT && real_peer_disk == D_UP_TO_DATE && | 3753 | * set) resync started in PausedSyncT, or if the timing of pause-/ |
3754 | * unpause-sync events has been "just right", the peer disk may | ||
3755 | * transition from D_CONSISTENT to D_UP_TO_DATE as well. | ||
3756 | */ | ||
3757 | if ((os.pdsk == D_INCONSISTENT || os.pdsk == D_CONSISTENT) && | ||
3758 | real_peer_disk == D_UP_TO_DATE && | ||
3754 | os.conn > C_CONNECTED && os.disk == D_UP_TO_DATE) { | 3759 | os.conn > C_CONNECTED && os.disk == D_UP_TO_DATE) { |
3755 | /* If we are (becoming) SyncSource, but peer is still in sync | 3760 | /* If we are (becoming) SyncSource, but peer is still in sync |
3756 | * preparation, ignore its uptodate-ness to avoid flapping, it | 3761 | * preparation, ignore its uptodate-ness to avoid flapping, it |