android_kernel_samsung_a7y1.../drivers
Nigel Croxon 4718021ba0 Don't jump to compute_result state from check_result state
commit 4f4fd7c5798bbdd5a03a60f6269cf1177fbd11ef upstream.

Changing state from check_state_check_result to
check_state_compute_result not only is unsafe but also doesn't
appear to serve a valid purpose.  A raid6 check should only be
pushing out extra writes if doing repair and a mis-match occurs.
The stripe dev management will already try and do repair writes
for failing sectors.

This patch makes the raid6 check_state_check_result handling
work more like raid5's.  If somehow too many failures for a
check, just quit the check operation for the stripe.  When any
checks pass, don't try and use check_state_compute_result for
a purpose it isn't needed for and is unsafe for.  Just mark the
stripe as in sync for passing its parity checks and let the
stripe dev read/write code and the bad blocks list do their
job handling I/O errors.

Repro steps from Xiao:

These are the steps to reproduce this problem:
1. redefined OPT_MEDIUM_ERR_ADDR to 12000 in scsi_debug.c
2. insmod scsi_debug.ko dev_size_mb=11000  max_luns=1 num_tgts=1
3. mdadm --create /dev/md127 --level=6 --raid-devices=5 /dev/sde1 /dev/sde2 /dev/sde3 /dev/sde5 /dev/sde6
sde is the disk created by scsi_debug
4. echo "2" >/sys/module/scsi_debug/parameters/opts
5. raid-check

It panic:
[ 4854.730899] md: data-check of RAID array md127
[ 4854.857455] sd 5:0:0:0: [sdr] tag#80 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 4854.859246] sd 5:0:0:0: [sdr] tag#80 Sense Key : Medium Error [current]
[ 4854.860694] sd 5:0:0:0: [sdr] tag#80 Add. Sense: Unrecovered read error
[ 4854.862207] sd 5:0:0:0: [sdr] tag#80 CDB: Read(10) 28 00 00 00 2d 88 00 04 00 00
[ 4854.864196] print_req_error: critical medium error, dev sdr, sector 11656 flags 0
[ 4854.867409] sd 5:0:0:0: [sdr] tag#100 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 4854.869469] sd 5:0:0:0: [sdr] tag#100 Sense Key : Medium Error [current]
[ 4854.871206] sd 5:0:0:0: [sdr] tag#100 Add. Sense: Unrecovered read error
[ 4854.872858] sd 5:0:0:0: [sdr] tag#100 CDB: Read(10) 28 00 00 00 2e e0 00 00 08 00
[ 4854.874587] print_req_error: critical medium error, dev sdr, sector 12000 flags 4000
[ 4854.876456] sd 5:0:0:0: [sdr] tag#101 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 4854.878552] sd 5:0:0:0: [sdr] tag#101 Sense Key : Medium Error [current]
[ 4854.880278] sd 5:0:0:0: [sdr] tag#101 Add. Sense: Unrecovered read error
[ 4854.881846] sd 5:0:0:0: [sdr] tag#101 CDB: Read(10) 28 00 00 00 2e e8 00 00 08 00
[ 4854.883691] print_req_error: critical medium error, dev sdr, sector 12008 flags 4000
[ 4854.893927] sd 5:0:0:0: [sdr] tag#166 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 4854.896002] sd 5:0:0:0: [sdr] tag#166 Sense Key : Medium Error [current]
[ 4854.897561] sd 5:0:0:0: [sdr] tag#166 Add. Sense: Unrecovered read error
[ 4854.899110] sd 5:0:0:0: [sdr] tag#166 CDB: Read(10) 28 00 00 00 2e e0 00 00 10 00
[ 4854.900989] print_req_error: critical medium error, dev sdr, sector 12000 flags 0
[ 4854.902757] md/raid:md127: read error NOT corrected!! (sector 9952 on sdr1).
[ 4854.904375] md/raid:md127: read error NOT corrected!! (sector 9960 on sdr1).
[ 4854.906201] ------------[ cut here ]------------
[ 4854.907341] kernel BUG at drivers/md/raid5.c:4190!

raid5.c:4190 above is this BUG_ON:

    handle_parity_checks6()
        ...
        BUG_ON(s->uptodate < disks - 1); /* We don't need Q to recover */

Cc: <stable@vger.kernel.org> # v3.16+
OriginalAuthor: David Jeffery <djeffery@redhat.com>
Cc: Xiao Ni <xni@redhat.com>
Tested-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: David Jeffy <djeffery@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-06 16:49:43 +02:00
..
accessibility
acpi
amba
android
ata libata: fix using DMA buffers on stack 2020-04-06 16:41:42 +02:00
atm
auxdisplay
base
battery
battery_v2
bcma
block xsysace: Fix error handling in ace_setup 2020-04-06 16:42:28 +02:00
bluetooth
bts
bus
ccic
cdrom
char
clk
clocksource
connector
cpufreq
cpuidle
crypto
dca
devfreq
dio
dma
dma-buf
edac
eisa
extcon
fingerprint
firewire
firmware
five
fmc
fpga
gator
gpio
gps
gpu gpu: ipu-v3: dp: fix CSC handling 2020-04-06 16:47:13 +02:00
gud
hid HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys 2020-04-06 16:43:27 +02:00
hsi
hv
hwmon
hwspinlock
hwtracing
i2c
ide
idle
iio iio: adc: xilinx: fix potential use-after-free on remove 2020-04-06 16:43:24 +02:00
infiniband
input Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ 2020-04-06 16:42:41 +02:00
iommu iommu/amd: Set exclusion range correctly 2020-04-06 16:43:00 +02:00
ipack
irqchip
isdn
leds
lguest
lightnvm
macintosh
mailbox
mcb
md Don't jump to compute_result state from check_result state 2020-04-06 16:49:43 +02:00
media media: v4l2: i2c: ov7670: Fix PLL bypass register values 2020-04-06 16:42:47 +02:00
memory
memstick
message
mfd
misc
mmc
motor
mtd
muic
net cw1200: fix missing unlock on error in cw1200_hw_scan() 2020-04-06 16:47:16 +02:00
nfc
ntb
nubus
nvdimm libnvdimm/btt: Fix a kmemdup failure check 2020-04-06 16:43:30 +02:00
nvme
nvmem
of
oprofile
parisc
parport
pci
pcmcia
perf
phy
pinctrl
platform platform/x86: sony-laptop: Fix unintentional fall-through 2020-04-06 16:43:22 +02:00
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc rtc: da9063: set uie_unsupported when relevant 2020-04-06 16:42:17 +02:00
s390 s390: ctcm: fix ctcm_new_device error return code 2020-04-06 16:47:08 +02:00
sbus
scsi scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines 2020-04-06 16:43:06 +02:00
security/samsung/icdrv
sensorhub
sensors
sfi
sh
sn
soc
spi
spmi
ssb
staging staging: iio: adt7316: fix the dac write calculation 2020-04-06 16:42:39 +02:00
switch
target
tc
tee
thermal
thunderbolt
trace
tty sc16is7xx: missing unregister/delete driver on error in sc16is7xx_init() 2020-04-06 16:41:13 +02:00
uh
uio
usb UAS: fix alignment of scatter/gather segments 2020-04-06 16:43:12 +02:00
uwb
vfio vfio/pci: use correct format characters 2020-04-06 16:42:19 +02:00
vhost
video
virt
virtio
vision
vlynq
vme
w1 USB: w1 ds2490: Fix bug caused by improper use of altsetting array 2020-04-06 16:42:01 +02:00
watchdog
xen
zorro
Kconfig
Makefile