summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ufs
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1999-07-25 02:07:16 +0000
committerbde <bde@FreeBSD.org>1999-07-25 02:07:16 +0000
commit13dd3005e32d05513787ea6d16f327ec6f93d0f5 (patch)
tree89797ec51aab27c90109abf457b0582ea3274ea4 /sys/ufs/ufs
parent3e6abceb66e82df153e35e00c9e6cd5a1bc83112 (diff)
downloadFreeBSD-src-13dd3005e32d05513787ea6d16f327ec6f93d0f5.zip
FreeBSD-src-13dd3005e32d05513787ea6d16f327ec6f93d0f5.tar.gz
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.
Diffstat (limited to 'sys/ufs/ufs')
-rw-r--r--sys/ufs/ufs/ufs_readwrite.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c
index 51a934f..81a84bb 100644
--- a/sys/ufs/ufs/ufs_readwrite.c
+++ b/sys/ufs/ufs/ufs_readwrite.c
@@ -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);
}
OpenPOWER on IntegriCloud