Skip to contentSkip to conversation

Update atime from future.

PATCH Superseded yangsheng 6 participants 10 messages Dec 29, 2010 – Jan 13, 2011 VFS

lore
Share & tools
lore

yangsheng

author
#0 lore raw

PATCH 1/1 Update atime from future.

Signed-off-by [email protected]
---
 fs/inode.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
fs/inode.c +7 -1
index da85e56..6c8effd 100644
@@ -1469,7 +1469,13 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
 		return 1;
 
 	/*
-	 * Is the previous atime value older than a day? If yes,
+	 * Is the previous atime value in future? If yes,
+	 * update atime:
+	 */
+	if ((long)(now.tv_sec - inode->i_atime.tv_sec) < 0)
+		return 1;
+	/*
+	 * Is the previous atime value old than a day? If yes,
 	 * update atime:
 	 */
 	if ((long)(now.tv_sec - inode->i_atime.tv_sec) >= 24*60*60)
Signature · 1 line
1.7.2.3
#1 lore raw
Quoted 14 lines · On Wed, 29 Dec 2010 21:58:41 +0800 yangsheng <[email protected]> wrote:
Signed-off-by [email protected]
---
 fs/inode.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
fs/inode.c +0 -1
index da85e56..6c8effd 100644
@@ -1469,7 +1469,13 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
 		return 1;
 
 	/*
-	 * Is the previous atime value older than a day? If yes,

fs/inode.c static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, · line 1481

Quoted 10 lines
fs/inode.c +7 -0
+	 * Is the previous atime value in future? If yes,
+	 * update atime:
+	 */
+	if ((long)(now.tv_sec - inode->i_atime.tv_sec) < 0)
+		return 1;
+	/*
+	 * Is the previous atime value old than a day? If yes,
 	 * update atime:
 	 */
 	if ((long)(now.tv_sec - inode->i_atime.tv_sec) >= 24*60*60)

Why do you believe this change is needed? Did you observe some problem which it fixes? If so, please fully describe that problem.

#4 lore raw
In reply to yangsheng

Hi,

Quoted 14 lines · yangsheng
Signed-off-by [email protected]
---
 fs/inode.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
fs/inode.c +0 -1
index da85e56..6c8effd 100644
@@ -1469,7 +1469,13 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
 		return 1;
 
 	/*
-	 * Is the previous atime value older than a day? If yes,

fs/inode.c static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, · line 1481

Quoted 10 lines
fs/inode.c +7 -0
+	 * Is the previous atime value in future? If yes,
+	 * update atime:
+	 */
+	if ((long)(now.tv_sec - inode->i_atime.tv_sec) < 0)
+		return 1;
+	/*
+	 * Is the previous atime value old than a day? If yes,
 	 * update atime:
 	 */
 	if ((long)(now.tv_sec - inode->i_atime.tv_sec) >= 24*60*60)

I don't think this is a good plan for cluster filesystems, since if the times on the nodes are not exactly synchronised (we do highly recommend people run ntp or similar) then this might lead to excessive atime updating. The current behaviour is to ignore atimes which are in the future for exactly this reason,

Steve.

author
#2 lore raw
In reply to Andrew Morton
Quoted 15 lines · Andrew Morton
Quoted 12 lines · On Wed, 29 Dec 2010 21:58:41 +0800 yangsheng<[email protected]> wrote:
Signed-off-by [email protected]
---
  fs/inode.c |    8 +++++++-
  1 files changed, 7 insertions(+), 1 deletions(-)
fs/inode.c +0 -0
index da85e56..6c8effd 100644
@@ -1469,7 +1469,13 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
  		return 1;
 
Quoted 16 lines

fs/inode.c static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,

Quoted 13 lines
fs/inode.c +7 -1
  	/*
-	 * Is the previous atime value older than a day? If yes,
+	 * Is the previous atime value in future? If yes,
+	 * update atime:
+	 */
+	if ((long)(now.tv_sec - inode->i_atime.tv_sec)<  0)
+		return 1;
+	/*
+	 * Is the previous atime value old than a day? If yes,
  	 * update atime:
  	 */
  	if ((long)(now.tv_sec - inode->i_atime.tv_sec)>= 24*60*60)

