diff options
| author | KATO Takenori <kato@FreeBSD.org> | 1997-04-21 15:32:24 +0000 |
|---|---|---|
| committer | KATO Takenori <kato@FreeBSD.org> | 1997-04-21 15:32:24 +0000 |
| commit | 18b4c8e206488014cce2e1a40b4f3d5fd20f4ddb (patch) | |
| tree | df5e4419238659d5f4c98ca7cc29dfcda5f37b05 | |
| parent | 595c8b2ff9bdda593eadd5f08bf3b6a6c1b56efd (diff) | |
Notes
| -rw-r--r-- | sys/fs/unionfs/union_vnops.c | 28 | ||||
| -rw-r--r-- | sys/miscfs/union/union_vnops.c | 28 |
2 files changed, 46 insertions, 10 deletions
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 357bfc0b875b1..e90c5d492262a 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * @(#)union_vnops.c 8.32 (Berkeley) 6/23/95 - * $Id: union_vnops.c,v 1.25 1997/04/16 03:08:34 kato Exp $ + * $Id: union_vnops.c,v 1.26 1997/04/21 12:40:42 kato Exp $ */ #include <sys/param.h> @@ -1477,10 +1477,28 @@ start: if (un->un_uppervp != NULLVP) { if (((un->un_flags & UN_ULOCK) == 0) && (vp->v_usecount != 0)) { - error = vn_lock(un->un_uppervp, flags, p); - if (error) - return (error); - un->un_flags |= UN_ULOCK; + if (VOP_ISLOCKED(un->un_uppervp)) { + /* + * XXX - Dirty! + * Though UN_ULOCK is not set, upper vnode is locked. This + * indicates a locking violation. If this case happens, + * we will get `lock against myself' panic. + * + * SHOULD BE FIXED! But I couldn't find a fix. If you are + * a kernel hacker, pleas try DIAGNOSTIC kernel, that causes + * panic here. + */ +#ifdef DIAGNOSTIC + panic("union_link: upper vnode is locked, " + "but UN_UNLOCK is not set."); +#endif + un->un_flags |= UN_ULOCK; /* Adjust -- dirty */ + } else { + error = vn_lock(un->un_uppervp, flags, p); + if (error) + return (error); + un->un_flags |= UN_ULOCK; + } } #ifdef DIAGNOSTIC if (un->un_flags & UN_KLOCK) { diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c index 357bfc0b875b1..e90c5d492262a 100644 --- a/sys/miscfs/union/union_vnops.c +++ b/sys/miscfs/union/union_vnops.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * @(#)union_vnops.c 8.32 (Berkeley) 6/23/95 - * $Id: union_vnops.c,v 1.25 1997/04/16 03:08:34 kato Exp $ + * $Id: union_vnops.c,v 1.26 1997/04/21 12:40:42 kato Exp $ */ #include <sys/param.h> @@ -1477,10 +1477,28 @@ start: if (un->un_uppervp != NULLVP) { if (((un->un_flags & UN_ULOCK) == 0) && (vp->v_usecount != 0)) { - error = vn_lock(un->un_uppervp, flags, p); - if (error) - return (error); - un->un_flags |= UN_ULOCK; + if (VOP_ISLOCKED(un->un_uppervp)) { + /* + * XXX - Dirty! + * Though UN_ULOCK is not set, upper vnode is locked. This + * indicates a locking violation. If this case happens, + * we will get `lock against myself' panic. + * + * SHOULD BE FIXED! But I couldn't find a fix. If you are + * a kernel hacker, pleas try DIAGNOSTIC kernel, that causes + * panic here. + */ +#ifdef DIAGNOSTIC + panic("union_link: upper vnode is locked, " + "but UN_UNLOCK is not set."); +#endif + un->un_flags |= UN_ULOCK; /* Adjust -- dirty */ + } else { + error = vn_lock(un->un_uppervp, flags, p); + if (error) + return (error); + un->un_flags |= UN_ULOCK; + } } #ifdef DIAGNOSTIC if (un->un_flags & UN_KLOCK) { |
