From patchwork Tue Oct 11 21:36:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 9371733 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6A3176048F for ; Tue, 11 Oct 2016 21:39:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C39528F36 for ; Tue, 11 Oct 2016 21:39:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50A4029100; Tue, 11 Oct 2016 21:39:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0B59228F36 for ; Tue, 11 Oct 2016 21:39:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9BLbiDY010265; Tue, 11 Oct 2016 17:37:44 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9BLb1rD003087 for ; Tue, 11 Oct 2016 17:37:01 -0400 Received: from rh2.redhat.com (vpn-54-83.rdu2.redhat.com [10.10.54.83]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9BLauo6031548; Tue, 11 Oct 2016 17:37:00 -0400 From: Mike Christie To: dm-devel@redhat.com, christophe.varoqui@opensvc.com Date: Tue, 11 Oct 2016 16:36:55 -0500 Message-Id: <1476221815-17900-6-git-send-email-mchristi@redhat.com> In-Reply-To: <1476221815-17900-1-git-send-email-mchristi@redhat.com> References: <1476221815-17900-1-git-send-email-mchristi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: Mike Christie Subject: [dm-devel] [PATCH 5/5] rbd: use lock_on_read if set X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP If lock_on_read is set initially, pass it as a map option when remapping the image. Signed-off-by: Mike Christie --- libmultipath/checkers/rbd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libmultipath/checkers/rbd.c b/libmultipath/checkers/rbd.c index e516166..c920cbb 100644 --- a/libmultipath/checkers/rbd.c +++ b/libmultipath/checkers/rbd.c @@ -46,6 +46,7 @@ struct rbd_checker_context { char *username; int remapped; int blacklisted; + int lock_on_read:1; rados_t cluster; @@ -142,6 +143,9 @@ int libcheck_init(struct checker * c) goto free_addr; } + if (strstr(config_info, "lock_on_read")) + ct->lock_on_read = 1; + ct->config_info = strdup(config_info); if (!ct->config_info) goto free_addr; @@ -398,7 +402,10 @@ static int rbd_remap(struct rbd_checker_context *ct) case 0: argv[i++] = "rbd"; argv[i++] = "map"; - argv[i++] = "-o noshare"; + if (ct->lock_on_read) + argv[i++] = "-o noshare,lock_on_read"; + else + argv[i++] = "-o noshare"; if (ct->username) { argv[i++] = "--id"; argv[i++] = ct->username;