[lkml]   [2011]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [PATCH 0/7] overlay filesystem: request for inclusion
"J. R. Okajima" <> writes:

> Miklos Szeredi:
>> Here's a patch to document these limitations.
> If you want covering limitations as possible, I'd suggest you to add
> these.
> - Some versions of GNU find(1) may produce a warning about the link
> count of a directory. When a sub dir exists, find(1) expects it
> increments the link count of the parent dir.

st_nlink==1 for directories is widely accepted way of saying that the
number of subdirectories is unknown. Various filesystems already do
this, and versions of GNU utils that I have come across accept it.

> - If I remember correctly, Valerie Aurora has pointed out that
> open(O_RDONLY) + fchmod() will work correctly in UnionMount.
> It is true in overlayfs too?

Neither union-mounts nor overlayfs can handle this case.

I hadn't thought about this case, so overlayfs would modify the lower
filesystem in that case, which is a no-no.

Following patch fixes this and return -EROFS for the above case. I also
updated the non-standard section in the docs.


Subject: ovl: make lower mount read-only

From: Miklos Szeredi <>

If a file only existing on the lower fs is operned for O_RDONLY and
fchmod/fchown/etc is performed on the open file then this will modify
the lower fs, which is not what we want.

Copying up at this point is not possible. The best solution is to
return an error for this corner case and hope applications are not
relying on it.

Reported-by: "J. R. Okajima" <>
Signed-off-by: Miklos Szeredi <>
fs/overlayfs/super.c | 6 ++++++
1 file changed, 6 insertions(+)

Index: linux-2.6/fs/overlayfs/super.c
--- linux-2.6.orig/fs/overlayfs/super.c 2011-07-15 12:48:03.000000000 +0200
+++ linux-2.6/fs/overlayfs/super.c 2011-07-15 13:47:35.000000000 +0200
@@ -569,6 +569,12 @@ static int ovl_fill_super(struct super_b
goto out_put_upper_mnt;

+ /*
+ * Make lower_mnt R/O. That way fchmod/fchown on lower file
+ * will fail instead of modifying lower fs.
+ */
+ ufs->lower_mnt->mnt_flags |= MNT_READONLY;
/* If the upper fs is r/o, we mark overlayfs r/o too */
if (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY)
sb->s_flags |= MS_RDONLY;

 \ /
  Last update: 2011-07-15 14:35    [W:0.068 / U:11.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site