From e859a5ee2cdee5111185a6a629f891aa40b2ffd6 Mon Sep 17 00:00:00 2001 From: Wei Mingzhi Date: Tue, 18 May 2021 20:37:52 +0800 Subject: [PATCH] Skip rootfs pinning for read-only file system. Signed-off-by: Wei Mingzhi --- src/lxc/conf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 7a248c268..4b427c08d 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); -- 2.47.2