quotactl bug: vfs_busy never unbusy-es

Chris Torek torek at elf.torek.net
Thu Mar 10 11:38:45 UTC 2016


[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


More information about the freebsd-fs mailing list