Reduce the acquisition of the vnode interlock in the ffs_read() and

ffs_extread() when setting the IN_ACCESS flag by checking whether the
IN_ACCESS is already set. The possible race there is admissible.

Tested by:	pho
Submitted by:	jeff
This commit is contained in:
Konstantin Belousov 2008-03-21 12:33:00 +00:00
parent 7a36fb79f9
commit 0e2c6b177f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177474

View File

@ -605,7 +605,8 @@ ffs_read(ap)
} }
if ((error == 0 || uio->uio_resid != orig_resid) && if ((error == 0 || uio->uio_resid != orig_resid) &&
(vp->v_mount->mnt_flag & MNT_NOATIME) == 0) { (vp->v_mount->mnt_flag & MNT_NOATIME) == 0 &&
(ip->i_flag & IN_ACCESS) == 0) {
VI_LOCK(vp); VI_LOCK(vp);
ip->i_flag |= IN_ACCESS; ip->i_flag |= IN_ACCESS;
VI_UNLOCK(vp); VI_UNLOCK(vp);
@ -1006,7 +1007,8 @@ ffs_extread(struct vnode *vp, struct uio *uio, int ioflag)
} }
if ((error == 0 || uio->uio_resid != orig_resid) && if ((error == 0 || uio->uio_resid != orig_resid) &&
(vp->v_mount->mnt_flag & MNT_NOATIME) == 0) { (vp->v_mount->mnt_flag & MNT_NOATIME) == 0 &&
(ip->i_flag & IN_ACCESS) == 0) {
VI_LOCK(vp); VI_LOCK(vp);
ip->i_flag |= IN_ACCESS; ip->i_flag |= IN_ACCESS;
VI_UNLOCK(vp); VI_UNLOCK(vp);