Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp630297pxb; Tue, 2 Feb 2021 13:45:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwx31hUqZseACS8ljtyGVSo7tf/fUAgRitxwOBfdipTukmV5corEWcORbLuIb+jOMqKQWJ2 X-Received: by 2002:a17:907:2705:: with SMTP id w5mr511ejk.505.1612302300310; Tue, 02 Feb 2021 13:45:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612302300; cv=none; d=google.com; s=arc-20160816; b=XQXc5W0qNJ8d/fXh3LlphKI89HdmsuOHncLPEwtR9N8/7mxTbx4bF0Wzm9AB0EGV7n heCpXmZIknYW3kWWWfrEelxXoZI+GvIkYpyfqtLIOktJy52hXT1MJuY6kxsxNVNeyC0w wMaVSCwB9HTCuR+0UvA2xATVQGIv7Z8SoA/yXR6i2pffpIF0EBJ4BPCR8utBOHMX4IrH AWYg5bo+bS5dZl5JVME/hsiMGgglqd48FTQJOB6N4cn2Dct4pBpQvnrJ7eyWorKgZSFe 3v6M0d9L63HXqG6sffOJ3nU2NQUTAkSMw2no3HoDobmQPuzzcC0Tocu3cmfdVkI0eFYu 8qzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2X8MTgsyzcvrr+QYckfQyzQy1RWqo4UBDJe7aLjX2VA=; b=FwIM9n5hZMRczHCqrusEaVaN2f9H3/+aqe/ZyxPbwU2G1q/zPYFvEO/IiygGLIzDNv G63C1QBIKldVuY4GDtA7ltzSILkxlRTzAp47AmQqkFUZT10BbMe7/48QKEJ0oLdOMM6t 1XVzsWvjxYGwIkLgqygSGU7Mun02M9Hi2FzUu9FtihnuMckLGAspvdzxKHQein7X+M1/ /cLMSDbOagDrdPJgmcELZYUNeeW2Lasd5d+3p4mUldJbjYtsCZobmLV+dwBblJAiGaPw TozvHgBNCkYq024Cd9e9SWCYYX8kAXGDTaYt15uEXFfs3ladwnCpd9S88jjXvn9kty+L dZrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oB1+KX5Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r23si15483780edy.455.2021.02.02.13.44.30; Tue, 02 Feb 2021 13:45:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oB1+KX5Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232784AbhBBNq3 (ORCPT + 99 others); Tue, 2 Feb 2021 08:46:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:37810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232556AbhBBNpD (ORCPT ); Tue, 2 Feb 2021 08:45:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 93B2C64F71; Tue, 2 Feb 2021 13:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273227; bh=1OYM2AkL4NtWNpKsGZ3DuhPlPT6lqX7K+qcrXB/kqfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oB1+KX5QVJnEJ4fjr7RwwGFlIra3nZ05wOOnLY3+1/n8mcvsZoZtSsPqic4CGlUC7 ZMtPISUyoB0G4yokIBQTpAgSbqtXatT9ZyRPBEMWz9w5LzIxW05vsgXZxOjJsMe8Ov QDPQ33Pvl+oLYPajZZb4F84HjUfjtOrJhe9hC1/M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Coly Li , Jens Axboe , Bockholdt Arne Subject: [PATCH 5.10 027/142] bcache: only check feature sets when sb->version >= BCACHE_SB_VERSION_CDEV_WITH_FEATURES Date: Tue, 2 Feb 2021 14:36:30 +0100 Message-Id: <20210202132958.832511119@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132957.692094111@linuxfoundation.org> References: <20210202132957.692094111@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Coly Li commit 0df28cad06eb41cc36bfea69d9c882fb567fd0d6 upstream. For super block version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES, it doesn't make sense to check the feature sets. This patch checks super block version in bch_has_feature_* routines, if the version doesn't have feature sets yet, returns 0 (false) to the caller. Fixes: 5342fd425502 ("bcache: set bcache device into read-only mode for BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET") Fixes: ffa470327572 ("bcache: add bucket_size_hi into struct cache_sb_disk for large bucket") Cc: stable@vger.kernel.org # 5.9+ Reported-and-tested-by: Bockholdt Arne Signed-off-by: Coly Li Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/md/bcache/features.h | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/md/bcache/features.h +++ b/drivers/md/bcache/features.h @@ -33,6 +33,8 @@ #define BCH_FEATURE_COMPAT_FUNCS(name, flagname) \ static inline int bch_has_feature_##name(struct cache_sb *sb) \ { \ + if (sb->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ + return 0; \ return (((sb)->feature_compat & \ BCH##_FEATURE_COMPAT_##flagname) != 0); \ } \ @@ -50,6 +52,8 @@ static inline void bch_clear_feature_##n #define BCH_FEATURE_RO_COMPAT_FUNCS(name, flagname) \ static inline int bch_has_feature_##name(struct cache_sb *sb) \ { \ + if (sb->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ + return 0; \ return (((sb)->feature_ro_compat & \ BCH##_FEATURE_RO_COMPAT_##flagname) != 0); \ } \ @@ -67,6 +71,8 @@ static inline void bch_clear_feature_##n #define BCH_FEATURE_INCOMPAT_FUNCS(name, flagname) \ static inline int bch_has_feature_##name(struct cache_sb *sb) \ { \ + if (sb->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ + return 0; \ return (((sb)->feature_incompat & \ BCH##_FEATURE_INCOMPAT_##flagname) != 0); \ } \