diff options
author | jeff <jeff@FreeBSD.org> | 2002-08-22 07:57:43 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-08-22 07:57:43 +0000 |
commit | 14c25eb63241660e7004e2ed130cc29c8db3d507 (patch) | |
tree | de1e7396ce64c6a13569d65b6b91cdf4d8bab84b /sys/kern/vfs_vnops.c | |
parent | 6c5497f47a5a81903384421e5b55e10c76905d75 (diff) | |
download | FreeBSD-src-14c25eb63241660e7004e2ed130cc29c8db3d507.zip FreeBSD-src-14c25eb63241660e7004e2ed130cc29c8db3d507.tar.gz |
- Closer inspection revealed a possible deadlock situation in vn_lock() that
was introduced by my last commit but not caught by stress testing. Fix
that and slightly restructure the code so that it is more readable.
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r-- | sys/kern/vfs_vnops.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 43683e0..f4aab01 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -852,25 +852,22 @@ debug_vn_lock(vp, flags, td, filename, line) vp->v_iflag |= VI_XWANT; msleep(vp, VI_MTX(vp), PINOD | PDROP, "vn_lock", 0); - /* - * Since we're just going to return, unlock interlock. - */ - if ((flags & LK_RETRY) == 0) - VI_UNLOCK(vp); error = ENOENT; - } else { + if ((flags & LK_RETRY) == 0) { + VI_UNLOCK(vp); + return (error); + } + } #ifdef DEBUG_LOCKS - vp->filename = filename; - vp->line = line; + vp->filename = filename; + vp->line = line; #endif - /* - * lockmgr drops interlock before it will return for - * any reason. So force the code above to relock it. - */ - error = VOP_LOCK(vp, - flags | LK_NOPAUSE | LK_INTERLOCK, td); - flags &= ~LK_INTERLOCK; - } + /* + * lockmgr drops interlock before it will return for + * any reason. So force the code above to relock it. + */ + error = VOP_LOCK(vp, flags | LK_NOPAUSE | LK_INTERLOCK, td); + flags &= ~LK_INTERLOCK; } while (flags & LK_RETRY && error != 0); return (error); } |