From 788f75ddb2af03ab6d72cd8c4c1318452b406c06 Mon Sep 17 00:00:00 2001 From: pjd Date: Fri, 27 May 2005 19:21:08 +0000 Subject: Sync locking in freebsd4_getfsstat() with getfsstat(). Giant is probably also needed in kern_fhstatfs(). --- sys/kern/vfs_extattr.c | 3 +++ sys/kern/vfs_syscalls.c | 3 +++ 2 files changed, 6 insertions(+) (limited to 'sys') diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index dc28388..e59bc09 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -526,6 +526,7 @@ freebsd4_getfsstat(td, uap) maxcount = uap->bufsize / sizeof(struct ostatfs); sfsp = (caddr_t)uap->buf; count = 0; + mtx_lock(&Giant); mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { if (!prison_check_mount(td->td_ucred, mp)) { @@ -567,6 +568,7 @@ freebsd4_getfsstat(td, uap) error = copyout(&osb, sfsp, sizeof(osb)); if (error) { vfs_unbusy(mp, td); + mtx_unlock(&Giant); return (error); } sfsp += sizeof(osb); @@ -577,6 +579,7 @@ freebsd4_getfsstat(td, uap) vfs_unbusy(mp, td); } mtx_unlock(&mountlist_mtx); + mtx_unlock(&Giant); if (sfsp && count > maxcount) td->td_retval[0] = maxcount; else diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index dc28388..e59bc09 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -526,6 +526,7 @@ freebsd4_getfsstat(td, uap) maxcount = uap->bufsize / sizeof(struct ostatfs); sfsp = (caddr_t)uap->buf; count = 0; + mtx_lock(&Giant); mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { if (!prison_check_mount(td->td_ucred, mp)) { @@ -567,6 +568,7 @@ freebsd4_getfsstat(td, uap) error = copyout(&osb, sfsp, sizeof(osb)); if (error) { vfs_unbusy(mp, td); + mtx_unlock(&Giant); return (error); } sfsp += sizeof(osb); @@ -577,6 +579,7 @@ freebsd4_getfsstat(td, uap) vfs_unbusy(mp, td); } mtx_unlock(&mountlist_mtx); + mtx_unlock(&Giant); if (sfsp && count > maxcount) td->td_retval[0] = maxcount; else -- cgit v1.1