| 4611 | } |
| 4612 | |
| 4613 | int |
| 4614 | kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf) |
| 4615 | { |
| 4616 | struct mount *mp; |
| 4617 | struct vnode *vp; |
| 4618 | int error; |
| 4619 | |
| 4620 | error = priv_check(td, PRIV_VFS_FHSTATFS); |
| 4621 | if (error != 0) |
| 4622 | return (error); |
| 4623 | if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL) |
| 4624 | return (ESTALE); |
| 4625 | error = VFS_FHTOVP(mp, &fh.fh_fid, LK_EXCLUSIVE, &vp); |
| 4626 | if (error != 0) { |
| 4627 | vfs_unbusy(mp); |
| 4628 | return (error); |
| 4629 | } |
| 4630 | vput(vp); |
| 4631 | error = prison_canseemount(td->td_ucred, mp); |
| 4632 | if (error != 0) |
| 4633 | goto out; |
| 4634 | #ifdef MAC |
| 4635 | error = mac_mount_check_stat(td->td_ucred, mp); |
| 4636 | if (error != 0) |
| 4637 | goto out; |
| 4638 | #endif |
| 4639 | error = VFS_STATFS(mp, buf); |
| 4640 | out: |
| 4641 | vfs_unbusy(mp); |
| 4642 | return (error); |
| 4643 | } |
| 4644 | |
| 4645 | /* |
| 4646 | * Unlike madvise(2), we do not make a best effort to remember every |
no test coverage detected