Skip to contentSkip to conversation

overlayfs fixes

PATCH Applied Andy Whitcroft 2 participants 5 messages Nov 17, 2010 – Nov 28, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover overlayfs fixes

I did some further testing of overlayfs using it to boot a live filesystem, which was unsuccessful overall. I found a couple of issues thrown up by using squashfs as the underlying layer. Following this email are a couple of fixes I used to get much closer.

Also, do you have a rebased version of this code for v2.6.37-rc2? I had a quick run at it and ended up messing it up (panics on boot).

-apw

Andy Whitcroft (2):
overlayfs: handle missing lower inodes in ovl_is_same_inode
overlayfs: ovl_copy_up_xattr -- handle EOPNOTSUPP from vfs_listxattr

 fs/overlayfs/overlayfs.c |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)
#1 lore raw

PATCH 1/2 overlayfs: handle missing lower inodes in ovl_is_same_inode

---
 fs/overlayfs/overlayfs.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)
fs/overlayfs/overlayfs.c +14 -8
index 63afa3d..6b8a7b9 100644
@@ -1948,19 +1948,25 @@ static int ovl_remount_fs(struct super_block *sb, int *flagsp, char *data)
 
 static bool ovl_is_same_inode(struct dentry *d1, struct dentry *d2)
 {
-	struct dentry *upperd1;
-	struct dentry *upperd2;
+	struct dentry *od1;
+	struct dentry *od2;
 
-	upperd1 = ovl_dentry_upper(d1);
-	upperd2 = ovl_dentry_upper(d2);
+	od1 = ovl_dentry_upper(d1);
+	od2 = ovl_dentry_upper(d2);
 
-	if (upperd1 && upperd2)
-		return vfs_is_same_inode(upperd1, upperd2);
+	if (od1 && od2)
+		return vfs_is_same_inode(od1, od2);
 
-	if (upperd1 || upperd2)
+	if (od1 || od2)
 		return false;
 
-	return vfs_is_same_inode(ovl_dentry_lower(d1), ovl_dentry_lower(d2));
+	od1 = ovl_dentry_lower(d1);
+	od2 = ovl_dentry_lower(d2);
+
+	if (od1 && od2)
+		return vfs_is_same_inode(od1, od2);
+
+	return false;
 }
 
 /**
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/2 overlayfs: ovl_copy_up_xattr -- handle EOPNOTSUPP from vfs_listxattr

In reply to Andy Whitcroft

Even when an underlying filesystem had a getxattr op it may not support xattrs. In this case vfs_listxattr will return EOPNOTSUPP. Handle this return when copying up attributes.

---
 fs/overlayfs/overlayfs.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
fs/overlayfs/overlayfs.c +4 -1
index 6b8a7b9..1148b8c 100644
@@ -692,8 +692,11 @@ static int ovl_copy_up_xattr(struct dentry *old, struct dentry *new)
 		return 0;
 
 	list_size = vfs_listxattr(old, NULL, 0);
-	if (list_size <= 0)
+	if (list_size <= 0) {
+		if (list_size == -EOPNOTSUPP)
+			return 0;
 		return list_size;
+	}
 
 	buf = kzalloc(list_size, GFP_KERNEL);
 	if (!buf)
Signature · 1 line
1.7.0.4
maintainer Applied
#3 lore raw
In reply to Andy Whitcroft
Quoted 1 line · Andy Whitcroft

overlayfs: handle missing lower inodes in ovl_is_same_inode

I don't see how this could be needed. vfs_is_same_inode() checks if the dentries are positive. In that case either the upper dentry or the lower dentry or both must exist.

Quoted 1 line

overlayfs: ovl_copy_up_xattr -- handle EOPNOTSUPP from vfs_listxattr

Applied. Thanks, Andy.

I pushed an updated version based on v2.6.37-rc3 to the overlayfs.v5 branch:

git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git overlayfs.v5

Thanks,
Miklos

#4 lore raw
Quoted 6 lines · Miklos Szeredi
Quoted 1 line · Andy Whitcroft

overlayfs: handle missing lower inodes in ovl_is_same_inode

I don't see how this could be needed. vfs_is_same_inode() checks if the dentries are positive. In that case either the upper dentry or the lower dentry or both must exist.

It was cirtinaly exploding in my tests without that change. The test case was overlaying a tmpfs over a squashfs.

Quoted 11 lines
Quoted 1 line

overlayfs: ovl_copy_up_xattr -- handle EOPNOTSUPP from vfs_listxattr

Applied. Thanks, Andy.

I pushed an updated version based on v2.6.37-rc3 to the overlayfs.v5 branch:

git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git overlayfs.v5

Thanks,
Miklos

I'll retest with that version and see if the first patch is still required.

Thanks for the updated version.

-apw