RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1693374 - Using quotas on iSCSI-hosed filesystems causes systemd "ordering cycle" resulting in random services not starting on boot
Summary: Using quotas on iSCSI-hosed filesystems causes systemd "ordering cycle" resul...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.6
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: David Tardon
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-27 16:47 UTC by Chris Tracy
Modified: 2020-09-29 20:33 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-09-29 20:32:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Full set of ordering cycles broken on a single boot (11.90 KB, text/plain)
2019-03-27 16:47 UTC, Chris Tracy
no flags Details
Full boot log from the same boot (180.76 KB, text/plain)
2019-03-27 16:50 UTC, Chris Tracy
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github systemd systemd pull 5627 0 None closed units: move Before deps for quota services to remote-fs.target 2020-06-22 12:52:53 UTC
Red Hat Product Errata RHSA-2020:4007 0 None None None 2020-09-29 20:33:11 UTC

Description Chris Tracy 2019-03-27 16:47:06 UTC
Created attachment 1548682 [details]
Full set of ordering cycles broken on a single boot

Description of problem:
Setting up an iSCSI filesystem in /etc/fstab like so:

/dev/sdb /mnt/test0 xfs _netdev,defaults,usrquota,grpquota 0 0

results in systemd randomly killing certain targets/services to break the resulting ordering cycle on boot.  The exact cycle varies boot to boot, but an example is:

Mar 27 11:26:46 iscsi-client systemd[1]: Found ordering cycle on sysinit.target/start
Mar 27 11:26:46 iscsi-client systemd[1]: Found dependency on selinux-policy-migrate-local-changes/start
Mar 27 11:26:46 iscsi-client systemd[1]: Found dependency on local-fs.target/start
Mar 27 11:26:46 iscsi-client systemd[1]: Found dependency on quotaon.service/start
Mar 27 11:26:46 iscsi-client systemd[1]: Found dependency on mnt-test0.mount/start
Mar 27 11:26:46 iscsi-client systemd[1]: Found dependency on network-online.target/start
Mar 27 11:26:46 iscsi-client systemd[1]: Found dependency on network.service/start
Mar 27 11:26:46 iscsi-client systemd[1]: Found dependency on basic.target/start
Mar 27 11:26:46 iscsi-client systemd[1]: Found dependency on paths.target/start
Mar 27 11:26:46 iscsi-client systemd[1]: Found dependency on brandbot.path/start
Mar 27 11:26:46 iscsi-client systemd[1]: Found dependency on sysinit.target/start
Mar 27 11:26:46 iscsi-client systemd[1]: Breaking ordering cycle by deleting job selinux-policy-migrate-local-changes/start
<snip many many more such cycles>

In short, on this current boot, having an iSCSI filesystem with quotas enabled has resulting in the following jobs being deleted from the boot cycle and thus not being run:

selinux-policy-migrate-local-changes/start
systemd-update-done.service/start
rhel-import-state.service/start
systemd-machine-id-commit.service/start
rhel-autorelabel.service/start
plymouth-read-write.service/start
rhel-autorelabel-mark.service/start
auditd.service/start
systemd-tmpfiles-setup.service/start
local-fs.target/start

In this particular case, auditd.service is particularly concerning, as is systemd-tmpfiles-setup.service as that's what creates things under /run/ like /run/samba which in turn results in samba failing to start.

I don't understand systemd ordering/dependencies enough to explain how to fix it, but it seems the quotaon and systemd-quotacheck service dependencies can't properly handle an iSCSI (and thus _netdev, and thus remote-fs.target) filesystem.  (Looks like quotas were only ever assumed to be active on local-fs.target filesystems?)

Version-Release number of selected component (if applicable):
systemd-219-62.el7_6.5.x86_64

How reproducible:
100% in all my testing.


Steps to Reproduce:
1. Have iSCSI target client can connect to.  (Can be a SAN or another box running targetcli)
2. Install a minimal 7.6 client with iscsi-initiator-utils
3. Connect client to target, create filesystem on device, put device into fstab with "_netdev,defaults,usrquota" as options

Actual results:
Systemd kills several jobs that should run on boot, nondeterministically.  (The jobs killed vary from boot to boot)  This results in the system being in a randomly broken state, depending on which jobs didn't get run.


Expected results:
System boots normally even when an iSCSI filesystem in fstab has quotas enabled.


Additional info:
Full set of logged cycles from a single boot attached.

Comment 2 Chris Tracy 2019-03-27 16:50:49 UTC
Created attachment 1548683 [details]
Full boot log from the same boot

Comment 3 Chris Tracy 2019-03-27 17:13:21 UTC
Looking to find the simplest possible steps to reproduce this, I found it doesn't matter if the filesystem device is actually network-based or not, just that it's marked with "_netdev" (and "usrquota" or "grpquota")

So here's a complete set of steps to reproduce the issue:

- Start with minimal 7.6 install
# dd if=/dev/zero of=/root/test.img bs=1M count=1024
# mkfs.xfs /root/test.img
# mkdir /mnt/test
# cat >> /etc/fstab << EOF
/root/test.img  /mnt/test       xfs     loop,defaults,_netdev,usrquota 0 0
EOF
- Reboot
# journalctl -b | egrep -i '(ordering|dependency)'

Comment 4 Chris Tracy 2019-03-27 17:18:19 UTC
For what it's worth, it looks like a similar bug was reported here, but didn't call out quotas mixed with "_netdev" as the source of the issue:
https://bugzilla.redhat.com/show_bug.cgi?id=1471922

Comment 5 Chris Tracy 2019-03-27 18:41:09 UTC
In my particular case, since I only need quotas on _netdev devices, I can workaround the issue by creating full overrides (because dependencies can only be added to not cleared/modified otherwise) ala:

# systemctl edit --full quotaon.service
# systemctl edit --full systemd-quotacheck.service

and in both replacing the line:

Before=local-fs.target shutdown.target

to:

Before=remote-fs.target shutdown.target

I don't understand systemd's ordering enough to know if this is a sane fix or not in the general case.  In theory, if remote-fs.target is always after local-fs.target, then having quotacheck/quotaon set to before remote-fs.target *should* work...maybe?  Since they both need to run after all quota-using filesystems are mounted by before they actually get used.  Or maybe the saner course is to just split things into two sets of quota units, one for local and one for remote?

Comment 6 Chris Tracy 2019-03-27 18:49:18 UTC
Actually, it looks like that's exactly the fix that upstream used, now that I actually look at the code:

https://github.com/systemd/systemd/commit/4e6f13af93a551933a75331b1f67123b3d09f6ef

Comment 7 David Tardon 2019-12-13 14:23:16 UTC
PR: https://github.com/systemd-rhel/rhel-7/pull/60

Comment 9 Lukáš Nykrýn 2020-04-27 13:17:58 UTC
fix merged to github master branch -> https://github.com/systemd-rhel/rhel-7/pull/60

Comment 15 errata-xmlrpc 2020-09-29 20:32:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Low: systemd security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:4007


Note You need to log in before you can comment on or make changes to this bug.