Hold the reference on the mountpoint slightly longer in kern_statfs() and

kern_fstatfs() so that it is still held when prison_enforce_statfs() is
called (since that function likes to poke and prod at the mountpoint
structure).

MFC after:	3 days
This commit is contained in:
John Baldwin 2006-07-27 20:00:27 +00:00
parent 186abbd727
commit ea175645b4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=160767
2 changed files with 4 additions and 4 deletions

View File

@ -266,7 +266,6 @@ kern_statfs(struct thread *td, char *path, enum uio_seg pathseg,
sp->f_namemax = NAME_MAX;
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
error = VFS_STATFS(mp, sp, td);
vfs_rel(mp);
if (error)
goto out;
if (suser(td)) {
@ -277,6 +276,7 @@ kern_statfs(struct thread *td, char *path, enum uio_seg pathseg,
}
*buf = *sp;
out:
vfs_rel(mp);
VFS_UNLOCK_GIANT(vfslocked);
if (mtx_owned(&Giant))
printf("statfs(%d): %s: %d\n", vfslocked, path, error);
@ -355,7 +355,6 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf)
sp->f_namemax = NAME_MAX;
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
error = VFS_STATFS(mp, sp, td);
vfs_rel(mp);
if (error)
goto out;
if (suser(td)) {
@ -366,6 +365,7 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf)
}
*buf = *sp;
out:
vfs_rel(mp);
VFS_UNLOCK_GIANT(vfslocked);
return (error);
}

View File

@ -266,7 +266,6 @@ kern_statfs(struct thread *td, char *path, enum uio_seg pathseg,
sp->f_namemax = NAME_MAX;
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
error = VFS_STATFS(mp, sp, td);
vfs_rel(mp);
if (error)
goto out;
if (suser(td)) {
@ -277,6 +276,7 @@ kern_statfs(struct thread *td, char *path, enum uio_seg pathseg,
}
*buf = *sp;
out:
vfs_rel(mp);
VFS_UNLOCK_GIANT(vfslocked);
if (mtx_owned(&Giant))
printf("statfs(%d): %s: %d\n", vfslocked, path, error);
@ -355,7 +355,6 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf)
sp->f_namemax = NAME_MAX;
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
error = VFS_STATFS(mp, sp, td);
vfs_rel(mp);
if (error)
goto out;
if (suser(td)) {
@ -366,6 +365,7 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf)
}
*buf = *sp;
out:
vfs_rel(mp);
VFS_UNLOCK_GIANT(vfslocked);
return (error);
}