From c82c413dc5eb37b5d308a344aaabe4027badfa80 Mon Sep 17 00:00:00 2001 From: kevlo Date: Mon, 18 Oct 2010 03:34:33 +0000 Subject: Fix a possible race where the directory dirent is moved to the location that was used by ".." entry. This change seems fixed panic during attempt to access msdosfs data over nfs. Reviewed by: kib MFC after: 1 week --- sys/fs/msdosfs/msdosfs_lookup.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sys/fs') diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c index 999125d..51b6dc8 100644 --- a/sys/fs/msdosfs/msdosfs_lookup.c +++ b/sys/fs/msdosfs/msdosfs_lookup.c @@ -594,10 +594,15 @@ msdosfs_deget_dotdot(struct vnode *vp, u_long cluster, int blkoff, vfs_unbusy(mp); if (error == 0) *rvp = DETOV(rdp); - vn_lock(vp, ltype | LK_RETRY); + if (*rvp != vp) + vn_lock(vp, ltype | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { - if (error == 0) - vput(*rvp); + if (error == 0) { + if (*rvp == vp) + vunref(*rvp); + else + vput(*rvp); + } error = ENOENT; } return (error); -- cgit v1.1