Sprinkle locking.
This commit is contained in:
parent
dce30353aa
commit
624dcd9102
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: osf1_mount.c,v 1.40 2008/03/21 21:54:59 ad Exp $ */
|
||||
/* $NetBSD: osf1_mount.c,v 1.41 2008/04/22 21:33:13 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -58,7 +58,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: osf1_mount.c,v 1.40 2008/03/21 21:54:59 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: osf1_mount.c,v 1.41 2008/04/22 21:33:13 ad Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "fs_nfs.h"
|
||||
|
@ -147,9 +147,13 @@ osf1_sys_getfsstat(struct lwp *l, const struct osf1_sys_getfsstat_args *uap, reg
|
|||
|
||||
maxcount = SCARG(uap, bufsize) / sizeof(struct osf1_statfs);
|
||||
osf_sfsp = (void *)SCARG(uap, buf);
|
||||
mutex_enter(&mountlist_lock);
|
||||
for (count = 0, mp = mountlist.cqh_first; mp != (void *)&mountlist;
|
||||
mp = nmp) {
|
||||
if (vfs_trybusy(mp, RW_READER, &mountlist_lock)) {
|
||||
nmp = mp->mnt_list.cqe_next;
|
||||
continue;
|
||||
}
|
||||
if (osf_sfsp && count < maxcount) {
|
||||
sp = &mp->mnt_stat;
|
||||
/*
|
||||
|
@ -159,17 +163,23 @@ osf1_sys_getfsstat(struct lwp *l, const struct osf1_sys_getfsstat_args *uap, reg
|
|||
*/
|
||||
if (((SCARG(uap, flags) & OSF1_MNT_NOWAIT) == 0 ||
|
||||
(SCARG(uap, flags) & OSF1_MNT_WAIT)) &&
|
||||
(error = VFS_STATVFS(mp, sp)))
|
||||
continue;
|
||||
(error = VFS_STATVFS(mp, sp)) == 0) {
|
||||
sp->f_flag = mp->mnt_flag & MNT_VISFLAGMASK;
|
||||
osf1_cvt_statfs_from_native(sp, &osfs);
|
||||
if ((error = copyout(&osfs, osf_sfsp,
|
||||
sizeof (struct osf1_statfs))))
|
||||
sizeof (struct osf1_statfs)))) {
|
||||
vfs_unbusy(mp, false);
|
||||
return (error);
|
||||
}
|
||||
osf_sfsp += sizeof (struct osf1_statfs);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
count++;
|
||||
mutex_enter(&mountlist_lock);
|
||||
nmp = mp->mnt_list.cqe_next;
|
||||
vfs_unbusy(mp, false);
|
||||
}
|
||||
mutex_exit(&mountlist_lock);
|
||||
if (osf_sfsp && count > maxcount)
|
||||
*retval = maxcount;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue