union_vnops.c (a8d43c90af5122ecff75b55fbaf6d5806674411b) | union_vnops.c (95eac68fea1e2f1d90042618de228a21ce80039c) |
---|---|
1/* 2 * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry. 3 * Copyright (c) 1992, 1993, 1994, 1995 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Jan-Simon Pendry. 8 * --- 569 unchanged lines hidden (view full) --- 578 579 if (!lockparent) 580 cnp->cn_flags &= ~LOCKPARENT; 581 582 UDEBUG(("Out %d vpp %p/%d lower %p upper %p\n", error, *ap->a_vpp, 583 ((*ap->a_vpp) ? vrefcnt(*ap->a_vpp) : -99), 584 lowervp, uppervp)); 585 | 1/* 2 * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry. 3 * Copyright (c) 1992, 1993, 1994, 1995 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Jan-Simon Pendry. 8 * --- 569 unchanged lines hidden (view full) --- 578 579 if (!lockparent) 580 cnp->cn_flags &= ~LOCKPARENT; 581 582 UDEBUG(("Out %d vpp %p/%d lower %p upper %p\n", error, *ap->a_vpp, 583 ((*ap->a_vpp) ? vrefcnt(*ap->a_vpp) : -99), 584 lowervp, uppervp)); 585 |
586 /* 587 * dvp lock state, determine whether to relock dvp. dvp is expected 588 * to be locked on return if: 589 * 590 * - there was an error (except not EJUSTRETURN), or 591 * - we hit the last component and lockparent is true 592 * 593 * dvp_is_locked is the current state of the dvp lock, not counting 594 * the possibility that *ap->a_vpp == dvp (in which case it is locked 595 * anyway). Note that *ap->a_vpp == dvp only if no error occured. 596 */ | 586 if (error == 0 || error == EJUSTRETURN) { 587 /* 588 * dvp lock state, determine whether to relock dvp. 589 * We are expected to unlock dvp unless: 590 * 591 * - there was an error (other than EJUSTRETURN), or 592 * - we hit the last component and lockparent is true 593 */ 594 if (*ap->a_vpp != dvp) { 595 if (!lockparent || (cnp->cn_flags & ISLASTCN) == 0) 596 VOP_UNLOCK(dvp, 0, td); 597 } |
597 | 598 |
598 if (*ap->a_vpp != dvp) { 599 if ((error == 0 || error == EJUSTRETURN) && 600 (!lockparent || (cnp->cn_flags & ISLASTCN) == 0)) { 601 VOP_UNLOCK(dvp, 0, td); | 599 if (cnp->cn_namelen == 1 && 600 cnp->cn_nameptr[0] == '.' && 601 *ap->a_vpp != dvp) { 602#ifdef DIAGNOSTIC 603 vprint("union_lookup: vp", *ap->a_vpp); 604 vprint("union_lookup: dvp", dvp); 605#endif 606 panic("union_lookup returning . (%p) != startdir (%p)", 607 *ap->a_vpp, dvp); |
602 } 603 } 604 | 608 } 609 } 610 |
605 /* 606 * Diagnostics 607 */ 608 609#ifdef DIAGNOSTIC 610 if (cnp->cn_namelen == 1 && 611 cnp->cn_nameptr[0] == '.' && 612 *ap->a_vpp != dvp) { 613 panic("union_lookup returning . (%p) not same as startdir (%p)", ap->a_vpp, dvp); 614 } 615#endif 616 | |
617 return (error); 618} 619 620/* 621 * union_create: 622 * 623 * a_dvp is locked on entry and remains locked on return. a_vpp is returned 624 * locked if no error occurs, otherwise it is garbage. --- 1267 unchanged lines hidden --- | 611 return (error); 612} 613 614/* 615 * union_create: 616 * 617 * a_dvp is locked on entry and remains locked on return. a_vpp is returned 618 * locked if no error occurs, otherwise it is garbage. --- 1267 unchanged lines hidden --- |