Sync locking in freebsd4_getfsstat() with getfsstat().

Giant is probably also needed in kern_fhstatfs().
This commit is contained in:
Pawel Jakub Dawidek 2005-05-27 19:21:08 +00:00
parent fd91686850
commit 2b19a055ab
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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