Bug 1067422

Summary: Mark loop devices with no file attached as SYSTEMD_READY=0
Product: Red Hat Enterprise Linux 7 Reporter: Peter Rajnoha <prajnoha>
Component: systemdAssignee: systemd-maint
Status: CLOSED CURRENTRELEASE QA Contact: Petr Sklenar <psklenar>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: agk, harald, jscotka, lnykryn, systemd-maint-list, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-208-8.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:54:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1063813    
Attachments:
Description Flags
Patch to use SYSTEMD_READY=0 for uninitialized loop devices none

Description Peter Rajnoha 2014-02-20 12:42:22 UTC
Created attachment 865494 [details]
Patch to use SYSTEMD_READY=0 for uninitialized loop devices

Based on man 5 systemd.device:

SYSTEMD_READY=
           If set to 0, systemd will consider this device unplugged even if it shows up in the udev tree. If this property is unset or set to 1, the device will be considered plugged the
           moment it shows up in the udev tree. This property has no influence on the behavior when a device disappears from the udev tree. This option is useful to support devices that
           initially show up in an uninitialized state in the tree, and for which a "changed" event is generated the moment they are fully set up. Note that SYSTEMD_WANTS= (see above) is
           not acted on as long as SYSTEMD_READY=0 is set for a device.


I think we should use SYSTEMD_READY=0 for loop devices that have no file attached yet and hence they're not ready for use until some file is attached.

Otherwise, we can get into a problem when we try to bind a service to *usable* loop device (e.g. bug #1063813).

(patch attached)

Comment 2 Peter Rajnoha 2014-03-05 09:49:18 UTC
If possible, please try to squeeze this patch into RHEL 7.0. Thanks!

Comment 3 Peter Rajnoha 2014-03-05 13:48:52 UTC
Requesting a blocker for this one since this makes LVM on loop devices unusable when detaching and attaching again a file to a loop device.

Also, based on the definition of SYSTEMD_READY that systemd uses to declare a device as properly initialized or not, clearly, the loop device without its backing file is not initialized.

The patch is simple one-liner - it's checking the existence of loop/backing_file sysfs file existence which exists only if the loop device has a file attached and it sets SYSTEMD_READY based on this information.

Comment 4 Harald Hoyer 2014-03-05 16:09:13 UTC
Looks good to me. Care to send that patch upstream?

Comment 5 Peter Rajnoha 2014-03-06 08:17:36 UTC
(In reply to Harald Hoyer from comment #4)
> Looks good to me. Care to send that patch upstream?

Sent: http://lists.freedesktop.org/archives/systemd-devel/2014-March/017647.html

Comment 8 Ludek Smid 2014-06-13 11:54:26 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.