-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
losetup -d
exits 0 when it doesn't succeed
#484
Comments
Come to think of it, |
The question is if we can do anything in userspace. It would be nice to have strace output from "losetup -d" to see what kernel returns. I guess for losetup it seems that the ioctl has been successful. |
... so for losetup, all works as expected. |
It seems like this is a kernel issue then. Any tips on where to raise it? |
You can ask kernel developers, but I don't think it's a bug. The command "umount --lazy" removed FS from VFS tree, but the FS is internally still referenced and real clean up of all FS resources is postponed (until no process uses FS). This also affects loop device autoclear flag, the device has to stay active as it's used by the FS. The LOOP_CLR_FD kernel code does nothing if there is any active device reader, the device is marked as "autoclear" and kernel returns 0. It means syscall is successful, but device will be removed later. I cannot imagine another solution. I'll add note about this LOOP_CLR_FD behaviour to losetup man page. |
See http://permalink.gmane.org/gmane.linux.kernel.commits.head/348218 for more details. |
Steps to reproduce issue:
Create a ext4 filesystem called
filesystem
:Nil output shows that there are currently no loop devices.
Mount
filesystem
on/mnt/tmp
and show loop device:Have a process use the mountpoint
/mnt/tmp
as its working directory:Show processes using
/mnt/tmp
. Note the PID agrees with the one above.Lazy unmount
/mnt/tmp
, detaching loop device:Try to explicitly remove the loop device:
But it's still there:
and I can't find out what processes are using it as a working directory:
So, let's ask explicitly for the PIDs given above:
Hmm, so the working directory has changed from
/mnt/tmp
to/
... then why is/dev/loop0
not unmounting?Kill the processes which were using
/mnt/tmp
as working directory:And now, finally,
/dev/loop0
disappears:The text was updated successfully, but these errors were encountered: