Skip to content

Commit

Permalink
In some situations, mnt_lockref could go negative due to vfs_unbusy()…
Browse files Browse the repository at this point in the history
… being

called without calling vfs_busy() first.  This made umount(8) hang waiting
for mnt_lockref to become zero, which would never happen.

Reviewed by:	kib
Approved by:	rwatson (mentor)
Reported by:	pho
Found with:	stress2
Sponsored by:	FreeBSD Foundation
  • Loading branch information
trasz committed Feb 5, 2009
1 parent d0a09ee commit a4e8c3b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sys/kern/vfs_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,16 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf)
vfs_ref(mp);
VOP_UNLOCK(vp, 0);
fdrop(fp, td);
if (vp->v_iflag & VI_DOOMED) {
if (mp == NULL) {
error = EBADF;
goto out;
}
error = vfs_busy(mp, 0);
vfs_rel(mp);
if (error)
goto out;
if (error) {
VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
#ifdef MAC
error = mac_mount_check_stat(td->td_ucred, mp);
if (error)
Expand Down

0 comments on commit a4e8c3b

Please sign in to comment.