Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Aug 2010 09:23:24 +0900
From:      Daichi GOTO <daichi@ongs.co.jp>
To:        ed@80386.nl, freebsd-current@freebsd.org, freebsd-fs@freebsd.org,  ozawa@ongs.co.jp
Subject:   unionfs a little improvement
Message-ID:  <4C6C797C.5000409@ongs.co.jp>

next in thread | raw e-mail | index | archive | help
Hi Ed and unionfs fan gyus.

Ed pointed out a contradict behavior between current
unionfs implementation and its manual, and sent me a
patch.

Thanks Ed ;)

----
Index: sys/fs/unionfs/union_vfsops.c
===================================================================
--- sys/fs/unionfs/union_vfsops.c	(revision 211093)
+++ sys/fs/unionfs/union_vfsops.c	(working copy)
@@ -89,7 +89,6 @@
  	u_short		ufile;
  	unionfs_copymode copymode;
  	unionfs_whitemode whitemode;
-	struct componentname fakecn;
  	struct nameidata nd, *ndp;
  	struct vattr	va;

@@ -280,26 +279,6 @@
  	mp->mnt_flag |= ump->um_uppervp->v_mount->mnt_flag & MNT_RDONLY;

  	/*
-	 * Check whiteout
-	 */
-	if ((mp->mnt_flag & MNT_RDONLY) == 0) {
-		memset(&fakecn, 0, sizeof(fakecn));
-		fakecn.cn_nameiop = LOOKUP;
-		fakecn.cn_thread = td;
-		error = VOP_WHITEOUT(ump->um_uppervp, &fakecn, LOOKUP);
-		if (error) {
-			if (below) {
-				VOP_UNLOCK(ump->um_uppervp, 0);
-				vrele(upperrootvp);
-			} else
-				vput(ump->um_uppervp);
-			free(ump, M_UNIONFSMNT);
-			mp->mnt_data = NULL;
-			return (error);
-		}
-	}
-
-	/*
  	 * Unlock the node
  	 */
  	VOP_UNLOCK(ump->um_uppervp, 0);

----

Ed's message here:

----
Just for fun I was hacking on a writable bootcd, using unionfs and
tmpfs. I noticed tmpfs doesn't support whiteouts (yet). This prevents
unionfs from mounting tmpfs on top. I do want to be able to use tmpfs,
even if it means we can't get any whiteouts.

The manpage says the following:

     Without whiteout support from the file system backing the upper layer,
     there is no way that delete and rename operations on lower layer 
objects
     can be done.  EROFS is returned for this kind of operations along with
     any others which would make modifications to the lower layer, such as
     chmod(1).

This seems to contradict the current behaviour, which is to deny the
mount altogether. The attached patch makes it work, but instead of
EROFS, it now returns EOPNOTSUPP, as generated by VOP_WHITEOUT().
----


It looks like reasonable and patch is simple and effective I guess.
If you unionfs guys or fs guys have some ideas around this patch,
please teach me.

After some tests and a couple of weeks after, I'll commit ed's patch
if there is no objections.

-- 
Daichi GOTO
CEO | ONGS Inc.
81-42-316-7945 | daichi@ongs.co.jp | http://www.ongs.co.jp
LinkedIn: http://linkedin.com/in/daichigoto



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C6C797C.5000409>