All of lore.kernel.org
 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>, Hannes Reinecke <hare@suse.com>,
	Jens Axboe <axboe@kernel.dk>, Sasha Levin <sashal@kernel.org>,
	linux-bcache@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 067/244] bcache: return error immediately in bch_journal_replay()
Date: Wed, 22 May 2019 15:23:33 -0400	[thread overview]
Message-ID: <20190522192630.24917-67-sashal@kernel.org> (raw)
In-Reply-To: <20190522192630.24917-1-sashal@kernel.org>

From: Coly Li <colyli@suse.de>

[ Upstream commit 68d10e6979a3b59e3cd2e90bfcafed79c4cf180a ]

When failure happens inside bch_journal_replay(), calling
cache_set_err_on() and handling the failure in async way is not a good
idea. Because after bch_journal_replay() returns, registering code will
continue to execute following steps, and unregistering code triggered
by cache_set_err_on() is running in same time. First it is unnecessary
to handle failure and unregister cache set in an async way, second there
might be potential race condition to run register and unregister code
for same cache set.

So in this patch, if failure happens in bch_journal_replay(), we don't
call cache_set_err_on(), and just print out the same error message to
kernel message buffer, then return -EIO immediately caller. Then caller
can detect such failure and handle it in synchrnozied way.

Signed-off-by: Coly Li <colyli@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/md/bcache/journal.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index 522c7426f3a05..3e9bc9776951b 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -330,9 +330,12 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list)
 	list_for_each_entry(i, list, list) {
 		BUG_ON(i->pin && atomic_read(i->pin) != 1);
 
-		cache_set_err_on(n != i->j.seq, s,
-"bcache: journal entries %llu-%llu missing! (replaying %llu-%llu)",
-				 n, i->j.seq - 1, start, end);
+		if (n != i->j.seq) {
+			pr_err("bcache: journal entries %llu-%llu missing! (replaying %llu-%llu)",
+			n, i->j.seq - 1, start, end);
+			ret = -EIO;
+			goto err;
+		}
 
 		for (k = i->j.start;
 		     k < bset_bkey_last(&i->j);
-- 
2.20.1


  parent reply	other threads:[~2019-05-22 19:44 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 19:22 [PATCH AUTOSEL 4.19 001/244] gfs2: Fix lru_count going negative Sasha Levin
2019-05-22 19:22 ` [Cluster-devel] " Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 002/244] cxgb4: Fix error path in cxgb4_init_module Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 003/244] NFS: make nfs_match_client killable Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 004/244] IB/hfi1: Fix WQ_MEM_RECLAIM warning Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 005/244] gfs2: Fix occasional glock use-after-free Sasha Levin
2019-05-22 19:22   ` [Cluster-devel] " Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 006/244] mmc: core: Verify SD bus width Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 007/244] batman-adv: mcast: fix multicast tt/tvlv worker locking Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 008/244] tools/bpf: fix perf build error with uClibc (seen on ARC) Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 009/244] selftests/bpf: set RLIMIT_MEMLOCK properly for test_libbpf_open.c Sasha Levin
2019-05-22 19:22   ` Sasha Levin
2019-05-22 19:22   ` sashal
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 010/244] bpftool: exclude bash-completion/bpftool from .gitignore pattern Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 011/244] dmaengine: tegra210-dma: free dma controller in remove() Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 012/244] net: ena: gcc 8: fix compilation warning Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 013/244] hv_netvsc: fix race that may miss tx queue wakeup Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 014/244] orangefs: truncate before updating size Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 015/244] Bluetooth: Ignore CC events not matching the last HCI command Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 016/244] pinctrl: zte: fix leaked of_node references Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 017/244] ASoC: Intel: kbl_da7219_max98357a: Map BTN_0 to KEY_PLAYPAUSE Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 018/244] usb: dwc2: gadget: Increase descriptors count for ISOC's Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 019/244] usb: dwc3: move synchronize_irq() out of the spinlock protected block Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 020/244] ASoC: hdmi-codec: unlock the device on startup errors Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 021/244] leds: avoid races with workqueue Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 022/244] powerpc/perf: Return accordingly on invalid chip-id in Sasha Levin
2019-05-22 19:22   ` Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 023/244] powerpc/boot: Fix missing check of lseek() return value Sasha Levin
2019-05-22 19:22   ` Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 024/244] powerpc/perf: Fix loop exit condition in nest_imc_event_init Sasha Levin
2019-05-22 19:22   ` Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 025/244] ASoC: imx: fix fiq dependencies Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 026/244] spi: pxa2xx: fix SCR (divisor) calculation Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 027/244] brcm80211: potential NULL dereference in brcmf_cfg80211_vndr_cmds_dcmd_handler() Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 028/244] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode() Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 029/244] drm/nouveau/bar/nv50: ensure BAR is mapped Sasha Levin
2019-05-22 19:22   ` Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 030/244] media: stm32-dcmi: return appropriate error codes during probe Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 031/244] ARM: vdso: Remove dependency with the arch_timer driver internals Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 032/244] arm64: Fix compiler warning from pte_unmap() with -Wunused-but-set-variable Sasha Levin
2019-05-22 19:22 ` [PATCH AUTOSEL 4.19 033/244] powerpc/watchdog: Use hrtimers for per-CPU heartbeat Sasha Levin
2019-05-22 19:22   ` Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 034/244] sched/cpufreq: Fix kobject memleak Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 035/244] scsi: qla2xxx: Fix a qla24xx_enable_msix() error path Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 036/244] scsi: qla2xxx: Fix abort handling in tcm_qla2xxx_write_pending() Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 037/244] scsi: qla2xxx: Avoid that lockdep complains about unsafe locking in tcm_qla2xxx_close_session() Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 038/244] scsi: qla2xxx: Fix hardirq-unsafe locking Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 039/244] x86/modules: Avoid breaking W^X while loading modules Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 040/244] Btrfs: fix data bytes_may_use underflow with fallocate due to failed quota reserve Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 041/244] btrfs: fix panic during relocation after ENOSPC before writeback happens Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 042/244] btrfs: Don't panic when we can't find a root key Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 043/244] iwlwifi: pcie: don't crash on invalid RX interrupt Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 044/244] rtc: 88pm860x: prevent use-after-free on device remove Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 045/244] rtc: stm32: manage the get_irq probe defer case Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 046/244] scsi: qedi: Abort ep termination if offload not scheduled Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 047/244] s390/kexec_file: Fix detection of text segment in ELF loader Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 048/244] sched/nohz: Run NOHZ idle load balancer on HK_FLAG_MISC CPUs Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 049/244] w1: fix the resume command API Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 050/244] s390: qeth: address type mismatch warning Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 051/244] dmaengine: pl330: _stop: clear interrupt status Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 052/244] mac80211/cfg80211: update bss channel on channel switch Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 053/244] USB: serial: fix initial-termios handling Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 054/244] libbpf: fix samples/bpf build failure due to undefined UINT32_MAX Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 055/244] slimbus: fix a potential NULL pointer dereference in of_qcom_slim_ngd_register Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 056/244] driver core: platform: Fix the usage of platform device name(pdev->name) Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 057/244] ASoC: fsl_sai: Update is_slave_mode with correct value Sasha Levin
2019-05-22 19:23   ` Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 058/244] mwifiex: prevent an array overflow Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 059/244] rsi: Fix NULL pointer dereference in kmalloc Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 060/244] net: cw1200: fix a NULL pointer dereference Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 061/244] at76c50x-usb: Don't register led_trigger if usb_register_driver failed Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 062/244] nvme: set 0 capacity if namespace block size exceeds PAGE_SIZE Sasha Levin
2019-05-22 19:23   ` Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 063/244] nvme-rdma: fix a NULL deref when an admin connect times out Sasha Levin
2019-05-22 19:23   ` Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 064/244] ssb: Fix possible NULL pointer dereference in ssb_host_pcmcia_exit Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 065/244] crypto: sun4i-ss - Fix invalid calculation of hash end Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 066/244] bcache: avoid potential memleak of list of journal_replay(s) in the CACHE_SYNC branch of run_cache_set Sasha Levin
2019-05-22 19:23 ` Sasha Levin [this message]
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 068/244] bcache: fix failure in journal relplay Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 069/244] bcache: add failure check to run_cache_set() for journal replay Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 070/244] bcache: avoid clang -Wunintialized warning Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 071/244] RDMA/cma: Consider scope_id while binding to ipv6 ll address Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 072/244] vfio-ccw: Do not call flush_workqueue while holding the spinlock Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 073/244] vfio-ccw: Release any channel program when releasing/removing vfio-ccw mdev Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 074/244] x86/build: Move _etext to actual end of .text Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 075/244] smpboot: Place the __percpu annotation correctly Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 076/244] x86/mm: Remove in_nmi() warning from 64-bit implementation of vmalloc_fault() Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 077/244] mlxsw: spectrum_router: Prevent ipv6 gateway with v4 route via replace and append Sasha Levin
2019-05-22 19:29   ` David Ahern
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 078/244] mm/uaccess: Use 'unsigned long' to placate UBSAN warnings on older GCC versions Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 079/244] Bluetooth: hci_qca: Give enough time to ROME controller to bootup Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 080/244] HID: logitech-hidpp: use RAP instead of FAP to get the protocol version Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 081/244] pinctrl: pistachio: fix leaked of_node references Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 082/244] pinctrl: samsung: " Sasha Levin
2019-05-22 19:23 ` [PATCH AUTOSEL 4.19 083/244] clk: rockchip: undo several noc and special clocks as critical on rk3288 Sasha Levin
2019-05-22 19:23   ` 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=20190522192630.24917-67-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=colyli@suse.de \
    --cc=hare@suse.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.