svn commit: r212221 - in head: sbin/mount_unionfs sys/fs/unionfs

Daichi GOTO daichi at FreeBSD.org
Sun Sep 5 04:58:17 UTC 2010


Author: daichi
Date: Sun Sep  5 04:58:16 2010
New Revision: 212221
URL: http://svn.freebsd.org/changeset/base/212221

Log:
  Allowed unionfs to use whiteout not supporting file system as
  upper layer. Until now, unionfs prevents to use that kind of
  file system as upper layer. This time, I changed to allow
  that kind of file system as upper layer. By this change, you
  can use whiteout not supporting file system (e.g., especially
  for tmpfs) as upper layer. It's very useful for combination of
  tmpfs as upper layer and read only file system as lower layer.
  
  By difinition, 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.  EOPNOTSUPP is
  returned for this kind of operations as generated by VOP_WHITEOUT()
  along with any others which would make modifica tions to the
  lower layer, such as chmod(1).
  
  This change is suggested by ed.
  
  Submitted by:	ed

Modified:
  head/sbin/mount_unionfs/mount_unionfs.8
  head/sys/fs/unionfs/union_vfsops.c

Modified: head/sbin/mount_unionfs/mount_unionfs.8
==============================================================================
--- head/sbin/mount_unionfs/mount_unionfs.8	Sun Sep  5 03:05:03 2010	(r212220)
+++ head/sbin/mount_unionfs/mount_unionfs.8	Sun Sep  5 04:58:16 2010	(r212221)
@@ -363,9 +363,10 @@ their intent to take it over.
 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.
-.Er EROFS
-is returned for this kind of operations along with any others
-which would make modifications to the lower layer, such as
+.Er EOPNOTSUPP
+is returned for this kind of operations as generated by VOP_WHITEOUT()
+along with any others which would make modifications to the lower 
+layer, such as
 .Xr chmod 1 .
 .Pp
 Running

Modified: head/sys/fs/unionfs/union_vfsops.c
==============================================================================
--- head/sys/fs/unionfs/union_vfsops.c	Sun Sep  5 03:05:03 2010	(r212220)
+++ head/sys/fs/unionfs/union_vfsops.c	Sun Sep  5 04:58:16 2010	(r212221)
@@ -89,7 +89,6 @@ unionfs_domount(struct mount *mp)
 	u_short		ufile;
 	unionfs_copymode copymode;
 	unionfs_whitemode whitemode;
-	struct componentname fakecn;
 	struct nameidata nd, *ndp;
 	struct vattr	va;
 
@@ -280,26 +279,6 @@ unionfs_domount(struct mount *mp)
 	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);


More information about the svn-src-all mailing list