Subject: Re: kern/25279: NFS read doesn't update atime
To: None <tech-kern@NetBSD.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 06/28/2005 11:55:39
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
so here is another patch, based on comments received:
- it also updates the mtime on VOP_PUTPAGE()
- after fixing ufs_balloc_range() to not use VM_PROT_READ, test for
VM_PROT_READ in VOP_GETPAGE() to see if we should update the atime or not
I checked that:
- a mmap() read will cause the atime to be updated
- a mmap() write will cause the mtime to be updated when the page is
written back
- a write() don't cause the atime to be updated
- a NFS read cause the atime to be updated
This diff is only for ffs. I'll update ext2fs and lfs once we agree on what
to do here.
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="diff.getpage"
Index: ffs/ffs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_vnops.c,v
retrieving revision 1.69
diff -u -r1.69 ffs_vnops.c
--- ffs/ffs_vnops.c 26 Feb 2005 22:32:20 -0000 1.69
+++ ffs/ffs_vnops.c 28 Jun 2005 09:38:51 -0000
@@ -535,6 +535,9 @@
}
return EINVAL;
}
+ if (!(vp->v_mount->mnt_flag & MNT_NOATIME) &&
+ (ap->a_access_type & VM_PROT_READ))
+ ip->i_flag |= IN_ACCESS;
return genfs_getpages(v);
}
@@ -554,6 +557,9 @@
struct vm_page *pg;
off_t off;
+
+ ip->i_flag |= IN_UPDATE | IN_CHANGE;
+
if (!DOINGSOFTDEP(vp) || (ap->a_flags & PGO_CLEANIT) == 0) {
return genfs_putpages(v);
}
Index: ufs/ufs_inode.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ufs/ufs_inode.c,v
retrieving revision 1.47
diff -u -r1.47 ufs_inode.c
--- ufs/ufs_inode.c 23 Jan 2005 19:37:05 -0000 1.47
+++ ufs/ufs_inode.c 28 Jun 2005 09:38:51 -0000
@@ -240,7 +240,7 @@
memset(pgs, 0, npages * sizeof(struct vm_page *));
simple_lock(&uobj->vmobjlock);
error = VOP_GETPAGES(vp, pagestart, pgs, &npages, 0,
- VM_PROT_READ, 0, PGO_SYNCIO|PGO_PASTEOF);
+ VM_PROT_NONE, 0, PGO_SYNCIO|PGO_PASTEOF);
if (error) {
return error;
}
--82I3+IH0IqGh5yIs--