diff options
author | jeff <jeff@FreeBSD.org> | 2006-02-01 00:25:26 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2006-02-01 00:25:26 +0000 |
commit | 30a231055bbecc02f17f1f4fe10c32564b6bcb22 (patch) | |
tree | 7bf7224bada967b7ee62d1c1257eab0efb97b47e /sys/coda | |
parent | 34e5ca5b0218833663b71e333221ff426ec2e440 (diff) | |
download | FreeBSD-src-30a231055bbecc02f17f1f4fe10c32564b6bcb22.zip FreeBSD-src-30a231055bbecc02f17f1f4fe10c32564b6bcb22.tar.gz |
- Reorder calls to vrele() after calls to vput() when the vrele is a
directory. vrele() may lock the passed vnode, which in these cases would
give an invalid lock order of child -> parent. These situations are
deadlock prone although do not typically deadlock because the vrele
is typically not releasing the last reference to the vnode. Users of
vrele must consider it as a call to vn_lock() and order it appropriately.
MFC After: 1 week
Sponsored by: Isilon Systems, Inc.
Tested by: kkenn
Diffstat (limited to 'sys/coda')
-rw-r--r-- | sys/coda/coda_vnops.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index 94d95d9..75de19f 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -1289,21 +1289,18 @@ coda_rename(struct vop_rename_args *ap) /* XXX - do we need to call cache pureg on the moved vnode? */ cache_purge(ap->a_fvp); - /* It seems to be incumbent on us to drop locks on all four vnodes */ - /* From-vnodes are not locked, only ref'd. To-vnodes are locked. */ - - vrele(ap->a_fvp); + /* Release parents first, then children. */ vrele(odvp); - if (ap->a_tvp) { - if (ap->a_tvp == ndvp) { - vrele(ap->a_tvp); - } else { - vput(ap->a_tvp); - } - } + if (ap->a_tvp == ndvp) + vrele(ndvp); + else + vput(ndvp); + vput(ap->a_tvp); + } else + vput(ndvp); + vrele(ap->a_fvp); - vput(ndvp); return(error); } |