From owner-freebsd-fs@FreeBSD.ORG Thu Feb 22 22:49:27 2007 Return-Path: X-Original-To: freebsd-fs@freebsd.org Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 83ABE16A406 for ; Thu, 22 Feb 2007 22:49:27 +0000 (UTC) (envelope-from rodrigc@crodrigues.org) Received: from alnrmhc15.comcast.net (alnrmhc15.comcast.net [204.127.225.95]) by mx1.freebsd.org (Postfix) with ESMTP id 597B113C491 for ; Thu, 22 Feb 2007 22:49:27 +0000 (UTC) (envelope-from rodrigc@crodrigues.org) Received: from c-66-31-35-94.hsd1.ma.comcast.net ([66.31.35.94]) by comcast.net (alnrmhc15) with ESMTP id <20070222222301b1500k47fre>; Thu, 22 Feb 2007 22:23:01 +0000 Received: from c-66-31-35-94.hsd1.ma.comcast.net (localhost.crodrigues.org [127.0.0.1]) by c-66-31-35-94.hsd1.ma.comcast.net (8.13.8/8.13.8) with ESMTP id l1MMN16X013497; Thu, 22 Feb 2007 17:23:02 -0500 (EST) (envelope-from rodrigc@c-66-31-35-94.hsd1.ma.comcast.net) Received: (from rodrigc@localhost) by c-66-31-35-94.hsd1.ma.comcast.net (8.13.8/8.13.8/Submit) id l1MMN14F013496; Thu, 22 Feb 2007 17:23:01 -0500 (EST) (envelope-from rodrigc) Date: Thu, 22 Feb 2007 17:23:01 -0500 From: Craig Rodrigues To: freebsd-current@freebsd.org Message-ID: <20070222222301.GA13464@crodrigues.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i Cc: freebsd-fs@freebsd.org Subject: What does "mount -o union" and MNT_UNION really do? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2007 22:49:27 -0000 Hi, As part of recent cleanups and stability fixes in vfs_syscalls.c, Kostik Belousov removed the union_dircheckp() callback which the old unionfs implementation used, but the new one does not. Now I am looking at the mount code in vfs_mount.c, and am trying to figure out what the MNT_UNION flag is used for, which is set by doing "mount -o union". The following code in vfs_mount.c sets it: else if (strcmp(opt->name, "union") == 0) fsflags |= MNT_UNION; However, the mount_unionfs binary never passes down "-o union", so the MNT_UNION flag is never set if you do: "mount -t unionfs" or "mount_unionfs". The mount(8) man page documents it as: union Causes the namespace at the mount point to appear as the union of the mounted file system root and the existing directory. Lookups will be done in the mounted file sys- tem first. If those operations fail due to a non-exis- tent file the underlying directory is then accessed. All creates are done in the mounted file system. Is there a legitimate case where you would want to do "mount -o union", and have it behave differently from "mount_unionfs / mount -t unionfs"? Or is this a leftover from a long time ago that we can now whack (it would simplify some code in the VFS layer if we whack it)? The MNT_UNION flag seemed to appear a long time ago: revision 1.120 date: 1999/03/03 02:35:51; author: julian; state: Exp; lines: +35 -33 Slight cleanup of code resurected for union mounts.. Submitted by: Tony Finch ---------------------------- revision 1.119 date: 1999/02/27 07:06:05; author: julian; state: Exp; lines: +23 -1 Fix code for union mounts Accidentally deleted by peter when he extracted the unionfs stuff in 1.109 Submitted by: Tony Finch ---------------------------- revision 1.109 date: 1998/11/03 08:01:47; author: peter; state: Exp; lines: +15 -114 Change the #ifdef UNION code into a callable hook. Arrange to have this set up when unionfs is present, either statically or as a kld module. -- Craig Rodrigues rodrigc@crodrigues.org