Skip to contentSkip to conversation

lxc: Skip rootfs pinning for read-only filesystem

PATCH New sana kazi 1 participant 1 message Sep 15, 2021

lore
Share & tools
lore

sana kazi

author
#0 lore raw

PATCH 1/1 lxc: Skip rootfs pinning for read-only filesystem

Added patch to skip rootfs pinning for read-only filesystem which fixes below issue:

lxc-start[1559]: Error: oap: conf - conf.c:lxc_rootfs_init:581
- Read-only file system - Failed to pin rootfs lxc-start[1744]: Error: node1: conf - conf.c:lxc_rootfs_init:581
- Read-only file system - Failed to pin rootfs lxc-start[1745]: Error: ivi: conf - conf.c:lxc_rootfs_init:581
- Read-only file system - Failed to pin rootfs

---
 ...tfs_pinning_for_read_only_filesystem.patch | 30 +++++++++++++++++++
 recipes-containers/lxc/lxc_4.0.9.bb           |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 recipes-containers/lxc/files/skip_rootfs_pinning_for_read_only_filesystem.patch
recipes-containers/lxc/files/skip_rootfs_pinning_for_read_only_filesystem.patch new file +30 -0
new file mode 100644
index 0000000..c29d996
@@ -0,0 +1,30 @@
+From e859a5ee2cdee5111185a6a629f891aa40b2ffd6 Mon Sep 17 00:00:00 2001
+From: Wei Mingzhi <[email protected]>
+Date: Tue, 18 May 2021 20:37:52 +0800
+Subject: [PATCH] Skip rootfs pinning for read-only file system.
+
+Signed-off-by: Wei Mingzhi <[email protected]>
+---
+ src/lxc/conf.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+Upstream-Status: Backport [https://github.com/lxc/lxc/commit/966dad2494dda4948f1508bcd0e444f1d65b2df8.patch]
+Comment: No change in any hunk
+
+diff --git a/src/lxc/conf.c b/src/lxc/conf.c
+index 7a248c2685..4b427c08d2 100644
+--- a/src/lxc/conf.c
++++ b/src/lxc/conf.c
+@@ -573,8 +573,12 @@ int lxc_rootfs_init(struct lxc_conf *conf, bool userns)
+ 			 PROTECT_OPEN | O_CREAT,
+ 			 PROTECT_LOOKUP_BENEATH,
+ 			 S_IWUSR | S_IRUSR);
+-	if (fd_pin < 0)
++	if (fd_pin < 0) {
++		if (errno == EROFS) {
++			return log_trace_errno(0, EROFS, "Not pinning on read-only filesystem");
++		}
+ 		return syserror("Failed to pin rootfs");
++	}
+ 
+ 	TRACE("Pinned rootfs %d(.lxc_keep)", fd_pin);
recipes-containers/lxc/lxc_4.0.9.bb +1 -0
index 6720733..ad2416f 100644
@@ -50,6 +50,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}/${BPN}-${PV}.tar.gz \
 	file://dnsmasq.conf \
 	file://lxc-net \
         file://enable_seccomp_profile_when_compiled_libseccomp.patch \
+        file://skip_rootfs_pinning_for_read_only_filesystem.patch \
 	"
 
 SRC_URI[md5sum] = "365fcca985038910e19a1e0fff15ed07"
Signature · 1 line
2.17.1