Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9931492ybi; Wed, 24 Jul 2019 12:33:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwepjGY/olVem264AhOAjDEKQmFPnpMkBPBQF3iEZaw8k66+Dax+xjDZU4cF1d2eFRulvQt X-Received: by 2002:a65:430a:: with SMTP id j10mr4362503pgq.374.1563996781368; Wed, 24 Jul 2019 12:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563996781; cv=none; d=google.com; s=arc-20160816; b=SpGEjvUve2Q2ZHfYj2qQGwweJRORRZ1Z+ADhMK6fHc9SOxG3vBPQISEJl1TK3uWnOp 5T19lPGpqdMLpxca1jwS0yYhpQBiUgZ6Y3+WoDrfSJYZPNSCR5t5TCR9fUQiNnngo2Df 7YjseleLJoAqUmMEyeKRi6P8bU5KiC8U6Zp1ZjmgnqEOZnPFW2XwcjEELjGRepWhzhmQ 3qAp6fOW95m3nlAIwYaML9jGW85YEmmvddlU82GF6PNqKKNGHtrDSKAfSYH0Y2HbHY4p iRXWJhMKOIc28bfjfM/vvTKBNcV4I6ZbdiTwq86XqbKndREbdQuRDe+xl1H+Nd/18FHW /heQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ys0t5WVtrNCSpAwdd+Dsvj9TvqDOQaM25DECJiIELvM=; b=bnRVY5Ns8MmTFQuMoGBiH2uXRUoypgjWYoDpLZ0MXWm0SoJ+B6fiviuUj6g1Oo8NOP Exz8lfikaRmmfSKILfki6ZCR+FNGGVg4nx01rVrDZOHdSber/fHPJNBMveAIscw+jWUU xntkPup5GJvwaeSFQmZEzPzMVhZ3Bw+zVfadJvpauXIc22zSP6mt8GukVKzJhPZZNVUA iXbIIwNqNpy2R9gylSmZhZbnM4NovNZbMr3QzIve0IxYQSr0/aHghlZHBBxb70nSNNNx tawSyhJSgHPELtqgrt55P0CHGNwCk1R2G1wtI5GAXyYn3ak7/urlf79bgMeFLqIEsh5Q P7qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eHSn6HCJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si15325203pfl.288.2019.07.24.12.32.46; Wed, 24 Jul 2019 12:33:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eHSn6HCJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388517AbfGXTbm (ORCPT + 99 others); Wed, 24 Jul 2019 15:31:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:52758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388508AbfGXTbk (ORCPT ); Wed, 24 Jul 2019 15:31:40 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C2B20229F4; Wed, 24 Jul 2019 19:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996699; bh=CqXxNtD2vspp+3QgYdEnCTTV27NiT+7gb4tIhi/978E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eHSn6HCJ+QcTyPvb8QRnk+NgnVkcnUcVHChikb4S5A7AQTMjjG2N3egf1PNwuCSjP Dc+dyJClkyFQtQ9aDLe58UyLBkQf55I/bNE1eIj0MpA6cZmcnHCplagL3NB/epuQeh DTp/fUvyySLP9wMwzBogFAHbjyFPUMZHvl+r/Xq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Coly Li , Jens Axboe , Sasha Levin Subject: [PATCH 5.2 186/413] bcache: fix return value error in bch_journal_read() Date: Wed, 24 Jul 2019 21:17:57 +0200 Message-Id: <20190724191748.036726271@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 0ae49cb7aa005ed18fe8f4d6ccf73019b78ac7b2 ] When everything is OK in bch_journal_read(), finally the return value is returned by, return ret; which assumes ret will be 0 here. This assumption is wrong when all journal buckets as are full and filled with valid journal entries. In such cache the last location referencess read_bucket() sets 'ret' to 1, which means new jset added into jset list. The jset list is list 'journal' in caller run_cache_set(). Return 1 to run_cache_set() means something wrong and the cache set won't start, but indeed everything is OK. This patch changes the line at end of bch_journal_read() to directly return 0 since everything if verything is good. Then a bogus error is fixed. Signed-off-by: Coly Li Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/md/bcache/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 12dae9348147..4e5fc05720fc 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -268,7 +268,7 @@ int bch_journal_read(struct cache_set *c, struct list_head *list) struct journal_replay, list)->j.seq; - return ret; + return 0; #undef read_bucket } -- 2.20.1