fast creation and deletion of loop devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have just used a crude loop to search for a partition on a block
device:

    for i in `seq 1 4096`
    do
        losetup -r -o ${i}k /dev/loop0 /dev/sda
        mount /dev/loop0 /mnt && break
        losetup -d /dev/loop0
    done

Creating the loop device fails sometimes, with

    losetup: /dev/sda: failed to set up loop device: Device or resource busy

and the kernel log contains a few instances of

    loop_set_status: loop0 () has still dirty pages (nrpages=5)

My machine is now in a state where I can call

    until losetup -d /dev/loop0; do :; done

and the loop just keeps running.

I'm slightly confused why a read-only loop device would have dirty pages
in the first place, and I suspect that there is a kernel bug here that
allows me to enter an inconsistent state through a race condition if I
just attach and detach loop devices fast enough.

   Simon



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux