Skip to content

Commit

Permalink
umount, losetup: Document loop destroy behavior
Browse files Browse the repository at this point in the history
The loop device detach runs asynchronously in the background. It can cause
unexpected errors. Document the possible existence of the loop device after
exit of losetup -d or umount and need of "udevadm settle".

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
  • Loading branch information
stanislav-brabec authored and karelzak committed Jun 20, 2024
1 parent 6850e89 commit fc67f18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sys-utils/losetup.8.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The _size_ and _offset_ arguments may be followed by the multiplicative suffixes
Show the status of all loop devices. Note that not all information is accessible for non-root users. See also *--list*. The old output format (as printed without *--list*) is deprecated.

*-d*, *--detach* _loopdev_...::
Detach the file or device associated with the specified loop device(s). Note that since Linux v3.7 kernel uses "lazy device destruction". The detach operation does not return *EBUSY* error anymore if device is actively used by system, but it is marked by autoclear flag and destroyed later.
Detach the file or device associated with the specified loop device(s). Note that since Linux v3.7 kernel uses "lazy device destruction". The detach operation does not return *EBUSY* error anymore if device is actively used by system, but it is marked by autoclear flag and destroyed later. Even if the device is not used, the loop device can be destroyed later. If you need to wait for a complete removal of the loop device, call *udevadm settle* after *losetup*.

*-D*, *--detach-all*::
Detach all associated loop devices.
Expand Down
2 changes: 2 additions & 0 deletions sys-utils/umount.8.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ The *umount* command will automatically detach loop device previously initialize

In this case the device is initialized with "autoclear" flag (see *losetup*(8) output for more details), otherwise it's necessary to use the option *--detach-loop* or call *losetup -d* _device_. The autoclear feature is supported since Linux 2.6.25.

Note that since Linux v3.7 kernel uses "lazy device destruction". The system just marks the loop device by autoclear flag and destroys it later. If you need to wait for a complete removal of the loop device, call *udevadm settle* after *umount*.

== EXIT STATUS

*umount* has the following exit status values (the bits can be ORed):
Expand Down

0 comments on commit fc67f18

Please sign in to comment.