From patchwork Tue Mar 20 10:32:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Yang X-Patchwork-Id: 10296785 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 D771360385 for ; Tue, 20 Mar 2018 10:38:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4AB7289A1 for ; Tue, 20 Mar 2018 10:38:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5A4229560; Tue, 20 Mar 2018 10:38:39 +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 vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5F45289A1 for ; Tue, 20 Mar 2018 10:38:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752252AbeCTKig (ORCPT ); Tue, 20 Mar 2018 06:38:36 -0400 Received: from m97131.mail.qiye.163.com ([220.181.97.131]:36708 "EHLO m97131.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752136AbeCTKif (ORCPT ); Tue, 20 Mar 2018 06:38:35 -0400 X-Greylist: delayed 359 seconds by postgrey-1.27 at vger.kernel.org; Tue, 20 Mar 2018 06:38:35 EDT Received: from atest-guest.localdomain (unknown [218.94.118.90]) by smtp7 (Coremail) with SMTP id g+CowAAHdQ4347BaGINeAQ--.800S3; Tue, 20 Mar 2018 18:32:24 +0800 (CST) From: Dongsheng Yang To: idryomov@gmail.com, sage@redhat.com, elder@kernel.org, jdillama@redhat.com Cc: ceph-devel@vger.kernel.org, Dongsheng Yang Subject: [PATCH 1/2] rbd: return the features to caller even if there is unsupported bits Date: Tue, 20 Mar 2018 06:32:18 -0400 Message-Id: <1521541939-15932-2-git-send-email-dongsheng.yang@easystack.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1521541939-15932-1-git-send-email-dongsheng.yang@easystack.cn> References: <1521541939-15932-1-git-send-email-dongsheng.yang@easystack.cn> X-CM-TRANSID: g+CowAAHdQ4347BaGINeAQ--.800S3 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjfUJfnYUUUUU X-Originating-IP: [218.94.118.90] X-CM-SenderInfo: 5grqw2pkhqwhp1dqwq5hdv52pwdfyhdfq/1tbicxgPeln5eEqaTwAAsZ Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we are doing features refresh, we need to get the features even if there are some features unsupported enabled after rbd map. Signed-off-by: Dongsheng Yang --- drivers/block/rbd.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index f1d9e60..eb59b93 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4446,13 +4446,6 @@ static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id, if (ret < sizeof (features_buf)) return -ERANGE; - unsup = le64_to_cpu(features_buf.incompat) & ~RBD_FEATURES_SUPPORTED; - if (unsup) { - rbd_warn(rbd_dev, "image uses unsupported features: 0x%llx", - unsup); - return -ENXIO; - } - *snap_features = le64_to_cpu(features_buf.features); dout(" snap_id 0x%016llx features = 0x%016llx incompat = 0x%016llx\n", @@ -4460,13 +4453,25 @@ static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id, (unsigned long long)*snap_features, (unsigned long long)le64_to_cpu(features_buf.incompat)); + unsup = le64_to_cpu(features_buf.incompat) & ~RBD_FEATURES_SUPPORTED; + if (unsup) { + rbd_warn(rbd_dev, "image uses unsupported features: 0x%llx", + unsup); + return -ENXIO; + } + return 0; } static int rbd_dev_v2_features(struct rbd_device *rbd_dev) { - return _rbd_dev_v2_snap_features(rbd_dev, CEPH_NOSNAP, - &rbd_dev->header.features); + u64 features = 0; + int ret = _rbd_dev_v2_snap_features(rbd_dev, CEPH_NOSNAP, features); + if (ret) + return ret + + rbd_dev->header.features = features + return 0; } static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)