i/o error if next unused loop device is queried
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Bionic |
Fix Committed
|
Medium
|
Jorge Merlino | ||
Focal |
Fix Released
|
Medium
|
Jorge Merlino | ||
Jammy |
Fix Released
|
Medium
|
Unassigned | ||
parted (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
snapd (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
systemd (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
udev (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
[Impact]
* There's an I/O error on fsync() in a detached loop device if it has
been previously attached. The issue is that write cache is enabled in
the attach path in loop_configure() but it isn't disabled in the detach
path; thus it remains enabled in the block device regardless of whether
it is attached or not.
* fsync() on detached loop devices can be called by partition tools and
commands run by sosreport, so the unexpected kernel error message might
surprise users or even distract from the actual issue being
investigatedr. It might also trigger alerts in
logging/
[Fix]
* Disable write cache in the detach path
[Test Plan]
* Attach and detach an image to a loop device and test fsync return
value aterwards
# DEV=/dev/loop7
# IMG=/tmp/image
# truncate --size 1M $IMG
# losetup $DEV $IMG
# losetup -d $DEV
Before:
# strace -e fsync parted -s $DEV print 2>&1 | grep fsync
fsync(3) = -1 EIO (Input/output error)
Warning: Error fsyncing/closing /dev/loop7: Input/output error
[ 982.529929] blk_update_request: I/O error, dev loop7, sector 0 op 0x1:(WRITE) flags 0x800 phys_seg 0 prio class 0
After:
# strace -e fsync parted -s $DEV print 2>&1 | grep fsync
fsync(3) = 0
[Where problems could occur]
* The detach path for block devices is modified. Worst case scenario
would be an error when detaching loop devices.
description: | updated |
description: | updated |
tags: | added: sts |
description: | updated |
description: | updated |
description: | updated |
Changed in udev (Ubuntu): | |
status: | New → Invalid |
Changed in linux (Ubuntu): | |
status: | Incomplete → In Progress |
importance: | Undecided → Medium |
assignee: | nobody → Mauricio Faria de Oliveira (mfo) |
Changed in parted (Ubuntu): | |
status: | New → Invalid |
Changed in linux (Ubuntu): | |
assignee: | Mauricio Faria de Oliveira (mfo) → Eric Desrochers (slashd) |
Changed in linux (Ubuntu): | |
assignee: | Eric Desrochers (slashd) → nobody |
description: | updated |
Changed in linux (Ubuntu): | |
milestone: | none → focal-updates |
milestone: | focal-updates → none |
no longer affects: | udev (Ubuntu Focal) |
no longer affects: | systemd (Ubuntu Focal) |
no longer affects: | snapd (Ubuntu Focal) |
no longer affects: | parted (Ubuntu Focal) |
Changed in linux (Ubuntu Focal): | |
status: | New → In Progress |
assignee: | nobody → Jorge Merlino (jorge-merlino) |
Changed in linux (Ubuntu Focal): | |
importance: | Undecided → Medium |
Changed in linux (Ubuntu Jammy): | |
importance: | Undecided → Medium |
no longer affects: | parted (Ubuntu Bionic) |
no longer affects: | snapd (Ubuntu Bionic) |
no longer affects: | systemd (Ubuntu Bionic) |
no longer affects: | udev (Ubuntu Bionic) |
Changed in linux (Ubuntu Bionic): | |
status: | New → In Progress |
assignee: | nobody → Jorge Merlino (jorge-merlino) |
Changed in linux (Ubuntu Focal): | |
status: | In Progress → Fix Committed |
Changed in linux (Ubuntu Bionic): | |
importance: | Undecided → Medium |
Changed in linux (Ubuntu Bionic): | |
status: | In Progress → Fix Committed |
Booting with "systemd. log_level= debug" revealed:
Dec 18 17:26:22 ubuntu systemd- udevd[1326] : value '[dmi/id] sys_vendor' is 'QEMU' udevd[1326] : created db file '/run/udev/ data/b7: 2' for '/devices/ virtual/ block/loop2' udevd[1326] : created db file '/run/udev/ data/b7: 2' for '/devices/ virtual/ block/loop2' udevd[1326] : passed 293 byte device to netlink monitor 0x557a8c0f8680 virtual- block-loop2. device: Changed dead -> plugged virtual- block-loop2. device: Changed dead -> plugged freedesktop/ systemd1/ unit/dev_ 2dloop2_ 2edevice interface= org.freedesktop .DBus.Propertie s member= PropertiesChang ed cookie=1009 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a freedesktop/ systemd1/ unit/dev_ 2dloop2_ 2edevice interface= org.freedesktop .DBus.Propertie s member= PropertiesChang ed cookie=1010 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a udevd[1328] : created db file '/run/udev/ data/b7: 2' for '/devices/ virtual/ block/loop2' udevd[1328] : created db file '/run/udev/ data/b7: 2' for '/devices/ virtual/ block/loop2' udevd[1328] : passed 252 byte device to netlink monitor 0x557a8c0f8680 virtual- block-loop2. device: Installed new job sys-devices- virtual- block-loop2. device/ nop as 412 device/ nop as 413 virtual- block-loop2. device: Changed plugged -> dead virtual- block-loop2. device: Installed new job sys-devices- virtual- block-loop2. device/ nop as 14 device/ nop as 15 virtual- block-loop2. device: Changed plugged -> dead freedesktop/ systemd1/ unit/dev_ 2dloop2_ 2edevice interface= org.freedesktop .DBus.Propertie s member= PropertiesChang ed cookie=1028 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Dec 18 17:26:22 ubuntu systemd-
Dec 18 17:26:22 ubuntu systemd[1]: dev-loop2.device: Changed dead -> tentative
Dec 18 17:26:22 ubuntu systemd-
Dec 18 17:26:22 ubuntu systemd-
Dec 18 17:26:22 ubuntu systemd[1120]: dev-loop2.device: Changed dead -> tentative
...
Dec 18 17:26:22 ubuntu systemd[1120]: sys-devices-
Dec 18 17:26:22 ubuntu systemd[1120]: dev-loop2.device: Changed tentative -> plugged
Dec 18 17:26:22 ubuntu systemd-udevd[529]: passed 179 byte device to netlink monitor 0x557a8c0c7bc0
Dec 18 17:26:22 ubuntu systemd[1]: sys-devices-
Dec 18 17:26:22 ubuntu systemd[1]: dev-loop2.device: Changed tentative -> plugged
...
Dec 18 17:26:22 ubuntu systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/
Dec 18 17:26:22 ubuntu systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/
...
Dec 18 17:26:22 ubuntu systemd-
Dec 18 17:26:22 ubuntu systemd-
Dec 18 17:26:22 ubuntu systemd-
Dec 18 17:26:22 ubuntu systemd[1]: sys-devices-
Dec 18 17:26:22 ubuntu systemd[1]: dev-loop2.device: Installed new job dev-loop2.
Dec 18 17:26:22 ubuntu systemd[1]: sys-devices-
Dec 18 17:26:22 ubuntu systemd[1120]: sys-devices-
Dec 18 17:26:22 ubuntu systemd[1]: dev-loop2.device: Changed plugged -> dead
Dec 18 17:26:22 ubuntu systemd[1120]: dev-loop2.device: Installed new job dev-loop2.
Dec 18 17:26:22 ubuntu systemd[1120]: sys-devices-
Dec 18 17:26:22 ubuntu systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/
Dec 18 17:26:22 ubuntu systemd[1120]: dev-loop2.device: Changed plugged -> dead
Dec 18 17:26:22 ubuntu systemd[1]: Sent me...