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(-)
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.
Signed-off-by: Andy Whitcroft <[email protected]>
---
fs/overlayfs/overlayfs.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/fs/overlayfs/overlayfs.c b/fs/overlayfs/overlayfs.c
index 6b8a7b9..1148b8c 100644
--- a/fs/overlayfs/overlayfs.c
+++ b/fs/overlayfs/overlayfs.c
@@ -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)
--
1.7.0.4
Signed-off-by: Andy Whitcroft <[email protected]>
---
fs/overlayfs/overlayfs.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/fs/overlayfs/overlayfs.c b/fs/overlayfs/overlayfs.c
index 63afa3d..6b8a7b9 100644
--- a/fs/overlayfs/overlayfs.c
+++ b/fs/overlayfs/overlayfs.c
@@ -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;
}
/**
--
1.7.0.4
On Wed, 17 Nov 2010, Andy Whitcroft wrote:
> 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.
> 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
On Thu, Nov 25, 2010 at 04:06:55PM +0100, Miklos Szeredi wrote:
> On Wed, 17 Nov 2010, Andy Whitcroft wrote:
> > 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.
> > 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