This is the case e.g. if JFFS2 partition is full.
see: https://www.mail-archive.com/linux-unionfs@vger.kernel.org/msg00246.html
(a small error in a logmessage was changed and reported upstream)
runtime tested on ar71xx with kernel 3.18.11 and r45772
this paritially fixes #19564
Signed-off-by: Thomas Huehn tho...@net.t-labs.tu-berlin.de
Signed-off-by: Bastian Bittorf bitt...@bluebottle.com
---
...-overlayfs-fallback-to-readonly-when-full.patch | 73 ++
1 file changed, 73 insertions(+)
create mode 100644
target/linux/generic/patches-3.18/912-overlayfs-fallback-to-readonly-when-full.patch
diff --git
a/target/linux/generic/patches-3.18/912-overlayfs-fallback-to-readonly-when-full.patch
b/target/linux/generic/patches-3.18/912-overlayfs-fallback-to-readonly-when-full.patch
new file mode 100644
index 000..9e5fad4
--- /dev/null
+++
b/target/linux/generic/patches-3.18/912-overlayfs-fallback-to-readonly-when-full.patch
@@ -0,0 +1,73 @@
+Index: linux-3.18.14/fs/overlayfs/copy_up.c
+===
+--- linux-3.18.14.orig/fs/overlayfs/copy_up.c 2015-05-20 17:04:50.0
+0200
linux-3.18.14/fs/overlayfs/copy_up.c 2015-05-29 13:58:51.281147554
+0200
+@@ -300,6 +300,9 @@
+ struct cred *override_cred;
+ char *link = NULL;
+
++ if (WARN_ON(!workdir))
++ return -EROFS;
++
+ ovl_path_upper(parent, parentpath);
+ upperdir = parentpath.dentry;
+
+Index: linux-3.18.14/fs/overlayfs/dir.c
+===
+--- linux-3.18.14.orig/fs/overlayfs/dir.c 2015-05-20 17:04:50.0
+0200
linux-3.18.14/fs/overlayfs/dir.c 2015-05-29 14:00:55.727646504 +0200
+@@ -222,6 +222,9 @@
+ struct kstat stat;
+ int err;
+
++ if (WARN_ON(!workdir))
++ return ERR_PTR(-EROFS);
++
+ err = ovl_lock_rename_workdir(workdir, upperdir);
+ if (err)
+ goto out;
+@@ -322,6 +325,9 @@
+ struct dentry *newdentry;
+ int err;
+
++ if (WARN_ON(!workdir))
++ return -EROFS;
++
+ err = ovl_lock_rename_workdir(workdir, upperdir);
+ if (err)
+ goto out;
+@@ -506,6 +512,9 @@
+ struct dentry *opaquedir = NULL;
+ int err;
+
++ if (WARN_ON(!workdir))
++ return -EROFS;
++
+ if (is_dir) {
+ opaquedir = ovl_check_empty_and_clear(dentry);
+ err = PTR_ERR(opaquedir);
+Index: linux-3.18.14/fs/overlayfs/super.c
+===
+--- linux-3.18.14.orig/fs/overlayfs/super.c2015-05-20 17:04:50.0
+0200
linux-3.18.14/fs/overlayfs/super.c 2015-05-29 14:05:45.901472157 +0200
+@@ -740,9 +740,17 @@
+ ufs-workdir = ovl_workdir_create(ufs-upper_mnt, workpath.dentry);
+ err = PTR_ERR(ufs-workdir);
+ if (IS_ERR(ufs-workdir)) {
+- pr_err(overlayfs: failed to create directory %s/%s\n,
+- ufs-config.workdir, OVL_WORKDIR_NAME);
+- goto out_put_lower_mnt;
++ if (err == -ENOSPC || err == -EROFS) {
++ pr_warning(overlayfs: failed to create work directory
++ (%s), mounting read-only\n,
++ err == ENOSPC ? ENOSPC : EROFS);
++ sb-s_flags |= MS_RDONLY;
++ ufs-workdir = NULL;
++ } else {
++ pr_err(overlayfs: failed to create directory %s/%s\n,
++ ufs-config.workdir, OVL_WORKDIR_NAME);
++ goto out_put_lower_mnt;
++ }
+ }
+
+ /*
--
2.4.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel