Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933600AbbFJHts (ORCPT ); Wed, 10 Jun 2015 03:49:48 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:45333 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933581AbbFJHte (ORCPT ); Wed, 10 Jun 2015 03:49:34 -0400 From: Nick Wang To: philipp.reisner@linbit.com, lars.ellenberg@linbit.com, drbd-dev@lists.linbit.com Cc: linux-kernel@vger.kernel.org, nwang@suse.com Subject: [PATCH 10/10] Update flag when receive uuid. Date: Wed, 10 Jun 2015 15:48:29 +0800 Message-Id: <1433922509-10280-11-git-send-email-nwang@suse.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1433922509-10280-1-git-send-email-nwang@suse.com> References: <1433922509-10280-1-git-send-email-nwang@suse.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2042 Lines: 57 Clear bitmap write and add lock when change state. Signed-off-by: Nick Wang CC: Philipp Reisner CC: Lars Ellenberg CC: drbd-dev@lists.linbit.com CC: linux-kernel@vger.kernel.org --- drbd/drbd_receiver.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c index 240a557..944db4c 100644 --- a/drbd/drbd_receiver.c +++ b/drbd/drbd_receiver.c @@ -4355,17 +4355,23 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info BM_LOCKED_TEST_ALLOWED); _drbd_uuid_set(device, UI_CURRENT, p_uuid[UI_CURRENT]); _drbd_uuid_set(device, UI_BITMAP, 0); + spin_lock_irq(&device->resource->req_lock); _drbd_set_state(_NS2(device, disk, D_UP_TO_DATE, pdsk, D_UP_TO_DATE), CS_VERBOSE, NULL); + spin_unlock_irq(&device->resource->req_lock); drbd_md_sync(device); updated_uuids = 1; } if (zero_out_devices) { drbd_info(device, "Accepted to zero out devices, will take a long time\n"); + drbd_bitmap_io(device, &drbd_bmio_clear_n_write, + "clear_n_write from receive_uuids", + BM_LOCKED_TEST_ALLOWED); _drbd_uuid_set(device, UI_CURRENT, p_uuid[UI_CURRENT]); _drbd_uuid_set(device, UI_BITMAP, 0); drbd_print_uuids(device, "cleared bitmap UUID for zeroing device"); + zero_out_err = zero_out_local_device(device); if (zero_out_err) { drbd_err(device, "Failed to zero out local device\n"); @@ -4375,6 +4381,8 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info drbd_info(device, "Finish zero out device\n"); drbd_send_zero_out_ok(peer_device); } + drbd_md_sync(device); + updated_uuids = 1; } if (zero_out_finish) { -- 1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/