From patchwork Thu Jun 11 03:28:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Durgin X-Patchwork-Id: 483143 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1E300140295 for ; Thu, 11 Jun 2015 23:18:08 +1000 (AEST) Received: from localhost ([::1]:46545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z329Q-0007ob-AM for incoming@patchwork.ozlabs.org; Thu, 11 Jun 2015 09:04:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2tAm-00019l-NB for qemu-devel@nongnu.org; Wed, 10 Jun 2015 23:28:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2tAl-0002yl-No for qemu-devel@nongnu.org; Wed, 10 Jun 2015 23:28:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2tAf-0002v0-Cp; Wed, 10 Jun 2015 23:28:49 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id A709A373BC1; Thu, 11 Jun 2015 03:28:48 +0000 (UTC) Received: from newangeles.redhat.com (dhcp-10-17-97-91.lax.redhat.com [10.17.97.91]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5B3SlaR008904 (version=TLSv1/SSLv3 cipher=AES256-SHA256 bits=256 verify=NO); Wed, 10 Jun 2015 23:28:48 -0400 From: Josh Durgin To: qemu-devel@nongnu.org Date: Wed, 10 Jun 2015 20:28:45 -0700 Message-Id: <1433993326-26294-4-git-send-email-jdurgin@redhat.com> In-Reply-To: <1433993326-26294-1-git-send-email-jdurgin@redhat.com> References: <1433993326-26294-1-git-send-email-jdurgin@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 X-Mailman-Approved-At: Thu, 11 Jun 2015 09:01:29 -0400 Cc: Kevin Wolf , Jeff Cody , qemu-block@nongnu.org Subject: [Qemu-devel] [PATCH 3/4] rbd: make qemu's cache setting override any ceph setting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org To be safe, when cache=none is used ceph settings should not be able to override it to turn on caching. This was previously possible with rbd_cache=true in the rbd device configuration or a ceph configuration file. Similarly, rbd settings could have turned off caching when qemu requested it, although this would just be a performance problem. Fix this by changing rbd's cache setting to match qemu after all other ceph settings have been applied. Signed-off-by: Josh Durgin Reviewed-by: Jeff Cody --- block/rbd.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index 50b5f6b..00d027d 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -460,6 +460,18 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, s->snap = g_strdup(snap_buf); } + if (strstr(conf, "conf=") == NULL) { + /* try default location, but ignore failure */ + rados_conf_read_file(s->cluster, NULL); + } + + if (conf[0] != '\0') { + r = qemu_rbd_set_conf(s->cluster, conf, errp); + if (r < 0) { + goto failed_shutdown; + } + } + /* * Fallback to more conservative semantics if setting cache * options fails. Ignore errors from setting rbd_cache because the @@ -473,18 +485,6 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, rados_conf_set(s->cluster, "rbd_cache", "true"); } - if (strstr(conf, "conf=") == NULL) { - /* try default location, but ignore failure */ - rados_conf_read_file(s->cluster, NULL); - } - - if (conf[0] != '\0') { - r = qemu_rbd_set_conf(s->cluster, conf, errp); - if (r < 0) { - goto failed_shutdown; - } - } - r = rados_connect(s->cluster); if (r < 0) { error_setg(errp, "error connecting");