Skip to content

Commit c6f9853

Browse files
committed
udev: use systemd service to remount tmpfs
Signed-off-by: Martin Wilck <[email protected]>
1 parent 7ea5416 commit c6f9853

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

remount-tmpfs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#! /bin/sh
2+
# Adapt tmpfs mounts after memory hot-add operations
3+
# See /usr/lib/udev/rules.d/80-hotplug-cpu-mem.rules
4+
while read src dst fs opts unused; do
5+
case $fs in
6+
tmpfs) mount -o remount "$dst";;
7+
esac
8+
done </proc/self/mounts

remount-tmpfs.service

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Unit]
2+
Description=Remount tmpfs file systems
3+
4+
[Service]
5+
Type=oneshot
6+
ExecStart=/usr/lib/udev/remount-tmpfs

suse-module-tools.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# kernel packages around that store sysctl files under /boot
2727
%bcond_without boot_sysctl
2828
%global sysctl_dropin %{_unitdir}/systemd-sysctl.service.d/50-kernel-uname_r.conf
29-
%global systemd_units %{?with_boot_sysctl:boot-sysctl.service} %{?with_kernel_sysctl:kernel-sysctl.service}
29+
%global systemd_units remount-tmpfs.service %{?with_boot_sysctl:boot-sysctl.service} %{?with_kernel_sysctl:kernel-sysctl.service}
3030

3131
# List of legacy file systems to be blacklisted by default
3232
%global fs_blacklist adfs affs bfs befs cramfs efs erofs exofs f2fs freevxfs hfs hfsplus hpfs jffs2 jfs kafs minix nilfs2 ntfs ntfs3 omfs orangefs pstore qnx4 qnx6 reiserfs romfs sysv ufs zonefs
@@ -150,6 +150,7 @@ echo 'Wants=kernel-sysctl.service' >>"%{buildroot}%{sysctl_dropin}"
150150
install -pm 644 boot-sysctl.service "%{buildroot}%{_unitdir}"
151151
echo 'Wants=boot-sysctl.service' >>"%{buildroot}%{sysctl_dropin}"
152152
%endif
153+
install -pm 644 remount-tmpfs.service "%{buildroot}%{_unitdir}"
153154

154155
install -d -m 755 "%{buildroot}%{_modulesloaddir}"
155156
for _x in modules-load.d/*.conf; do
@@ -165,6 +166,7 @@ install -pm 755 udev-trigger-generator %{buildroot}/usr/lib/systemd/system-gener
165166
# udev rules (formerly system-tuning-common-SUSE, udev-extra-rules)
166167
install -d -m 755 %{buildroot}%{_udevrulesdir}
167168
install -pm 644 udevrules/*.rules %{buildroot}%{_udevrulesdir}
169+
install -m 755 remount-tmpfs %{buildroot}/usr/lib/udev
168170

169171
mkdir -p %{buildroot}%{_defaultlicensedir}
170172

@@ -241,6 +243,7 @@ exit 0
241243
%{_unitdir}/systemd-sysctl.service.d
242244
%{_modulesloaddir}
243245
%{_udevrulesdir}
246+
/usr/lib/udev/remount-tmpfs
244247
%dir %{dracutlibdir}
245248
%{dracutlibdir}/dracut.conf.d
246249
%ifarch ppc64 ppc64le

udevrules/80-hotplug-cpu-mem.rules

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ SUBSYSTEM=="cpu", CONST{arch}=="s390*", TEST=="online", ATTR{configure}=="1", AT
2020
# namespaces, ...)
2121
#
2222
SUBSYSTEM=="memory", CONST{arch}!="s390x", ATTR{state}=="offline", ATTR{state}="online", \
23-
RUN+="/bin/sh -c ' \
24-
while read src dst fs opts unused; do \
25-
case $$fs in \
26-
tmpfs) mount -o remount \"$$dst\" ;; \
27-
esac \
28-
done </proc/self/mounts"
23+
RUN+="/usr/bin/systemctl --no-block start remount-tmpfs.service"
2924

3025
LABEL="hotplug_cpu_end"

0 commit comments

Comments
 (0)