Subject: kern/3226: sync should do filesystems in reverse order
To: None <gnats-bugs@gnats.netbsd.org>
From: Greg Hudson <ghudson@mit.edu>
List: netbsd-bugs
Date: 02/18/1997 03:20:31
>Number: 3226
>Category: kern
>Synopsis: sync should do filesystems in reverse order
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Tue Feb 18 00:35:00 1997
>Last-Modified:
>Originator: Greg Hudson
>Organization:
MIT
>Release: 1.1
>Environment:
System: NetBSD glacier 1.2B NetBSD 1.2B (GLACIER) #14: Sat Jan 25 15:04:33 EST 1997 ghudson@glacier:/u1/GLACIER i386
>Description:
In April of 1996, Jim Rees requested that filesystems should probably be
synchronized in reverse order, which allows disks to spin down sooner
on laptops in some cases (notably, when you have an AFS filesystem which
screws around with a UFS filesystem during a sync operation).
>How-To-Repeat:
>Fix:
This is the patch Jim suggested, propagated to a more recent version of
vfs_syscalls.c:
*** vfs_syscalls.c.orig Tue Feb 18 03:15:47 1997
--- vfs_syscalls.c Tue Feb 18 03:15:58 1997
***************
*** 429,440 ****
register struct mount *mp, *nmp;
int asyncflag;
! for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nmp) {
/*
* Get the next pointer in case we hang on vfs_busy
* while we are being unmounted.
*/
! nmp = mp->mnt_list.cqe_next;
/*
* The lock check below is to avoid races with mount
* and unmount.
--- 429,440 ----
register struct mount *mp, *nmp;
int asyncflag;
! for (mp = mountlist.cqh_last; mp != (void *)&mountlist; mp = nmp) {
/*
* Get the next pointer in case we hang on vfs_busy
* while we are being unmounted.
*/
! nmp = mp->mnt_list.cqe_prev;
/*
* The lock check below is to avoid races with mount
* and unmount.
***************
*** 450,456 ****
* Get the next pointer again, as the next filesystem
* might have been unmounted while we were sync'ing.
*/
! nmp = mp->mnt_list.cqe_next;
vfs_unbusy(mp);
}
}
--- 450,456 ----
* Get the next pointer again, as the next filesystem
* might have been unmounted while we were sync'ing.
*/
! nmp = mp->mnt_list.cqe_prev;
vfs_unbusy(mp);
}
}
>Audit-Trail:
>Unformatted: