From patchwork Mon May 7 08:43:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Yang X-Patchwork-Id: 10383529 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 72B026037F for ; Mon, 7 May 2018 08:44:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 664D228823 for ; Mon, 7 May 2018 08:44:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B3B428A96; Mon, 7 May 2018 08:44:34 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, 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 F2B11286DF for ; Mon, 7 May 2018 08:44:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752557AbeEGIoZ (ORCPT ); Mon, 7 May 2018 04:44:25 -0400 Received: from m97136.mail.qiye.163.com ([220.181.97.136]:5467 "EHLO m97136.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752068AbeEGIoV (ORCPT ); Mon, 7 May 2018 04:44:21 -0400 Received: from atest-guest.localdomain (unknown [218.94.118.90]) by smtp2 (Coremail) with SMTP id iOCowAD3D8riEfBa7U7qAA--.740S4; Mon, 07 May 2018 16:44:19 +0800 (CST) From: Dongsheng Yang To: ceph-devel@vger.kernel.org, idryomov@gmail.com Cc: Dongsheng Yang Subject: [PATCH 2/9] rbd: return the features to caller even if there is unsupported bits Date: Mon, 7 May 2018 04:43:58 -0400 Message-Id: <1525682645-30510-3-git-send-email-dongsheng.yang@easystack.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525682645-30510-1-git-send-email-dongsheng.yang@easystack.cn> References: <1525682645-30510-1-git-send-email-dongsheng.yang@easystack.cn> X-CM-TRANSID: iOCowAD3D8riEfBa7U7qAA--.740S4 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjfUJ2FCUUUUU X-Originating-IP: [218.94.118.90] X-CM-SenderInfo: 5grqw2pkhqwhp1dqwq5hdv52pwdfyhdfq/1tbieQM-elqrf3+JgAAAsH 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 d56c250..a1a4bbe 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4544,13 +4544,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", @@ -4558,13 +4551,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)