Bug 2036608

Summary: Rate-limiting mount events can make starting/stopping mount units unreliable
Product: Red Hat Enterprise Linux 8 Reporter: Michal Sekletar <msekleta>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: high Docs Contact:
Priority: unspecified    
Version: 8.5CC: dtardon, systemd-maint-list
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-239-55.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2037395 2095950 (view as bug list) Environment:
Last Closed: 2022-05-10 15:25:48 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: 2037395, 2095950    

Description Michal Sekletar 2022-01-03 11:26:30 UTC
Description of problem:
When we enter rate-limited state we completely disregard /proc/self/mountinfo notifications for some time. If during that time, some mount unit is active (mounted) and the unit gets unmounted manually systemd will still track its state as active (mounted). Subsequent Start() operation on such unit will be effectively NOP. After leaving rate-limited state we will have inconsistency. Mount is unmounted, but systemd will still considered unit as active (mounted).


Version-Release number of selected component (if applicable):
systemd-239-54.el8.x86_64

How reproducible:
deterministic

Steps to Reproduce:
echo 'tmpfs /mnt tmpfs defaults,nofail 0 0' >> /etc/fstab
systemctl daemon-reload 
mkdir -p foo
systemctl start mnt.mount
for ((i=0;i<50;++i)); do mount --bind foo foo; umount foo; done;
umount /mnt; systemctl start mnt.mount; echo $?; mountpoint /mnt; systemctl status mnt.mount; mountpoint /mnt

Actual results:
0
/mnt is not a mountpoint
● mnt.mount - /mnt
   Loaded: loaded (/etc/fstab; generated)
   Active: active (mounted) since Mon 2022-01-03 05:22:08 EST; 54min ago
    Where: /mnt
     What: tmpfs
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
    Tasks: 0 (limit: 11356)
   Memory: 4.0K
   CGroup: /system.slice/mnt.mount

Jan 03 05:22:08 ci-vm-10-0-136-183.hosted.upshift.rdu2.redhat.com systemd[1]: mnt.mount: Directory /mnt to mount over is not empty, mounting anyway.
Jan 03 05:22:08 ci-vm-10-0-136-183.hosted.upshift.rdu2.redhat.com systemd[1]: Mounting /mnt...
Jan 03 05:22:08 ci-vm-10-0-136-183.hosted.upshift.rdu2.redhat.com systemd[1]: Mounted /mnt.
/mnt is not a mountpoint

Expected results:
/mnt is mounted as a result of systemctl start mnt.mount.

Additional info:
https://github.com/systemd/systemd/issues/20329

Comment 2 Plumber Bot 2022-01-05 13:40:26 UTC
fix merged to github master branch -> https://github.com/redhat-plumbers/systemd-rhel8/pull/245

Comment 9 errata-xmlrpc 2022-05-10 15:25:48 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 (systemd bug fix and enhancement 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/RHBA-2022:2069