tmp_suning_uos_patched/drivers/block
Dave Chinner a1ecac3b06 loop: Make explicit loop device destruction lazy
xfstests has always had random failures of tests due to loop devices
failing to be torn down and hence leaving filesytems that cannot be
unmounted. This causes test runs to immediately stop.

Over the past 6 or 7 years we've added hacks like explicit unmount
-d commands for loop mounts, losetup -d after unmount -d fails, etc,
but still the problems persist.  Recently, the frequency of loop
related failures increased again to the point that xfstests 259 will
reliably fail with a stray loop device that was not torn down.

That is despite the fact the test is above as simple as it gets -
loop 5 or 6 times running mkfs.xfs with different paramters:

        lofile=$(losetup -f)
        losetup $lofile "$testfile"
        "$MKFS_XFS_PROG" -b size=512 $lofile >/dev/null || echo "mkfs failed!"
        sync
        losetup -d $lofile

And losteup -d $lofile is failing with EBUSY on 1-3 of these loops
every time the test is run.

Turns out that blkid is running simultaneously with losetup -d, and
so it sees an elevated reference count and returns EBUSY.  But why
is blkid running? It's obvious, isn't it? udev has decided to try
and find out what is on the block device as a result of a creation
notification. And it is racing with mkfs, so might still be scanning
the device when mkfs finishes and we try to tear it down.

So, make losetup -d force autoremove behaviour. That is, when the
last reference goes away, tear down the device. xfstests wants it
*gone*, not causing random teardown failures when we know that all
the operations the tests have specifically run on the device have
completed and are no longer referencing the loop device.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2012-10-30 08:37:31 +01:00
..
aoe aoe: update aoe-internal version number to 50 2012-10-06 03:05:30 +09:00
drbd
mtip32xx mtip32xx:Added appropriate timeout value for secure erase 2012-10-30 08:37:27 +01:00
paride
xen-blkback xen/blkback: Change xen_vbd's flush_support and discard_secure to have type unsigned int, rather than bool 2012-10-30 08:37:20 +01:00
amiflop.c
ataflop.c
brd.c
cciss_cmd.h
cciss_scsi.c
cciss_scsi.h
cciss.c cciss: remove unneeded memset() 2012-10-30 08:36:58 +01:00
cciss.h
cpqarray.c
cpqarray.h
cryptoloop.c
DAC960.c
DAC960.h
floppy.c floppy: remove dr, reuse drive on do_floppy_init 2012-10-30 08:36:07 +01:00
hd.c
ida_cmd.h
ida_ioctl.h
Kconfig cciss: select CONFIG_CHECK_SIGNATURE 2012-10-30 08:37:00 +01:00
loop.c loop: Make explicit loop device destruction lazy 2012-10-30 08:37:31 +01:00
Makefile
mg_disk.c
nbd.c nbd: handle discard requests 2012-10-06 03:05:24 +09:00
nvme.c PCI changes for the 3.7 merge window: 2012-10-01 12:05:36 -07:00
osdblk.c
pktcdvd.c
ps3disk.c
ps3vram.c
rbd_types.h rbd: define some new format constants 2012-10-01 14:30:53 -05:00
rbd.c rbd: BUG on invalid layout 2012-10-01 17:20:00 -05:00
smart1,2.h
sunvdc.c
swim_asm.S
swim.c
swim3.c
sx8.c
umem.c
umem.h
virtio_blk.c virtio-blk: Disable callback in virtblk_done() 2012-09-28 15:05:16 +09:30
xd.c
xd.h
xen-blkfront.c
xsysace.c
z2ram.c