Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Mar 2016 03:38:44 -0800 (PST)
From:      Chris Torek <torek@elf.torek.net>
To:        kostikbel@gmail.com
Cc:        freebsd-fs@freebsd.org
Subject:   Re: quotactl bug: vfs_busy never unbusy-es
Message-ID:  <201603101138.u2ABcihi048011@elf.torek.net>
In-Reply-To: <20160310091433.GS67250@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
[A nicer change breaks KPI - yes, alas.]

>Why not do just the following ?

That fixes the main bug, although pass-through file systems
(nullfs and unionfs) are still wrong: they don't vfs_busy their
target mount points when passing the op through, nor unbusy
their "mp" arguments when the sub-command is Q_QUOTAON.

We could perhaps have a little subroutine in the VFS code that
does the vfs_busy(mp)-then-call sequence, so that these two need
not repeat it.

>With regard to the ufs/ufs/quota.h pollution of the VFS code, this
>is ugly, I agree. I wanted to move the ufs quota code into vfs layer
>for very long time.

This would be good (though zfs still has its own special
quota code; hooking that up is what started me down this path,
and hooking that up still looks difficult...).

>diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
>index a7977bf..26e45f4 100644
>--- a/sys/kern/vfs_default.c
>+++ b/sys/kern/vfs_default.c
>@@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$");
> #include <vm/vm_pager.h>
> #include <vm/vnode_pager.h>
> 
>+#include <ufs/ufs/quota.h>
>+
> static int	vop_nolookup(struct vop_lookup_args *);
> static int	vop_norename(struct vop_rename_args *);
> static int	vop_nostrategy(struct vop_strategy_args *);
>@@ -1190,6 +1192,8 @@ vfs_stdquotactl (mp, cmds, uid, arg)
> 	void *arg;
> {
> 
>+	if ((cmds >> SUBCMDSHIFT) == Q_QUOTAON)
>+		vfs_unbusy(mp);
> 	return (EOPNOTSUPP);
> }

That, in fact, is what I started with, before I investigated
further and found the nullfs and unionfs pattern violation.

It's certainly worth doing as a start, though.

Chris



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