From owner-cvs-all@FreeBSD.ORG Sat Jun 14 17:23:50 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BE40137B401; Sat, 14 Jun 2003 17:23:50 -0700 (PDT) Received: from HAL9000.homeunix.com (ip114.bella-vista.sfo.interquest.net [66.199.86.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id C66D443F75; Sat, 14 Jun 2003 17:23:48 -0700 (PDT) (envelope-from das@FreeBSD.org) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.9/8.12.9) with ESMTP id h5F0NjlB000807; Sat, 14 Jun 2003 17:23:45 -0700 (PDT) (envelope-from das@FreeBSD.org) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.9/8.12.9/Submit) id h5F0Nhm9000806; Sat, 14 Jun 2003 17:23:43 -0700 (PDT) (envelope-from das@FreeBSD.org) Date: Sat, 14 Jun 2003 17:23:43 -0700 From: David Schultz To: Nate Lawson Message-ID: <20030615002343.GA714@HAL9000.homeunix.com> Mail-Followup-To: Nate Lawson , cvs-all@FreeBSD.org, cvs-src@FreeBSD.org, src-committers@FreeBSD.org References: <20030614235633.9A83137B490@hub.freebsd.org> <20030614170529.C50064@root.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030614170529.C50064@root.org> cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/fs/unionfs union_vnops.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jun 2003 00:23:51 -0000 On Sat, Jun 14, 2003, Nate Lawson wrote: > On Sat, 14 Jun 2003, David Schultz wrote: > > If someone tries to mount a union filesystem with another unionfs as > > the upper layer, fail gracefully instead of panicing. > > > > Revision Changes Path > > 1.99 +14 -4 src/sys/fs/unionfs/union_vnops.c > > > > --- src/sys/fs/unionfs/union_vnops.c:1.98 Sat Jun 14 16:27:29 2003 > > +++ src/sys/fs/unionfs/union_vnops.c Sat Jun 14 16:56:27 2003 > > @@ -670,10 +670,20 @@ > > struct vnode *uppervp; > > int error = EOPNOTSUPP; > > > > - if ((uppervp = union_lock_upper(un, cnp->cn_thread)) != NULLVP) { > > - error = VOP_WHITEOUT(un->un_uppervp, cnp, ap->a_flags); > > - union_unlock_upper(uppervp, cnp->cn_thread); > > - } > > + switch (ap->a_flags) { > > + case LOOKUP: > > + error = EOPNOTSUPP; > > + break; > > + case CREATE: > > + case DELETE: > > + if ((uppervp=union_lock_upper(un,cnp->cn_thread)) != NULLVP) { > > + error = VOP_WHITEOUT(un->un_uppervp, cnp, ap->a_flags); > > + union_unlock_upper(uppervp, cnp->cn_thread); > > + } > > + break; > > + default: > > + panic("union_whiteout: unknown op"); > > + } > > return(error); > > } > > Is that the default value you want for error? Perhaps you don't need to > assign one? Good eye. Until five minutes ago, my tree actually said 'error = 0' in the second assignment, but it turns out that that doesn't quite work. Since whiteout entries in the upper layer of a unionfs are special, it's hard to support externally-visible whiteout entries in the way one would want. The bottom line is that the assignment at the top of the function is redundant now, but I don't see a compelling reason to nix it unless someone else really cares.