diff options
author | jeff <jeff@FreeBSD.org> | 2008-04-22 12:34:16 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2008-04-22 12:34:16 +0000 |
commit | 057cb45df39a212c08811419e80c0100802f22c4 (patch) | |
tree | 47d54102972a6ef88edc904cbebf489d940b785f /sys/ufs | |
parent | e51618e32187334d34fb1905d09bb110f703c72a (diff) | |
download | FreeBSD-src-057cb45df39a212c08811419e80c0100802f22c4.zip FreeBSD-src-057cb45df39a212c08811419e80c0100802f22c4.tar.gz |
- Use a local variable for i_ino in ufs_lookup. It is only used to
communicate between two parts of this one function. This was causing
problems with shared lookups as each would trash the ino value in the
inode.
- Remove the unused i_ino field from the inode structure.
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/inode.h | 1 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_lookup.c | 23 |
2 files changed, 10 insertions, 14 deletions
diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index b198758..5681cb7 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -82,7 +82,6 @@ struct inode { doff_t i_endoff; /* End of useful stuff in directory. */ doff_t i_diroff; /* Offset in dir, where we found last entry. */ doff_t i_offset; /* Offset of free space in directory. */ - ino_t i_ino; /* Inode number of found directory. */ u_int32_t i_reclen; /* Size of found directory entry. */ union { diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index 4637865..0a2f532 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -155,7 +155,7 @@ ufs_lookup(ap) struct ucred *cred = cnp->cn_cred; int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; - ino_t saved_ino; + ino_t ino; int ltype; bp = NULL; @@ -176,6 +176,7 @@ ufs_lookup(ap) * we watch for a place to put the new file in * case it doesn't already exist. */ + ino = 0; i_diroff = dp->i_diroff; slotstatus = FOUND; slotfreespace = slotsize = slotneeded = 0; @@ -358,7 +359,7 @@ foundentry: numdirpasses--; goto notfound; } - dp->i_ino = ep->d_ino; + ino = ep->d_ino; dp->i_reclen = ep->d_reclen; goto found; } @@ -393,7 +394,6 @@ notfound: (ap->a_cnp->cn_flags & DOWHITEOUT) && (ap->a_cnp->cn_flags & ISWHITEOUT))) && (flags & ISLASTCN) && dp->i_effnlink != 0) { - ASSERT_VOP_ELOCKED(vdp, __FUNCTION__); /* * Access for write is interpreted as allowing * creation of files in the directory. @@ -496,12 +496,12 @@ found: dp->i_count = 0; else dp->i_count = dp->i_offset - prevoff; - if (dp->i_number == dp->i_ino) { + if (dp->i_number == ino) { VREF(vdp); *vpp = vdp; return (0); } - if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, + if ((error = VFS_VGET(vdp->v_mount, ino, LK_EXCLUSIVE, &tdp)) != 0) return (error); /* @@ -533,9 +533,9 @@ found: * Careful about locking second inode. * This can only occur if the target is ".". */ - if (dp->i_number == dp->i_ino) + if (dp->i_number == ino) return (EISDIR); - if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, + if ((error = VFS_VGET(vdp->v_mount, ino, LK_EXCLUSIVE, &tdp)) != 0) return (error); *vpp = tdp; @@ -565,15 +565,13 @@ found: pdp = vdp; if (flags & ISDOTDOT) { ltype = VOP_ISLOCKED(pdp); - saved_ino = dp->i_ino; VOP_UNLOCK(pdp, 0); /* race to get the inode */ - error = VFS_VGET(pdp->v_mount, saved_ino, - cnp->cn_lkflags, &tdp); + error = VFS_VGET(pdp->v_mount, ino, cnp->cn_lkflags, &tdp); vn_lock(pdp, ltype | LK_RETRY); if (error) return (error); *vpp = tdp; - } else if (dp->i_number == dp->i_ino) { + } else if (dp->i_number == ino) { VREF(vdp); /* we want ourself, ie "." */ /* * When we lookup "." we still can be asked to lock it @@ -588,8 +586,7 @@ found: } *vpp = vdp; } else { - error = VFS_VGET(pdp->v_mount, dp->i_ino, - cnp->cn_lkflags, &tdp); + error = VFS_VGET(pdp->v_mount, ino, cnp->cn_lkflags, &tdp); if (error) return (error); *vpp = tdp; |