kern/180236: [zfs] [nullfs] Leakage free space using ZFS with nullfs on 9.1-STABLE

Konstantin Belousov kostikbel at gmail.com
Thu Jul 4 08:36:49 UTC 2013


On Thu, Jul 04, 2013 at 07:15:39AM +0300, Konstantin Belousov wrote:
> On Thu, Jul 04, 2013 at 12:00:01AM +0000, Steven Hartland wrote:
> > The following reply was made to PR kern/180236; it has been noted by GNATS.
> > 
> > From: "Steven Hartland" <smh at freebsd.org>
> > To: <bug-followup at freebsd.org>,
> > 	"Ivan Klymenko" <fidaj at ukr.net>
> > Cc:  
> > Subject: Re: kern/180236: [zfs] [nullfs] Leakage free space using ZFS with nullfs on 9.1-STABLE
> > Date: Thu, 4 Jul 2013 00:58:13 +0100
> > 
> >  Looks like nullfs isn't cleaning up correctly in the case
> >  where a rename colides with an existing file hence results
> >  in an implicit remove.
> >  
> >  This can be seen in the zdb output for the volume in that
> >  before the unmount all the plain file entries still exist
> >  but after the unmount of nullfs they are gone.
> 
> Can you demonstrate the scenario of the problem, e.g. using the basic
> filesystem commands, like cp(1), mv(1) ?  Does the issue reproduce
> on UFS ?


Ok, the following patch fixed the nullfs leakage for me (I tested over
the UFS).

diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index 6ff15ee..70402e3 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -554,6 +554,7 @@ null_rename(struct vop_rename_args *ap)
 	struct vnode *fvp = ap->a_fvp;
 	struct vnode *fdvp = ap->a_fdvp;
 	struct vnode *tvp = ap->a_tvp;
+	struct null_node *tnn;
 
 	/* Check for cross-device rename. */
 	if ((fvp->v_mount != tdvp->v_mount) ||
@@ -568,7 +569,11 @@ null_rename(struct vop_rename_args *ap)
 		vrele(fvp);
 		return (EXDEV);
 	}
-	
+
+	if (tvp != NULL) {
+		tnn = VTONULL(tvp);
+		tnn->null_flags |= NULLV_DROP;
+	}
 	return (null_bypass((struct vop_generic_args *)ap));
 }
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20130704/39bd78a0/attachment-0001.sig>


More information about the freebsd-fs mailing list