linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Shaohua Li <shli@fb.com>
Subject: [PATCH 4.8 100/138] RAID1: ignore discard error
Date: Wed,  9 Nov 2016 11:46:23 +0100	[thread overview]
Message-ID: <20161109102849.490155830@linuxfoundation.org> (raw)
In-Reply-To: <20161109102844.808685475@linuxfoundation.org>

4.8-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Shaohua Li <shli@fb.com>

commit e3f948cd3283e4fbe5907f1f3967c839912f480e upstream.

If a write error occurs, raid1 will try to rewrite the bio in small
chunk size. If the rewrite fails, raid1 will record the error in bad
block. narrow_write_error will always use WRITE for the bio, but
actually it could be a discard. Since discard bio hasn't payload, write
the bio will cause different issues. But discard error isn't fatal, we
can safely ignore it. This is what this patch does.

This issue should exist since discard is added, but only exposed with
recent arbitrary bio size feature.

Reported-and-tested-by: Sitsofe Wheeler <sitsofe@gmail.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/raid1.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -407,11 +407,14 @@ static void raid1_end_write_request(stru
 	struct bio *to_put = NULL;
 	int mirror = find_bio_disk(r1_bio, bio);
 	struct md_rdev *rdev = conf->mirrors[mirror].rdev;
+	bool discard_error;
+
+	discard_error = bio->bi_error && bio_op(bio) == REQ_OP_DISCARD;
 
 	/*
 	 * 'one mirror IO has finished' event handler:
 	 */
-	if (bio->bi_error) {
+	if (bio->bi_error && !discard_error) {
 		set_bit(WriteErrorSeen,	&rdev->flags);
 		if (!test_and_set_bit(WantReplacement, &rdev->flags))
 			set_bit(MD_RECOVERY_NEEDED, &
@@ -448,7 +451,7 @@ static void raid1_end_write_request(stru
 
 		/* Maybe we can clear some bad blocks. */
 		if (is_badblock(rdev, r1_bio->sector, r1_bio->sectors,
-				&first_bad, &bad_sectors)) {
+				&first_bad, &bad_sectors) && !discard_error) {
 			r1_bio->bios[mirror] = IO_MADE_GOOD;
 			set_bit(R1BIO_MadeGood, &r1_bio->state);
 		}

  parent reply	other threads:[~2016-11-09 11:11 UTC|newest]

Thread overview: 129+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161109110606epcas2p30eede5f89fe25116e6ecbeed17c42e86@epcas2p3.samsung.com>
2016-11-09 10:44 ` [PATCH 4.8 000/138] 4.8.7-stable review Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 001/138] i2c: rk3x: Give the tuning value 0 during rk3x_i2c_v0_calc_timings Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 002/138] i2c: xgene: Avoid dma_buffer overrun Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 003/138] i2c: core: fix NULL pointer dereference under race condition Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 005/138] spi: fsl-espi: avoid processing uninitalized data on error Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 006/138] spi: mark device nodes only in case of successful instantiation Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 007/138] h8300: fix syscall restarting Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 008/138] gpio / ACPI: fix returned error from acpi_dev_gpio_irq_get() Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 009/138] gpio: GPIO_GET_CHIPINFO_IOCTL: Fix line offset validation Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 010/138] gpio: GPIO_GET_CHIPINFO_IOCTL: Fix information leak Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 011/138] gpio: GPIO_GET_LINEHANDLE_IOCTL: Validate line offset Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 012/138] gpio: GPIOHANDLE_GET_LINE_VALUES_IOCTL: Fix information leak Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 013/138] gpio: GPIO_GET_LINEEVENT_IOCTL: Validate line offset Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 014/138] gpio: GPIO_GET_LINEHANDLE_IOCTL: Reject invalid line flags Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 015/138] gpio: GPIO_GET_LINEEVENT_IOCTL: Reject invalid line and event flags Greg Kroah-Hartman
2016-11-09 10:44   ` [PATCH 4.8 016/138] gpio: GPIOHANDLE_GET_LINE_VALUES_IOCTL: Fix another information leak Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 017/138] gpio: GPIO_GET_LINE{HANDLE,EVENT}_IOCTL: Fix file descriptor leak Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 018/138] libxfs: clean up _calc_dquots_per_chunk Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 019/138] mm/list_lru.c: avoid error-path NULL pointer deref Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 020/138] mm/slab: fix kmemcg cache creation delayed issue Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 021/138] mm: memcontrol: do not recurse in direct reclaim Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 022/138] thermal/powerclamp: correct cpu support check Greg Kroah-Hartman
2016-11-09 15:05     ` Jacob Pan
2016-11-09 10:45   ` [PATCH 4.8 023/138] KEYS: Fix short sprintf buffer in /proc/keys show function Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 024/138] KEYS: Sort out big_key initialisation Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 025/138] security/keys: make BIG_KEYS dependent on stdrng Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 026/138] device-dax: fix percpu_ref_exit ordering Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 027/138] ALSA: usb-audio: Add quirk for Syntek STK1160 Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 028/138] ALSA: seq: Fix time account regression Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 029/138] ALSA: hda - allow 40 bit DMA mask for NVidia devices Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 030/138] ALSA: hda - Adding a new group of pin cfg into ALC295 pin quirk table Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 031/138] ALSA: hda - Fix surround output pins for ASRock B150M mobo Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 032/138] ALSA: hda - Fix headset mic detection problem for two Dell laptops Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 035/138] cxl: Fix leaking pid refs in some error paths Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 036/138] btrfs: fix races on root_log_ctx lists Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 037/138] powerpc: Convert cmp to cmpd in idle enter sequence Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 038/138] powerpc/mm/radix: Use tlbiel only if we ever ran on the current cpu Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 039/138] powerpc/64: Re-fix race condition between going idle and entering guest Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 040/138] powerpc/64: Fix race condition in setting lock bit in idle/wakeup code Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 041/138] x86/microcode/AMD: Fix more fallout from CONFIG_RANDOMIZE_MEMORY=y Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 042/138] timers: Prevent base clock rewind when forwarding clock Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 043/138] timers: Prevent base clock corruption when forwarding Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 044/138] timers: Plug locking race vs. timer migration Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 045/138] timers: Lock base for same bucket optimization Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 046/138] ubifs: Abort readdir upon error Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 047/138] ubifs: Fix regression in ubifs_readdir() Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 048/138] mei: txe: dont clean an unprocessed interrupt cause Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 049/138] usb: gadget: udc: atmel: fix endpoint name Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 051/138] USB: serial: fix potential NULL-dereference at probe Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 052/138] USB: serial: cp210x: fix tiocmget error handling Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 053/138] USB: serial: ftdi_sio: add support for Infineon TriBoard TC2X7 Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 054/138] xhci: use default USB_RESUME_TIMEOUT when resuming ports Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 055/138] usb: renesas_usbhs: add wait after initialization for R-Car Gen3 Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 056/138] usb: increase ohci watchdog delay to 275 msec Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 057/138] GenWQE: Fix bad page access during abort of resource allocation Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 058/138] x86/smpboot: Init apic mapping before usage Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 059/138] vt: clear selection before resizing Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 060/138] hv: do not lose pending heartbeat vmbus packets Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 061/138] xhci: add restart quirk for Intel Wildcatpoint PCH Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 062/138] xhci: workaround for hosts missing CAS bit Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 063/138] tty: limit terminal size to 4M chars Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 064/138] arm64: dts: marvell: fix clocksource for CP110 master SPI0 Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 065/138] iio:chemical:atlas-ph-sensor: Fix use of 32 bit int to hold 16 bit big endian value Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 066/138] Staging: wilc1000: Fix kernel Oops on opening the device Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 067/138] dm: free io_barrier after blk_cleanup_queue call Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 069/138] KVM: s390: Fix STHYI buffer alignment for diag224 Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 073/138] ARM: dts: fix the SD card on the Snowball Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 074/138] nfsd: Fix general protection fault in release_lock_stateid() Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 075/138] MIPS: KASLR: Fix handling of NULL FDT Greg Kroah-Hartman
2016-11-09 10:45   ` [PATCH 4.8 076/138] ovl: fix get_acl() on tmpfs Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 077/138] ovl: update S_ISGID when setting posix ACLs Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 078/138] ovl: fsync after copy-up Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 079/138] parisc: Ensure consistent state when switching to kernel stack at syscall entry Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 080/138] virtio_ring: Make interrupt suppression spec compliant Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 081/138] virtio_pci: Limit DMA mask to 44 bits for legacy virtio devices Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 082/138] virtio: console: Unlock vqs while freeing buffers Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 083/138] dm mirror: fix read error on recovery after default leg failure Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 084/138] dm table: fix missing dm_put_target_type() in dm_table_add_target() Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 085/138] dm rq: clear kworker_task if kthread_run() returned an error Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 086/138] dm raid: fix compat_features validation Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 087/138] dm raid: fix activation of existing raid4/10 devices Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 088/138] rtl8xxxu: Fix memory leak in handling rxdesc16 packets Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 089/138] rtl8xxxu: Fix big-endian problem reporting mactime Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 090/138] rtl8xxxu: Fix rtl8723bu driver reload issue Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 091/138] Input: i8042 - add XMG C504 to keyboard reset table Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 092/138] firewire: net: guard against rx buffer overflows Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 093/138] firewire: net: fix fragmented datagram_size off-by-one Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 094/138] mac80211: discard multicast and 4-addr A-MSDUs Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 095/138] Revert "ath9k_hw: implement temperature compensation support for AR9003+" Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 096/138] ath10k: cache calibration data when the core is stopped Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 097/138] scsi: scsi_debug: Fix memory leak if LBP enabled and module is unloaded Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 098/138] scsi: arcmsr: Send SYNCHRONIZE_CACHE command to firmware Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 099/138] mmc: dw_mmc-pltfm: fix the potential NULL pointer dereference Greg Kroah-Hartman
2016-11-09 10:46   ` Greg Kroah-Hartman [this message]
2016-11-09 10:46   ` [PATCH 4.8 101/138] RAID10: ignore discard error Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 102/138] md: be careful not lot leak internal curr_resync value into metadata. -- (all) Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 104/138] drm/imx: ipuv3-plane: Switch EBA buffer only when we dont need modeset Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 105/138] drm/imx: ipuv3-plane: Access old u/vbo properly in ->atomic_check for YU12/YV12 Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 106/138] drm/radeon/si_dpm: Limit clocks on HD86xx part Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 107/138] drm/radeon/si_dpm: workaround for SI kickers Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 109/138] drm/nouveau/acpi: fix check for power resources support Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 113/138] drm/i915/gen9: fix DDB partitioning for multi-screen cases Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 114/138] drm/i915/gen9: fix watermarks when using the pipe scaler Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 120/138] drm: i915: Wait for fences on new fb, not old Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 121/138] i2c: mark device nodes only in case of successful instantiation Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 122/138] netfilter: xt_NFLOG: fix unexpected truncated packet Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 123/138] UBI: fastmap: scrub PEB when bitflips are detected in a free PEB EC header Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 125/138] video: fbdev: pxafb: potential NULL dereference on error Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 126/138] omapfb: fix return value check in dsi_bind() Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 127/138] pwm: Unexport children before chip removal Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 128/138] usb: dwc3: Fix size used in dma_free_coherent() Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 129/138] usb: chipidea: host: fix NULL ptr dereference during shutdown Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 130/138] usb: musb: Fix hardirq-safe hardirq-unsafe lock order error Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 131/138] [media] v4l: vsp1: Prevent pipelines from running when not streaming Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 133/138] ARM: fix oops when using older ARMv4T CPUs Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 134/138] kvm: x86: Check memopp before dereference (CVE-2016-8630) Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 135/138] btrfs: qgroup: Prevent qgroup->reserved from going subzero Greg Kroah-Hartman
2016-11-09 10:46   ` [PATCH 4.8 136/138] ubi: fastmap: Fix add_vol() return value test in ubi_attach_fastmap() Greg Kroah-Hartman
2016-11-09 10:47   ` [PATCH 4.8 137/138] cpufreq: intel_pstate: Set P-state upfront in performance mode Greg Kroah-Hartman
2016-11-09 10:47   ` [PATCH 4.8 138/138] HID: usbhid: add ATEN CS962 to list of quirky devices Greg Kroah-Hartman
2016-11-09 18:22   ` [PATCH 4.8 000/138] 4.8.7-stable review Shuah Khan
2016-11-10  7:02     ` Greg Kroah-Hartman
2016-11-09 19:36   ` Guenter Roeck
2016-11-10  7:02     ` Greg Kroah-Hartman
     [not found]   ` <582465d1.12111c0a.f0f31.e519@mx.google.com>
2016-11-10 15:35     ` Greg Kroah-Hartman
     [not found]   ` <20161109102850.355591014@linuxfoundation.org>
2016-11-10 20:16     ` [PATCH 4.8 118/138] drm/i915: Clean up DDI DDC/AUX CH sanitation Maarten Maathuis
2016-11-10 23:02       ` Greg Kroah-Hartman
2016-11-11 12:38       ` Ville Syrjälä
2016-11-11 12:59         ` Jani Nikula

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=20161109102849.490155830@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shli@fb.com \
    --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).