Why do you believe this change is needed? Did you observe some problem which it fixes? If so, please fully describe that problem.

If atime has been set to future(maybe cause by some accident system time adjust or wrong set by touch). It cannot be update to reflect fact access time before system time running over one day.

Thanks

#5 lore raw
In reply to Steven Whitehouse
Quoted 23 lines · Steven Whitehouse
Quoted 22 lines · yangsheng
Signed-off-by [email protected]

---
fs/inode.c | 8 +++++++-

1 files changed, 7 insertions(+), 1 deletions(-)
fs/inode.c +7 -1
index da85e56..6c8effd 100644
@@ -1469,7 +1469,13 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
       return 1;
 
   /*
-     * Is the previous atime value older than a day? If yes,
+     * Is the previous atime value in future? If yes,
+     * update atime:
+     */
+    if ((long)(now.tv_sec - inode->i_atime.tv_sec) < 0)
+        return 1;
+    /*
+     * Is the previous atime value old than a day? If yes,
    * update atime:
Quoted 8 lines

fs/inode.c static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, · line 1481

Quoted 2 lines
fs/inode.c +0 -0
    */
   if ((long)(now.tv_sec - inode->i_atime.tv_sec) >= 24*60*60)

I don't think this is a good plan for cluster filesystems, since if the times on the nodes are not exactly synchronised (we do highly recommend people run ntp or similar) then this might lead to excessive atime updating. The current behaviour is to ignore atimes which are in the future for exactly this reason,

The problem that is seen is if a tarball has stored a bad atime, or someone fat-fingers a "touch" then the future atime will never be fixed. Before the relatime patch, the future atime would be updated back to the current time on the next access. One if our regression tests for Lustre caught this.

I wouldn't mind changing the relatime check so that it only updates the atime if it is more than one day in the future. That will avoid thrashing atime if the clocks are only slightly out of sync, but still allow fixing completely bogus atimes.

Cheers, Andreas

#6 lore raw

Hi,

Quoted 33 lines · Andreas Dilger
Quoted 23 lines · Steven Whitehouse
Quoted 22 lines · yangsheng
Signed-off-by [email protected]

---
fs/inode.c | 8 +++++++-

1 files changed, 7 insertions(+), 1 deletions(-)
fs/inode.c +7 -1
index da85e56..6c8effd 100644
@@ -1469,7 +1469,13 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
       return 1;
 
   /*
-     * Is the previous atime value older than a day? If yes,
+     * Is the previous atime value in future? If yes,
+     * update atime:
+     */
+    if ((long)(now.tv_sec - inode->i_atime.tv_sec) < 0)
+        return 1;
+    /*
+     * Is the previous atime value old than a day? If yes,
    * update atime:
Quoted 8 lines

fs/inode.c static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, · line 1481

Quoted 2 lines
fs/inode.c +0 -0
    */
   if ((long)(now.tv_sec - inode->i_atime.tv_sec) >= 24*60*60)

I don't think this is a good plan for cluster filesystems, since if the times on the nodes are not exactly synchronised (we do highly recommend people run ntp or similar) then this might lead to excessive atime updating. The current behaviour is to ignore atimes which are in the future for exactly this reason,

Quoted 5 lines

The problem that is seen is if a tarball has stored a bad atime, or someone fat-fingers a "touch" then the future atime will never be fixed. Before the relatime patch, the future atime would be updated back to the current time on the next access. One if our regression tests for Lustre caught this.

I wouldn't mind changing the relatime check so that it only updates the atime if it is more than one day in the future. That will avoid thrashing atime if the clocks are only slightly out of sync, but still allow fixing completely bogus atimes.

Cheers, Andreas

That sounds like a good solution to me,

Steve.

author
#7 lore raw
In reply to Steven Whitehouse
Quoted 26 lines · Steven Whitehouse

