Date: Tue, 16 Dec 2008 23:16:10 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/sys/kern vfs_mount.c vfs_subr.c src/sys/sys mount.h Message-ID: <200812162316.mBGNGgo5052957@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
attilio 2008-12-16 23:16:10 UTC FreeBSD src repository Modified files: sys/kern vfs_mount.c vfs_subr.c sys/sys mount.h Log: SVN rev 186197 on 2008-12-16 23:16:10Z by attilio 1) Fix a deadlock in the VFS: - threadA runs vfs_rel(mp1) - threadB does unmount the mp1 fs, sets MNTK_UNMOUNT and drop MNT_ILOCK() - threadA runs vfs_busy(mp1) and, as long as, MNTK_UNMOUNT is set, sleeps waiting for threadB to complete the unmount - threadB, in vfs_mount_destroy(), finds mnt_lock > 0 and sleeps waiting for the refcount to expire. Fix the deadlock by adding a flag called MNTK_REFEXPIRE which signals the unmounter is waiting for mnt_ref to expire. The vfs_busy contenders got awake, fails, and if they retry the MNTK_REFEXPIRE won't allow them to sleep again. 2) Simplify significantly the code of vfs_mount_destroy() trimming unnecessary codes: - as long as any reference exited, it is no-more possible to have write-op (primarty and secondary) in progress. - it is no needed to drop and reacquire the mount lock. - filling the structures with dummy values is unuseful as long as it is going to be freed. Tested by: pho, Andrea Barberio <insomniac at slackware dot it> Discussed with: kib Revision Changes Path 1.298 +14 -31 src/sys/kern/vfs_mount.c 1.750 +1 -1 src/sys/kern/vfs_subr.c 1.240 +1 -0 src/sys/sys/mount.h
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812162316.mBGNGgo5052957>