diff options
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_lookup.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index 8c68742..d296857 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -390,7 +390,6 @@ notfound: endsearch = i_diroff; goto searchloop; } - dp->i_offset = i_offset; if (bp != NULL) brelse(bp); /* @@ -482,13 +481,13 @@ found: if ((flags & ISLASTCN) && nameiop == LOOKUP) dp->i_diroff = i_offset &~ (DIRBLKSIZ - 1); - dp->i_offset = i_offset; /* * If deleting, and at end of pathname, return * parameters which can be used to remove file. */ if (nameiop == DELETE && (flags & ISLASTCN)) { - ASSERT_VOP_ELOCKED(vdp, __FUNCTION__); + if (flags & LOCKPARENT) + ASSERT_VOP_ELOCKED(vdp, __FUNCTION__); /* * Write access to directory required to delete files. */ @@ -500,7 +499,13 @@ found: * and distance past previous entry (if there * is a previous entry in this block) in dp->i_count. * Save directory inode pointer in ndp->ni_dvp for dirremove(). + * + * Technically we shouldn't be setting these in the + * WANTPARENT case (first lookup in rename()), but any + * lookups that will result in directory changes will + * overwrite these. */ + dp->i_offset = i_offset; if ((dp->i_offset & (DIRBLKSIZ - 1)) == 0) dp->i_count = 0; else @@ -542,6 +547,7 @@ found: * Careful about locking second inode. * This can only occur if the target is ".". */ + dp->i_offset = i_offset; if (dp->i_number == ino) return (EISDIR); if ((error = VFS_VGET(vdp->v_mount, ino, |