linux/drivers/block
James Wang 6460495709 Fix loop device flush before configure v3
While installing SLES-12 (based on v4.4), I found that the installer
will stall for 60+ seconds during LVM disk scan.  The root cause was
determined to be the removal of a bound device check in loop_flush()
by commit b5dd2f6047 ("block: loop: improve performance via blk-mq").

Restoring this check, examining ->lo_state as set by loop_set_fd()
eliminates the bad behavior.

Test method:
modprobe loop max_loop=64
dd if=/dev/zero of=disk bs=512 count=200K
for((i=0;i<4;i++))do losetup -f disk; done
mkfs.ext4 -F /dev/loop0
for((i=0;i<4;i++))do mkdir t$i; mount /dev/loop$i t$i;done
for f in `ls /dev/loop[0-9]*|sort`; do \
	echo $f; dd if=$f of=/dev/null  bs=512 count=1; \
	done

Test output:  stock          patched
/dev/loop0    18.1217e-05    8.3842e-05
/dev/loop1     6.1114e-05    0.000147979
/dev/loop10    0.414701      0.000116564
/dev/loop11    0.7474        6.7942e-05
/dev/loop12    0.747986      8.9082e-05
/dev/loop13    0.746532      7.4799e-05
/dev/loop14    0.480041      9.3926e-05
/dev/loop15    1.26453       7.2522e-05

Note that from loop10 onward, the device is not mounted, yet the
stock kernel consumes several orders of magnitude more wall time
than it does for a mounted device.
(Thanks for Mike Galbraith <efault@gmx.de>, give a changelog review.)

Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: James Wang <jnwang@suse.com>
Fixes: b5dd2f6047 ("block: loop: improve performance via blk-mq")
Signed-off-by: Jens Axboe <axboe@fb.com>
2017-06-08 08:04:18 -06:00
..
aoe
drbd Merge branch 'for-linus' of git://git.kernel.dk/linux-block 2017-05-20 16:12:30 -07:00
mtip32xx mtip32xx: convert internal commands to regular block infrastructure 2017-05-03 08:09:19 -06:00
paride pd: don't check blk_execute_rq return value. 2017-04-20 12:16:10 -06:00
rsxx
xen-blkback block: xen-blkback: add null check to avoid null pointer dereference 2017-05-15 17:14:28 -04:00
zram zram: reduce load operation in page_same_filled 2017-05-03 15:52:11 -07:00
amiflop.c
ataflop.c ataflop: switch from req->errors to req->error_count 2017-04-20 12:16:10 -06:00
brd.c libnvdimm for 4.12 2017-05-05 18:49:20 -07:00
cciss_cmd.h
cciss_scsi.c
cciss_scsi.h
cciss.c scsi: introduce a result field in struct scsi_request 2017-04-20 12:16:10 -06:00
cciss.h
cryptoloop.c
DAC960.c
DAC960.h
floppy.c floppy: switch from req->errors to req->error_count 2017-04-20 12:16:10 -06:00
Kconfig libnvdimm for 4.12 2017-05-05 18:49:20 -07:00
loop.c Fix loop device flush before configure v3 2017-06-08 08:04:18 -06:00
loop.h loop: zero-fill bio on the submitting cpu 2017-04-20 12:16:10 -06:00
Makefile
nbd.c nbd: don't leak nbd_config 2017-05-30 08:15:08 -06:00
null_blk.c blk-mq: remove the error argument to blk_mq_complete_request 2017-04-20 12:16:10 -06:00
pktcdvd.c scsi: introduce a result field in struct scsi_request 2017-04-20 12:16:10 -06:00
ps3disk.c
ps3vram.c
rbd_types.h
rbd.c rbd: implement REQ_OP_WRITE_ZEROES 2017-05-29 11:18:01 +02:00
skd_main.c
skd_s1120.h
smart1,2.h
sunvdc.c
swim3.c swim3: remove (commented out) printing of req->errors 2017-04-20 12:16:10 -06:00
swim_asm.S
swim.c
sx8.c
umem.c
umem.h
virtio_blk.c virtio: fixes, cleanups, performance 2017-05-10 11:33:08 -07:00
xen-blkfront.c blk-mq: remove the error argument to blk_mq_complete_request 2017-04-20 12:16:10 -06:00
xsysace.c
z2ram.c