Date: Thu, 19 May 2016 10:23:54 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Bruce Evans <brde@optusnet.com.au> Cc: Konstantin Belousov <kostikbel@gmail.com>, fs@freebsd.org Subject: Re: fix for per-mount i/o counting in ffs Message-ID: <20160519094901.O1798@besplex.bde.org> In-Reply-To: <20160519065714.H1393@besplex.bde.org> References: <20160517072104.I2137@besplex.bde.org> <20160517084241.GY89104@kib.kiev.ua> <20160518061040.D5948@besplex.bde.org> <20160518070252.F6121@besplex.bde.org> <20160517220055.GF89104@kib.kiev.ua> <20160518084931.T6534@besplex.bde.org> <20160518110834.GJ89104@kib.kiev.ua> <20160519065714.H1393@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 19 May 2016, Bruce Evans wrote: > ... > I think the following works to prevent multiple mounts via all of the > known buggy paths: early in every fsmount(): > > dev = devvp->v_rdev; > if (dev->si_mountpt != NULL) { > cleanup(); > return (EBUSY); > } > dev->si_mountpt = mp; > > This also prevents other mounts racing with us before we complete. Too > bad if we fail but the other mount would have succeeded. In fsunmount(), > move clearing si_mountpt to near the end. I hope si_mountpt is locked > by the device reference and that this makes si_mountpt robust enough to > use as an exclusive access flag. Nah, the reference is not a lock. This needs dev_lock() or similar to be robust. struct cdef has no documented locking, bug dev_lock() should work and is probably needed for writes. It is never used for accesses to si_mountpt now. Reads are safe enough since the are of the form 'mp = dev->si_mountpt; if (mp == NULL) dont_use_mp();'. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160519094901.O1798>