From 1a7bccf6251d2e3a04b364630a80a7f1760cb09b Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Mon, 15 Aug 1994 04:54:41 -0800 Subject: [PATCH] have to recompute the next pointer after possibly sleeping in sync (from mycroft) SCCS-vsn: sys/kern/vfs_syscalls.c 8.21 --- usr/src/sys/kern/vfs_syscalls.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/usr/src/sys/kern/vfs_syscalls.c b/usr/src/sys/kern/vfs_syscalls.c index c09915ccc0..deb34b982c 100644 --- a/usr/src/sys/kern/vfs_syscalls.c +++ b/usr/src/sys/kern/vfs_syscalls.c @@ -9,7 +9,7 @@ * * %sccs.include.redist.c% * - * @(#)vfs_syscalls.c 8.20 (Berkeley) %G% + * @(#)vfs_syscalls.c 8.21 (Berkeley) %G% */ #include @@ -320,6 +320,10 @@ sync(p, uap, retval) int asyncflag; for (mp = mountlist.tqh_first; mp != NULL; mp = nmp) { + /* + * Get the next pointer in case we hang on vfs_busy + * while we are being unmounted. + */ nmp = mp->mnt_list.tqe_next; /* * The lock check below is to avoid races with mount @@ -332,6 +336,11 @@ sync(p, uap, retval) VFS_SYNC(mp, MNT_NOWAIT, p->p_ucred, p); if (asyncflag) mp->mnt_flag |= MNT_ASYNC; + /* + * Get the next pointer again, as the next filesystem + * might have been unmounted while we were sync'ing. + */ + nmp = mp->mnt_list.tqe_next; vfs_unbusy(mp); } } -- 2.20.1