Date: Sun, 25 Apr 2004 07:38:00 +0300 From: Alex Lyashkov <umka@sevinter.net> To: Pawel Jakub Dawidek <pjd@FreeBSD.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern vfs_syscalls.c Message-ID: <1082867880.8241.4.camel@berloga.shadowland> In-Reply-To: <20040422233154.GY24376@darkness.comp.waw.pl> References: <200404221540.i3MFeSIM038514@repoman.freebsd.org> <20040422231910.GB709@timesink.dyndns.org> <20040422233154.GY24376@darkness.comp.waw.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] ÷ ðÔÎ, 23.04.2004, × 02:31, Pawel Jakub Dawidek ÐÉÛÅÔ: > On Fri, Apr 23, 2004 at 01:19:10AM +0200, Thomas Moestl wrote: > +> On Thu, 2004/04/22 at 08:40:28 -0700, Pawel Jakub Dawidek wrote: > +> > pjd 2004/04/22 08:40:27 PDT > +> > > +> > FreeBSD src repository > +> > > +> > Modified files: > +> > sys/kern vfs_syscalls.c > +> > Log: > +> > Look out! vn_start_write() is able to return 0 and NULL 'mp'. > +> > +> Hmmm, I'm not sure, but wasn't the real bug to use the struct mount * > +> that vn_start_write() returns instead of nd.ni_vp->v_mount (or at > +> least, not using nd.ni_vp->v_mount if mp turns out to be NULL)? > +> extattrctl() chooses that way. > +> It seems that file systems are not required to implement > +> VOP_GETWRITEMOUNT(), but could choose to implement VFS_QUOTACTL() > +> anyway (although IIRC there currently are none that maintain this > +> combination), so unconditionally returning EOPNOTSUPP would be too > +> strict. > +> > +> The only case where the mount point of the vnode and the mount point > +> returned by vn_start_write() should differ is when unionfs is > +> involved; in that case, the correct semantics of quotactl() is a bit > +> doubtful, and so unionfs does not support quotactl() at all; thus > +> using the mount point of the vnode should not break anything. > > Yes. Even quotactl(2) in RELENG_4 is using nd.ni_vp->v_mount. > Anyone want to test this patch: > > http://people.freebsd.org/~pjd/patches/vfs_syscalls.c.3.patch After I apply this patch my test box have a panic with message "negative refs" at vn_finish_write. I rewrite patch for ommit this situations. -- Alex Lyashkov <umka@sevinter.net> Home [-- Attachment #2 --] ? log Index: vfs_syscalls.c =================================================================== RCS file: /mnt/storage/freebsd-cvs/src/sys/kern/vfs_syscalls.c,v retrieving revision 1.344 diff -u -r1.344 vfs_syscalls.c --- vfs_syscalls.c 22 Apr 2004 15:40:27 -0000 1.344 +++ vfs_syscalls.c 24 Apr 2004 18:16:03 -0000 @@ -184,6 +184,7 @@ } */ *uap; { struct mount *mp; + struct mount *quota_args; int error; struct nameidata nd; @@ -194,12 +195,11 @@ return (error); NDFREE(&nd, NDF_ONLY_PNBUF); error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH); + quota_args = mp != NULL ? mp : nd.ni_vp->v_mount; vrele(nd.ni_vp); if (error) - return (error); - if (mp == NULL) - return (EOPNOTSUPP); - error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg, td); + return (error); + error = VFS_QUOTACTL(quota_args, uap->cmd, uap->uid, uap->arg, td); vn_finished_write(mp); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1082867880.8241.4.camel>
