Message ID | 20190614131358.2771-5-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 3FCAE14BB for <patchwork-linux-block@patchwork.kernel.org>; Fri, 14 Jun 2019 13:14:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31A6C286BF for <patchwork-linux-block@patchwork.kernel.org>; Fri, 14 Jun 2019 13:14:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25105286BD; Fri, 14 Jun 2019 13:14:23 +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 C42EB286C0 for <patchwork-linux-block@patchwork.kernel.org>; Fri, 14 Jun 2019 13:14:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728107AbfFNNOW (ORCPT <rfc822;patchwork-linux-block@patchwork.kernel.org>); Fri, 14 Jun 2019 09:14:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:45386 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727998AbfFNNOV (ORCPT <rfc822;linux-block@vger.kernel.org>); Fri, 14 Jun 2019 09:14:21 -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 ABBF3AB8C; Fri, 14 Jun 2019 13:14:20 +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 04/29] bcache: set largest seq to ja->seq[bucket_index] in journal_read_bucket() Date: Fri, 14 Jun 2019 21:13:33 +0800 Message-Id: <20190614131358.2771-5-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 50c9a1e405e6..a9f1703a8514 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -156,7 +156,8 @@ reread: left = ca->sb.bucket_size - offset; list_add(&i->list, where); ret = 1; - ja->seq[bucket_index] = j->seq; + if (j->seq > ja->seq[bucket_index]) + ja->seq[bucket_index] = j->seq; next_set: offset += blocks * ca->sb.block_size; len -= blocks * ca->sb.block_size;
In journal_read_bucket() when setting ja->seq[bucket_index], there might be potential case that a later non-maximum overwrites a better sequence number to ja->seq[bucket_index]. This patch adds a check to make sure that ja->seq[bucket_index] will be only set a new value if it is bigger then current value. Signed-off-by: Coly Li <colyli@suse.de> --- drivers/md/bcache/journal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)