Re: Kernel errors with overlay filesystem v22

From: Miklos Szeredi
Date: Thu May 29 2014 - 08:07:45 EST


On Thu, May 29, 2014 at 12:28:45PM +0100, David Howells wrote:
>
> This sequence of commands produces both errors:
>
> mount -t tmpfs lower_layer /lower
> mount -t tmpfs upper_layer /upper
> mkdir /upper/upper
> mkdir /upper/work
> mount -t overlayfs overlayfs /mnt -olowerdir=/lower,upperdir=/upper/upper,workdir=/upper/work
> # The lockdep error was reported in the above mount command

The lockdep error is due to lazyness on my part and trying to hold
mnt_want_write() on upper for the lifetime of the overlay. That doesn't work
well with the freeze protection part (sb_start_write()) because then upper can't
be frozen while the overlay is mounted, which is not what we want, I think.

So I'll just have to bite the bullet and add those mnt_want_write/mnt_end_write
to those vfs_* calls that need it.

> umount /mnt
> umount /upper
> # The dentry leak error was reported in the last umount command

Okay, this was just sloppy testing of the workdir thing that was added to this
version. Below patch fixes it.

Thanks,
Miklos


diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 04879abbbf98..3e2cbbce69e1 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -381,6 +381,7 @@ static void ovl_put_super(struct super_block *sb)
if (!(sb->s_flags & MS_RDONLY))
mnt_drop_write(ufs->upper_mnt);

+ dput(ufs->workdir);
mntput(ufs->upper_mnt);
mntput(ufs->lower_mnt);

@@ -706,7 +707,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)

mntput(upperpath.mnt);
mntput(lowerpath.mnt);
- mntput(workpath.mnt);
+ path_put(&workpath);

oe->__upperdentry = dget(upperpath.dentry);
oe->lowerdentry = lowerpath.dentry;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/