This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
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 2236103 - System drops to emergency when restarting a mount
Summary: System drops to emergency when restarting a mount
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.9
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Stepan Broz
QA Contact: Bryan Mason
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-30 10:59 UTC by Renaud Métrich
Modified: 2023-10-12 07:15 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-09-21 16:04:59 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github systemd systemd pull 6293 0 None Merged fstab-generator: Chase symlinks where possible 2023-09-05 13:48:17 UTC
Red Hat Issue Tracker   RHEL-6223 0 None Migrated None 2023-10-12 07:15:19 UTC
Red Hat Issue Tracker RHELPLAN-166946 0 None None None 2023-08-30 11:00:31 UTC

Description Renaud Métrich 2023-08-30 10:59:55 UTC
Description of problem:

When restarting a mount unit using "systemctl restart <mountpoint>.mount" command, the system enters Emergency target due to failure of local-fs.target.
The issue happens when having some unrelated mount point having a symlink component in its path, as shown in the example below:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# ls -l /mnt
total 0
drwxr-xr-x. 2 root root 6 Aug 30 11:52 mountpoint
drwxr-xr-x. 2 root root 6 Aug 30 11:52 othermountpoint
lrwxrwxrwx. 1 root root 1 Aug 30 11:58 symlinktoself -> .

# tail -2 /etc/fstab
/root/test_fs1       /mnt/symlinktoself/mountpoint    xfs     defaults  0 0
/root/test_fs2       /mnt/othermountpoint      xfs     defaults  0 0
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Here above, /etc/fstab uses a symlink component in first mount "/mnt/symlinktoself/mountpoint". The real path is "/mnt/mountpoint" but that path is not used on purpose.

When restarting mnt-othermountpoint.mount unit, system enters Emergency target.

Version-Release number of selected component (if applicable):

systemd-219-78.el7_9.7.x86_64

How reproducible:

Always

Steps to Reproduce:
1. Create the above setup

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  # truncate -s1G /root/test_fs1 && mkfs.xfs /root/test_fs1
  # truncate -s1G /root/test_fs2 && mkfs.xfs /root/test_fs2
  # cat >> /etc/fstab << EOF
  /root/test_fs1       /mnt/symlinktoself/mountpoint    xfs     defaults  0 0
  /root/test_fs2       /mnt/othermountpoint      xfs     defaults  0 0
  EOF

  # mkdir /mnt/othermountpoint /mnt/mountpoint
  # ln -s . /mnt/symlinktoself
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

2. Reboot the system and confirm mounts are up

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  # mount | grep test_
  /root/test_fs1 on /mnt/mountpoint type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
  /root/test_fs2 on /mnt/othermountpoint type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

3. Restart mnt-othermountpoint.mount unit

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  # systemctl restart mnt-othermountpoint.mount unit
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Actual results:

Emergency target being entered due to "mnt-symlinktoself-mountpoint.mount" failing because it's already mounted.

Expected results:

No issue

Additional info:

Digging into this, it appears the issue happens because of systemd not considering "mnt-symlinktoself-mountpoint.mount" and "mnt-mountpoint.mount" units being the same. systemd indeed sees 2 different units:

1. the "real" mount, based on /proc/self/mountinfo view, which is some "transient mount"

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  # systemctl status mnt-mountpoint.mount 
  ● mnt-mountpoint.mount - /mnt/mountpoint
     Loaded: loaded (/proc/self/mountinfo)
     Active: active (mounted) since Wed 2023-08-30 12:02:34 CEST; 51min ago
      Where: /mnt/mountpoint
       What: /dev/loop0
  
  Aug 30 12:02:34 vm-systemd7 systemd[1]: mnt-mountpoint.mount changed dead -> mounted

  # systemctl cat mnt-mountpoint.mount
  No files found for mnt-mountpoint.mount.
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

2. the "static" mount (generated by fstab-generator), which got mounted at boot but is now considered as unmounted

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  # systemctl status mnt-symlinktoself-mountpoint.mount 
  ● mnt-symlinktoself-mountpoint.mount - /mnt/symlinktoself/mountpoint
     Loaded: loaded (/etc/fstab; bad; vendor preset: disabled)
     Active: inactive (dead) since Wed 2023-08-30 12:02:34 CEST; 52min ago
      Where: /mnt/symlinktoself/mountpoint
       What: /root/test_fs1
       Docs: man:fstab(5)
             man:systemd-fstab-generator(8)
    Process: 575 ExecMount=/bin/mount /root/test_fs1 /mnt/symlinktoself/mountpoint -t xfs (code=exited, status=0/SUCCESS)
  
  Aug 30 12:02:34 vm-systemd7 systemd[1]: mnt-symlinktoself-mountpoint.mount changed dead -> mounting
  Aug 30 12:02:34 vm-systemd7 systemd[1]: Mounting /mnt/symlinktoself/mountpoint...
  Aug 30 12:02:34 vm-systemd7 systemd[575]: Executing: /bin/mount /root/test_fs1 /mnt/symlinktoself/mountpoint -t xfs
  Aug 30 12:02:34 vm-systemd7 systemd[1]: Child 575 belongs to mnt-symlinktoself-mountpoint.mount
  Aug 30 12:02:34 vm-systemd7 systemd[1]: Unwatching 575.
  Aug 30 12:02:34 vm-systemd7 systemd[1]: mnt-symlinktoself-mountpoint.mount mount process exited, code=exited status=0
  Aug 30 12:02:34 vm-systemd7 systemd[1]: mnt-symlinktoself-mountpoint.mount changed mounting -> mounted
  Aug 30 12:02:34 vm-systemd7 systemd[1]: Job mnt-symlinktoself-mountpoint.mount/start finished, result=done
  Aug 30 12:02:34 vm-systemd7 systemd[1]: Mounted /mnt/symlinktoself/mountpoint.
  Aug 30 12:02:34 vm-systemd7 systemd[1]: mnt-symlinktoself-mountpoint.mount changed mounted -> dead
  
  # systemctl cat mnt-symlinktoself-mountpoint.mount
  # /run/systemd/generator/mnt-symlinktoself-mountpoint.mount
  # Automatically generated by systemd-fstab-generator
  
  [Unit]
  SourcePath=/etc/fstab
  Documentation=man:fstab(5) man:systemd-fstab-generator(8)
  Before=local-fs.target
  
  [Mount]
  What=/root/test_fs1
  Where=/mnt/symlinktoself/mountpoint
  Type=xfs
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Due to this, when remounting some unrelated mount, systemd enqueues "local-fs.target/restart" job, which makes it realize "mnt-symlinktoself-mountpoint.mount" is not mounted, causing a mount to be done, which fails in "already mounted" because the mount is actually "mnt-mountpoint.mount".

The issue may apparently also happen during a "daemon-reload" but I wasn't able to trigger it.

Comment 4 RHEL Program Management 2023-09-21 15:38:07 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 5 RHEL Program Management 2023-09-21 16:04:59 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


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