Fixed access timestamp bugs:

Set IN_ACCESS for successful reads of 0 bytes (except for requests to
read 0 bytes).  This was broken in rev.1.42.
PR:		misc/10148

Don't set IN_ACCESS for requests to read 0 bytes.

Don't set IN_ACCESS for unsuccessful reads.
This commit is contained in:
bde 1999-07-25 02:07:16 +00:00
parent 026410183f
commit 866e8d9571

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_readwrite.c 8.11 (Berkeley) 5/8/95
* $Id: ufs_readwrite.c,v 1.59 1999/07/08 06:06:00 mckusick Exp $
* $Id: ufs_readwrite.c,v 1.60 1999/07/13 18:20:12 mckusick Exp $
*/
#define BLKSIZE(a, b, c) blksize(a, b, c)
@ -70,7 +70,7 @@ READ(ap)
ufs_daddr_t lbn, nextlbn;
off_t bytesinfile;
long size, xfersize, blkoffset;
int error;
int error, orig_resid;
u_short mode;
int seqcount;
int ioflag;
@ -97,10 +97,16 @@ READ(ap)
if ((u_int64_t)uio->uio_offset > fs->fs_maxfilesize)
return (EFBIG);
orig_resid = uio->uio_resid;
if (orig_resid <= 0)
return (0);
object = vp->v_object;
bytesinfile = ip->i_size - uio->uio_offset;
if (bytesinfile <= 0) {
if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0)
ip->i_flag |= IN_ACCESS;
return 0;
}
@ -131,7 +137,9 @@ READ(ap)
* If we finished or there was an error
* then finish up.
*/
if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
if ((error == 0 ||
uio->uio_resid != orig_resid) &&
(vp->v_mount->mnt_flag & MNT_NOATIME) == 0)
ip->i_flag |= IN_ACCESS;
if (object)
/*
@ -170,7 +178,10 @@ READ(ap)
if (toread >= PAGE_SIZE) {
error = uioread(toread, uio, object, &nread);
if ((uio->uio_resid == 0) || (error != 0)) {
if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
if ((error == 0 ||
uio->uio_resid != orig_resid) &&
(vp->v_mount->mnt_flag &
MNT_NOATIME) == 0)
ip->i_flag |= IN_ACCESS;
if (object)
vm_object_vndeallocate(object);
@ -343,7 +354,8 @@ READ(ap)
if (object)
vm_object_vndeallocate(object);
if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
if ((error == 0 || uio->uio_resid != orig_resid) &&
(vp->v_mount->mnt_flag & MNT_NOATIME) == 0)
ip->i_flag |= IN_ACCESS;
return (error);
}