Hi,

Quoted 22 lines · yangsheng
Signed-off-by [email protected]
---
  fs/inode.c |    8 +++++++-
  1 files changed, 7 insertions(+), 1 deletions(-)
fs/inode.c +7 -1
index da85e56..6c8effd 100644
@@ -1469,7 +1469,13 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
  		return 1;
 
  	/*
-	 * Is the previous atime value older than a day? If yes,
+	 * Is the previous atime value in future? If yes,
+	 * update atime:
+	 */
+	if ((long)(now.tv_sec - inode->i_atime.tv_sec)<  0)
+		return 1;
+	/*
+	 * Is the previous atime value old than a day? If yes,
  	 * update atime:
Quoted 9 lines

fs/inode.c static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, · line 1481

Quoted 3 lines
fs/inode.c +0 -0
  	 */
  	if ((long)(now.tv_sec - inode->i_atime.tv_sec)>= 24*60*60)

I don't think this is a good plan for cluster filesystems, since if the times on the nodes are not exactly synchronised (we do highly recommend people run ntp or similar) then this might lead to excessive atime updating. The current behaviour is to ignore atimes which are in the future for exactly this reason,

I agreed in theory. Anyway, a two-way update may cause shake in some case. Like a cluster environment with time gap between cluster members. But future atime also is a trouble things i think. Of course, I hope a clever patch to fix them all.

Thanks
yangsheng

#3 lore raw
In reply to Andrew Morton
Quoted 3 lines · Andrew Morton

fs/inode.c static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, · line 1478

Quoted 2 lines · On Wed, 29 Dec 2010 21:58:41 +0800 yangsheng <[email protected]> wrote:
fs/inode.c +1 -1
-	 * Is the previous atime value older than a day? If yes,
+	 * Is the previous atime value old than a day? If yes,

You introduced a typo.

Roger.

Signature · 6 lines
** [email protected] ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement. 
Does it sit on the couch all day? Is it unemployed? Please be specific! 
Define 'it' and what it isn't doing. --------- Adapted from lxrbot FAQ
#8 lore raw
In reply to Steven Whitehouse
	return 1;
Quoted 11 lines

fs/inode.c static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, · line 1481

Quoted 5 lines
fs/inode.c +2 -0
+	/*
+	 * Is the previous atime value old than a day? If yes,
 	 * update atime:
 	 */
 	if ((long)(now.tv_sec - inode->i_atime.tv_sec) >= 24*60*60)

I don't think this is a good plan for cluster filesystems, since if the times on the nodes are not exactly synchronised (we do highly recommend people run ntp or similar) then this might lead to excessive atime updating. The current behaviour is to ignore atimes which are in the future for exactly this reason,

Well, would these "update storms" really be a problem?

AFAICT they should be fairly non-frequent, and worst thing that can happen is that you'll do as many updates as different time settings, settling for the lowest value...?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#9 lore raw

Hi,

Quoted 13 lines · Pavel Machek
	return 1;
Quoted 11 lines

fs/inode.c static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, · line 1481

Quoted 5 lines
fs/inode.c +2 -0
+	/*
+	 * Is the previous atime value old than a day? If yes,
 	 * update atime:
 	 */
 	if ((long)(now.tv_sec - inode->i_atime.tv_sec) >= 24*60*60)

I don't think this is a good plan for cluster filesystems, since if the times on the nodes are not exactly synchronised (we do highly recommend people run ntp or similar) then this might lead to excessive atime updating. The current behaviour is to ignore atimes which are in the future for exactly this reason,

Quoted 6 lines

Well, would these "update storms" really be a problem?

AFAICT they should be fairly non-frequent, and worst thing that can happen is that you'll do as many updates as different time settings, settling for the lowest value...?
Pavel

Sorry for the delay in replying. It has been a problem in the past, certainly. I think it is best to be cautious in this case, since that way we can be sure it won't be a problem. The chosen solution looks ok to me,

Steve.