linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Coly Li <colyli@suse.de>, Jens Axboe <axboe@kernel.dk>,
	Sasha Levin <sashal@kernel.org>,
	linux-bcache@vger.kernel.org
Subject: [PATCH AUTOSEL 5.2 192/249] bcache: fix return value error in bch_journal_read()
Date: Mon, 15 Jul 2019 09:45:57 -0400	[thread overview]
Message-ID: <20190715134655.4076-192-sashal@kernel.org> (raw)
In-Reply-To: <20190715134655.4076-1-sashal@kernel.org>

From: Coly Li <colyli@suse.de>

[ 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 <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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

       reply	other threads:[~2019-07-15 13:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190715134655.4076-1-sashal@kernel.org>
2019-07-15 13:45 ` Sasha Levin [this message]
2019-07-15 13:45 ` [PATCH AUTOSEL 5.2 193/249] bcache: check CACHE_SET_IO_DISABLE in allocator code Sasha Levin
2019-07-15 13:45 ` [PATCH AUTOSEL 5.2 194/249] bcache: check CACHE_SET_IO_DISABLE bit in bch_journal() Sasha Levin
2019-07-15 13:46 ` [PATCH AUTOSEL 5.2 195/249] bcache: acquire bch_register_lock later in cached_dev_free() Sasha Levin
2019-07-15 13:46 ` [PATCH AUTOSEL 5.2 196/249] bcache: check c->gc_thread by IS_ERR_OR_NULL in cache_set_flush() Sasha Levin
2019-07-15 13:46 ` [PATCH AUTOSEL 5.2 197/249] bcache: avoid a deadlock in bcache_reboot() Sasha Levin
2019-07-15 13:46 ` [PATCH AUTOSEL 5.2 198/249] bcache: fix potential deadlock in cached_def_free() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190715134655.4076-192-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=colyli@suse.de \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).