From df4afa176b6aff7b4d5ce1f3a546f9dec80658ff Mon Sep 17 00:00:00 2001 From: bde Date: Sun, 25 Jul 1999 02:56:17 +0000 Subject: Don't set IN_ACCESS for requests to read 0 bytes or for unsuccessful reads. Translated from: similar fixes in ufs_readwrite.c rev.1.61. Things are simpler (but annoyingly different) here because there are no vm optimisations. --- sys/gnu/ext2fs/ext2_readwrite.c | 6 ++++-- sys/gnu/fs/ext2fs/ext2_readwrite.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'sys/gnu') diff --git a/sys/gnu/ext2fs/ext2_readwrite.c b/sys/gnu/ext2fs/ext2_readwrite.c index d5881e2..abcdfe3 100644 --- a/sys/gnu/ext2fs/ext2_readwrite.c +++ b/sys/gnu/ext2fs/ext2_readwrite.c @@ -68,7 +68,7 @@ READ(ap) daddr_t lbn, nextlbn; off_t bytesinfile; long size, xfersize, blkoffset; - int error; + int error, orig_resid; u_short mode; vp = ap->a_vp; @@ -92,6 +92,7 @@ READ(ap) return (EFBIG); #endif + orig_resid = uio->uio_resid; for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) { if ((bytesinfile = ip->i_size - uio->uio_offset) <= 0) break; @@ -147,7 +148,8 @@ READ(ap) } if (bp != NULL) bqrelse(bp); - if (!(vp->v_mount->mnt_flag & MNT_NOATIME)) + if (orig_resid > 0 && (error == 0 || uio->uio_resid != orig_resid) && + (vp->v_mount->mnt_flag & MNT_NOATIME) == 0) ip->i_flag |= IN_ACCESS; return (error); } diff --git a/sys/gnu/fs/ext2fs/ext2_readwrite.c b/sys/gnu/fs/ext2fs/ext2_readwrite.c index d5881e2..abcdfe3 100644 --- a/sys/gnu/fs/ext2fs/ext2_readwrite.c +++ b/sys/gnu/fs/ext2fs/ext2_readwrite.c @@ -68,7 +68,7 @@ READ(ap) daddr_t lbn, nextlbn; off_t bytesinfile; long size, xfersize, blkoffset; - int error; + int error, orig_resid; u_short mode; vp = ap->a_vp; @@ -92,6 +92,7 @@ READ(ap) return (EFBIG); #endif + orig_resid = uio->uio_resid; for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) { if ((bytesinfile = ip->i_size - uio->uio_offset) <= 0) break; @@ -147,7 +148,8 @@ READ(ap) } if (bp != NULL) bqrelse(bp); - if (!(vp->v_mount->mnt_flag & MNT_NOATIME)) + if (orig_resid > 0 && (error == 0 || uio->uio_resid != orig_resid) && + (vp->v_mount->mnt_flag & MNT_NOATIME) == 0) ip->i_flag |= IN_ACCESS; return (error); } -- cgit v1.1