Message ID | 20190614131358.2771-20-colyli@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-block-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BCF3F1395 for <patchwork-linux-block@patchwork.kernel.org>; Fri, 14 Jun 2019 13:15:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADC39286B3 for <patchwork-linux-block@patchwork.kernel.org>; Fri, 14 Jun 2019 13:15:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A249D286C1; Fri, 14 Jun 2019 13:15:16 +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 47236286B3 for <patchwork-linux-block@patchwork.kernel.org>; Fri, 14 Jun 2019 13:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728117AbfFNNPP (ORCPT <rfc822;patchwork-linux-block@patchwork.kernel.org>); Fri, 14 Jun 2019 09:15:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:46082 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727956AbfFNNPP (ORCPT <rfc822;linux-block@vger.kernel.org>); Fri, 14 Jun 2019 09:15:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6DB9CAF8C; Fri, 14 Jun 2019 13:15:14 +0000 (UTC) From: Coly Li <colyli@suse.de> To: linux-bcache@vger.kernel.org Cc: linux-block@vger.kernel.org, Coly Li <colyli@suse.de> Subject: [PATCH 19/29] bcache: check CACHE_SET_IO_DISABLE bit in bch_journal() Date: Fri, 14 Jun 2019 21:13:48 +0800 Message-Id: <20190614131358.2771-20-colyli@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190614131358.2771-1-colyli@suse.de> References: <20190614131358.2771-1-colyli@suse.de> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: <linux-block.vger.kernel.org> X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
bcache candidate patches for Linux v5.3
|
expand
|
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 7beff8884dd0..87af7c6513c5 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -867,6 +867,10 @@ atomic_t *bch_journal(struct cache_set *c, struct journal_write *w; atomic_t *ret; + /* No journaling if CACHE_SET_IO_DISABLE set already */ + if (unlikely(test_bit(CACHE_SET_IO_DISABLE, &c->flags))) + return NULL; + if (!CACHE_SYNC(&c->sb)) return NULL;
When too many I/O errors happen on cache set and CACHE_SET_IO_DISABLE bit is set, bch_journal() may continue to work because the journaling bkey might be still in write set yet. The caller of bch_journal() may believe the journal still work but the truth is in-memory journal write set won't be written into cache device any more. This behavior may introduce potential inconsistent metadata status. This patch checks CACHE_SET_IO_DISABLE bit at the head of bch_journal(), if the bit is set, bch_journal() returns NULL immediately to notice caller to know journal does not work. Signed-off-by: Coly Li <colyli@suse.de> --- drivers/md/bcache/journal.c | 4 ++++ 1 file changed, 4 insertions(+)