All of lore.kernel.org
 help / color / mirror / Atom feed
* ext4 lazytime: ctime of some files changed
@ 2015-05-13  9:35 Jörg-Volker Peetz
  2015-05-13 16:20 ` Jörg-Volker Peetz
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Jörg-Volker Peetz @ 2015-05-13  9:35 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Theodore Ts'o

Dear Ted,

on my laptop with ext4 fs (on SSD) I started to try the lazytime mount option
using a self compiled kernel 4.0.2 on a debian system with mount version 2.26.2.
Before that, I've used the noatime mount option.

After restarting the system with an adapted /etc/fstab file and the kernel
parameter "rootflags=lazytime", the relatime mount option was also set. I
changed that by commanding "mount -o remount,strictatime /", etc.
By accident, I noticed that some files had a modified ctime and mtime although
they were not changed or modified.

Has anybody else experienced that? Do I miss a patch?

Mount options in fstab: nobarrier,lazytime,errors=remount-ro
The filesystems are ext4 on a primary partition of the SSD with default mount
option journal_data_writeback. I created them in Feb 2011.

By the way, the command "mount -o remount,lazytime /" does not do the switch to
lazytime.

And thanks for your tireless work on Linux.
-- 
Regards,
jvp.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-13  9:35 ext4 lazytime: ctime of some files changed Jörg-Volker Peetz
@ 2015-05-13 16:20 ` Jörg-Volker Peetz
  2015-05-14 22:20   ` Theodore Ts'o
  2015-05-14  2:17 ` Theodore Ts'o
  2015-05-16 14:30 ` Holger Hoffstätte
  2 siblings, 1 reply; 16+ messages in thread
From: Jörg-Volker Peetz @ 2015-05-13 16:20 UTC (permalink / raw)
  To: linux-fsdevel

Jörg-Volker Peetz wrote on 05/13/2015 11:35:
> Dear Ted,
> 
> on my laptop with ext4 fs (on SSD) I started to try the lazytime mount option
> using a self compiled kernel 4.0.2 on a debian system with mount version 2.26.2.
> Before that, I've used the noatime mount option.
> 
> After restarting the system with an adapted /etc/fstab file and the kernel
> parameter "rootflags=lazytime", the relatime mount option was also set. I
> changed that by commanding "mount -o remount,strictatime /", etc.
> By accident, I noticed that some files had a modified ctime and mtime although
> they were not changed or modified.
> 
> Has anybody else experienced that? Do I miss a patch?
> 
> Mount options in fstab: nobarrier,lazytime,errors=remount-ro
> The filesystems are ext4 on a primary partition of the SSD with default mount
> option journal_data_writeback. I created them in Feb 2011.
> 
> By the way, the command "mount -o remount,lazytime /" does not do the switch to
> lazytime.
> 
> And thanks for your tireless work on Linux.
> 

After writing the above, I encountered another accident regarding two files of
the emacs24 package of which the mtime got changed.

I tried to repair this by using versions of the two files with the correct mtime
in the /tmp directory and commanded

> touch -r /tmp/debian-ispell.elc
/usr/share/emacs24/site-lisp/dictionaries-common/debian-ispell.elc
> touch -r /tmp/ess-noweb-font-lock-mode.elc
/usr/share/emacs24/site-lisp/ess/ess-noweb-font-lock-mode.elc

A few hours later I unpacked and tested a tar archive by commanding s.t. like

> tar xf linux-4.0.tar.xz
> sync
> echo 3 >/proc/sys/vm/drop_caches
> tar df linux-4.0.tar.xz

Thereafter, the two emacs package files again had a wrong mtime (which by the
way shows when I start emacs).

Could this be due to the lazytime mount option?
-- 
Regards,
jvp.


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-13  9:35 ext4 lazytime: ctime of some files changed Jörg-Volker Peetz
  2015-05-13 16:20 ` Jörg-Volker Peetz
@ 2015-05-14  2:17 ` Theodore Ts'o
  2015-05-14  8:27   ` Jörg-Volker Peetz
  2015-05-14  8:34   ` Jörg-Volker Peetz
  2015-05-16 14:30 ` Holger Hoffstätte
  2 siblings, 2 replies; 16+ messages in thread
From: Theodore Ts'o @ 2015-05-14  2:17 UTC (permalink / raw)
  To: Jörg-Volker Peetz; +Cc: linux-fsdevel

On Wed, May 13, 2015 at 11:35:31AM +0200, Jörg-Volker Peetz wrote:
> 
> on my laptop with ext4 fs (on SSD) I started to try the lazytime mount option
> using a self compiled kernel 4.0.2 on a debian system with mount version 2.26.2.
> Before that, I've used the noatime mount option.
> 
> After restarting the system with an adapted /etc/fstab file and the kernel
> parameter "rootflags=lazytime", the relatime mount option was also set. I
> changed that by commanding "mount -o remount,strictatime /", etc.

The lazytime flag is independent of strictatime/relatime/noatime.  And
the default is relatime.  So when you replaced noatime with lazytime,
it's not surprising that you saw the relatime mount option being set.

> By accident, I noticed that some files had a modified ctime and mtime although
> they were not changed or modified.
> 
> Has anybody else experienced that? Do I miss a patch?

I haven't seen this myself.

> Mount options in fstab: nobarrier,lazytime,errors=remount-ro
> The filesystems are ext4 on a primary partition of the SSD with default mount
> option journal_data_writeback. I created them in Feb 2011.
> 
> By the way, the command "mount -o remount,lazytime /" does not do the switch to
> lazytime.


# grep sda3 /proc/mounts
/dev/sda3 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
# mount -o remount,lazytime /
# grep sda3 /proc/mounts
/dev/sda3 / ext4 rw,lazytime,relatime,errors=remount-ro,data=ordered 0 0
# uname -a
Linux closure 4.1.0-rc2-11633-gef8a5d0 #125 SMP Tue May 5 21:21:08 EDT 2015 x86_64 GNU/Linux

      	      			       	    	- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-14  2:17 ` Theodore Ts'o
@ 2015-05-14  8:27   ` Jörg-Volker Peetz
  2015-05-14 12:38     ` Theodore Ts'o
  2015-05-14  8:34   ` Jörg-Volker Peetz
  1 sibling, 1 reply; 16+ messages in thread
From: Jörg-Volker Peetz @ 2015-05-14  8:27 UTC (permalink / raw)
  To: linux-fsdevel

Theodore Ts'o wrote on 05/14/2015 04:17:
> On Wed, May 13, 2015 at 11:35:31AM +0200, Jörg-Volker Peetz wrote:
>>
>> By the way, the command "mount -o remount,lazytime /" does not do the switch to
>> lazytime.
> 
> 
> # grep sda3 /proc/mounts
> /dev/sda3 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
> # mount -o remount,lazytime /
> # grep sda3 /proc/mounts
> /dev/sda3 / ext4 rw,lazytime,relatime,errors=remount-ro,data=ordered 0 0
> # uname -a
> Linux closure 4.1.0-rc2-11633-gef8a5d0 #125 SMP Tue May 5 21:21:08 EDT 2015 x86_64 GNU/Linux

# uname -a
Linux fehu 4.0.2 #1 SMP Thu May 7 00:09:53 CEST 2015 x86_64 GNU/Linux
# grep sda2 /proc/mounts
/dev/sda2 /home ext4 rw,noatime,nobarrier,errors=remount-ro 0 0
# mount -o remount,lazytime /home
# grep sda2 /proc/mounts
/dev/sda2 /home ext4 rw,noatime,nobarrier,errors=remount-ro 0 0
# mount --version
mount from util-linux 2.26.2 (libmount 2.26.0: selinux, assert, debug)

Also switching to relatime does not work with the mount command. Could it be a
problem with the mount package of debian?
-- 
Regards,
jvp.


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-14  2:17 ` Theodore Ts'o
  2015-05-14  8:27   ` Jörg-Volker Peetz
@ 2015-05-14  8:34   ` Jörg-Volker Peetz
  1 sibling, 0 replies; 16+ messages in thread
From: Jörg-Volker Peetz @ 2015-05-14  8:34 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Theodore Ts'o

[forgot to Cc to you]
Theodore Ts'o wrote on 05/14/2015 04:17:
> On Wed, May 13, 2015 at 11:35:31AM +0200, Jörg-Volker Peetz wrote:
>>
>> By the way, the command "mount -o remount,lazytime /" does not do the switch to
>> lazytime.
> 
> 
> # grep sda3 /proc/mounts
> /dev/sda3 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
> # mount -o remount,lazytime /
> # grep sda3 /proc/mounts
> /dev/sda3 / ext4 rw,lazytime,relatime,errors=remount-ro,data=ordered 0 0
> # uname -a
> Linux closure 4.1.0-rc2-11633-gef8a5d0 #125 SMP Tue May 5 21:21:08 EDT 2015 x86_64 GNU/Linux

# uname -a
Linux fehu 4.0.2 #1 SMP Thu May 7 00:09:53 CEST 2015 x86_64 GNU/Linux
# grep sda2 /proc/mounts
/dev/sda2 /home ext4 rw,noatime,nobarrier,errors=remount-ro 0 0
# mount -o remount,lazytime /home
# grep sda2 /proc/mounts
/dev/sda2 /home ext4 rw,noatime,nobarrier,errors=remount-ro 0 0
# mount --version
mount from util-linux 2.26.2 (libmount 2.26.0: selinux, assert, debug)

Also switching to relatime does not work with the mount command. Could it be a
problem with the mount package of debian?
-- 
Regards,
jvp.


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-14  8:27   ` Jörg-Volker Peetz
@ 2015-05-14 12:38     ` Theodore Ts'o
  2015-05-14 12:58       ` Jörg-Volker Peetz
  0 siblings, 1 reply; 16+ messages in thread
From: Theodore Ts'o @ 2015-05-14 12:38 UTC (permalink / raw)
  To: Jörg-Volker Peetz; +Cc: linux-fsdevel

On Thu, May 14, 2015 at 10:27:58AM +0200, Jörg-Volker Peetz wrote:
> 
> Also switching to relatime does not work with the mount command. Could it be a
> problem with the mount package of debian?

I'm using Debian Jessie:

ii  mount                2.25.2-6        amd64           Tools for mounting and manipulating filesystem

The other difference might be what you and I have in our /etc/fstab?
I have:

LABEL=closure-root	/               ext4    errors=remount-ro 0       1

Can you also try something like this?

# strace -o /tmp/st mount -o remount,nolazytime /
# grep ^mount /tmp/st
mount("/dev/sda3", "/", 0x1f21250, MS_MGC_VAL|MS_REMOUNT, "errors=remount-ro,lazytime") = 0

Cheers,

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-14 12:38     ` Theodore Ts'o
@ 2015-05-14 12:58       ` Jörg-Volker Peetz
  2015-05-14 13:09         ` Jörg-Volker Peetz
  2015-05-14 17:58         ` Jörg-Volker Peetz
  0 siblings, 2 replies; 16+ messages in thread
From: Jörg-Volker Peetz @ 2015-05-14 12:58 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Theodore Ts'o

Theodore Ts'o wrote on 05/14/2015 14:38:
> On Thu, May 14, 2015 at 10:27:58AM +0200, Jörg-Volker Peetz wrote:
>>
>> Also switching to relatime does not work with the mount command. Could it be a
>> problem with the mount package of debian?
> 
> I'm using Debian Jessie:
> 
I'm using a mixture of testing and sid with mount, util-linux, etc. version
2.26.2-2.

> ii  mount                2.25.2-6        amd64           Tools for mounting and manipulating filesystem
> 
> The other difference might be what you and I have in our /etc/fstab?
> I have:
> 
> LABEL=closure-root	/               ext4    errors=remount-ro 0       1
> 
Here:
  UUID=7e13aca5-...   /  ext4  nobarrier,noatime,errors=remount-ro  0  2

> Can you also try something like this?
> 
> # strace -o /tmp/st mount -o remount,nolazytime /
> # grep ^mount /tmp/st
> mount("/dev/sda3", "/", 0x1f21250, MS_MGC_VAL|MS_REMOUNT, "errors=remount-ro,lazytime") = 0
> 
mount("/dev/sda1", "/", 0x1488780, MS_MGC_VAL|MS_REMOUNT|MS_NOATIME,
"nobarrier,errors=remount-ro") = 0

> Cheers,
> 
> 						- Ted
Thank you for your support.
-- 
Jörg.



--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-14 12:58       ` Jörg-Volker Peetz
@ 2015-05-14 13:09         ` Jörg-Volker Peetz
  2015-05-14 17:58         ` Jörg-Volker Peetz
  1 sibling, 0 replies; 16+ messages in thread
From: Jörg-Volker Peetz @ 2015-05-14 13:09 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Theodore Ts'o

Jörg-Volker Peetz wrote on 05/14/2015 14:58:
> Theodore Ts'o wrote on 05/14/2015 14:38:
>> On Thu, May 14, 2015 at 10:27:58AM +0200, Jörg-Volker Peetz wrote:
>>>
>>> Also switching to relatime does not work with the mount command. Could it be a
>>> problem with the mount package of debian?
>>
>> I'm using Debian Jessie:
>>
> I'm using a mixture of testing and sid with mount, util-linux, etc. version
> 2.26.2-2.
> 
>> ii  mount                2.25.2-6        amd64           Tools for mounting and manipulating filesystem
>>
>> The other difference might be what you and I have in our /etc/fstab?
>> I have:
>>
>> LABEL=closure-root	/               ext4    errors=remount-ro 0       1
>>
> Here:
>   UUID=7e13aca5-...   /  ext4  nobarrier,noatime,errors=remount-ro  0  2
> 
Typo here, is actually
  UUID=7e13aca5-...   /  ext4  nobarrier,noatime,errors=remount-ro  0  1

>> Can you also try something like this?
>>
>> # strace -o /tmp/st mount -o remount,nolazytime /
>> # grep ^mount /tmp/st
>> mount("/dev/sda3", "/", 0x1f21250, MS_MGC_VAL|MS_REMOUNT, "errors=remount-ro,lazytime") = 0
>>
> mount("/dev/sda1", "/", 0x1488780, MS_MGC_VAL|MS_REMOUNT|MS_NOATIME,
> "nobarrier,errors=remount-ro") = 0
> 
>> Cheers,
>>
>> 						- Ted
> Thank you for your support.
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-14 12:58       ` Jörg-Volker Peetz
  2015-05-14 13:09         ` Jörg-Volker Peetz
@ 2015-05-14 17:58         ` Jörg-Volker Peetz
  1 sibling, 0 replies; 16+ messages in thread
From: Jörg-Volker Peetz @ 2015-05-14 17:58 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Theodore Ts'o

Jörg-Volker Peetz wrote on 05/14/2015 14:58:
> Theodore Ts'o wrote on 05/14/2015 14:38:
>> On Thu, May 14, 2015 at 10:27:58AM +0200, Jörg-Volker Peetz wrote:
>>>
>>> Also switching to relatime does not work with the mount command. Could it be a
>>> problem with the mount package of debian?
>>
>> I'm using Debian Jessie:
>>
> I'm using a mixture of testing and sid with mount, util-linux, etc. version
> 2.26.2-2.
> 
>> ii  mount                2.25.2-6        amd64           Tools for mounting and manipulating filesystem
>>
>> The other difference might be what you and I have in our /etc/fstab?
>> I have:
>>
>> LABEL=closure-root	/               ext4    errors=remount-ro 0       1
>>
> Here:
>   UUID=7e13aca5-...   /  ext4  nobarrier,noatime,errors=remount-ro  0  2
> 
>> Can you also try something like this?
>>
>> # strace -o /tmp/st mount -o remount,nolazytime /
>> # grep ^mount /tmp/st
>> mount("/dev/sda3", "/", 0x1f21250, MS_MGC_VAL|MS_REMOUNT, "errors=remount-ro,lazytime") = 0
>>
> mount("/dev/sda1", "/", 0x1488780, MS_MGC_VAL|MS_REMOUNT|MS_NOATIME,
> "nobarrier,errors=remount-ro") = 0
> 
After re-reading it again, I should clarify that I meanwhile rebooted with
noatime. Maybe then, it is more helpful to show the output of

# strace -o /tmp/st mount -o remount,lazytime /
# grep ^mount /tmp/st
mount("/dev/sda1", "/", 0x10a0780, MS_REMOUNT|MS_NOATIME|0x2000000,
"nobarrier,errors=remount-ro") = 0

-- 
Regards,
Jörg.


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-13 16:20 ` Jörg-Volker Peetz
@ 2015-05-14 22:20   ` Theodore Ts'o
  2015-05-15  7:17     ` Jörg-Volker Peetz
  2015-05-15 15:14     ` Jörg-Volker Peetz
  0 siblings, 2 replies; 16+ messages in thread
From: Theodore Ts'o @ 2015-05-14 22:20 UTC (permalink / raw)
  To: Jörg-Volker Peetz; +Cc: linux-ext4

On Wed, May 13, 2015 at 06:20:35PM +0200, Jörg-Volker Peetz wrote:
> 
> Thereafter, the two emacs package files again had a wrong mtime (which by the
> way shows when I start emacs).
> 
> Could this be due to the lazytime mount option?

I think I found the problem.  My bad.  Can you verify that this solves
the problem for you?

From 8f4d855839179f410fa910a26eb81d646d628f26 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Thu, 14 May 2015 18:19:01 -0400
Subject: [PATCH] ext4: fix lazytime optimization

We had a fencepost error in the lazytime optimization which means that
timestamp would get written to the wrong inode.

Cc: stable@vger.kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 fs/ext4/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 55b187c..0554b0b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4345,7 +4345,7 @@ static void ext4_update_other_inodes_time(struct super_block *sb,
 	int inode_size = EXT4_INODE_SIZE(sb);
 
 	oi.orig_ino = orig_ino;
-	ino = orig_ino & ~(inodes_per_block - 1);
+	ino = (orig_ino & ~(inodes_per_block - 1)) + 1;
 	for (i = 0; i < inodes_per_block; i++, ino++, buf += inode_size) {
 		if (ino == orig_ino)
 			continue;
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-14 22:20   ` Theodore Ts'o
@ 2015-05-15  7:17     ` Jörg-Volker Peetz
  2015-05-15 15:14     ` Jörg-Volker Peetz
  1 sibling, 0 replies; 16+ messages in thread
From: Jörg-Volker Peetz @ 2015-05-15  7:17 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4

Theodore Ts'o wrote on 05/15/2015 00:20:
> On Wed, May 13, 2015 at 06:20:35PM +0200, Jörg-Volker Peetz wrote:
>>
>> Thereafter, the two emacs package files again had a wrong mtime (which by the
>> way shows when I start emacs).
>>
>> Could this be due to the lazytime mount option?
> 
> I think I found the problem.  My bad.  Can you verify that this solves
> the problem for you?
> 
I'll try the patch today after repairing most of the timestamps from backup to
have a reference.
-- 
Regards,
Jörg.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-14 22:20   ` Theodore Ts'o
  2015-05-15  7:17     ` Jörg-Volker Peetz
@ 2015-05-15 15:14     ` Jörg-Volker Peetz
  2015-05-15 23:11       ` Theodore Ts'o
  1 sibling, 1 reply; 16+ messages in thread
From: Jörg-Volker Peetz @ 2015-05-15 15:14 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4

Theodore Ts'o wrote on 05/15/2015 00:20:
> On Wed, May 13, 2015 at 06:20:35PM +0200, Jörg-Volker Peetz wrote:
>>
>> Thereafter, the two emacs package files again had a wrong mtime (which by the
>> way shows when I start emacs).
>>
>> Could this be due to the lazytime mount option?
> 
> I think I found the problem.  My bad.  Can you verify that this solves
> the problem for you?
> 
Meanwhile I've kernel version 4.0.3 with your patch on top and

$ grep -E '(root|sda)' /proc/mounts
/dev/root / ext4 rw,lazytime,nobarrier,errors=remount-ro 0 0
/dev/sda2 /home ext4 rw,lazytime,nobarrier,errors=remount-ro 0 0

running nearly two hours without any file timestamp related anomalies while
doing some file activity and a sync from time to time :-)
Thanks for caring.

> From 8f4d855839179f410fa910a26eb81d646d628f26 Mon Sep 17 00:00:00 2001
> From: Theodore Ts'o <tytso@mit.edu>
> Date: Thu, 14 May 2015 18:19:01 -0400
> Subject: [PATCH] ext4: fix lazytime optimization
> 
> We had a fencepost error in the lazytime optimization which means that
> timestamp would get written to the wrong inode.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
>  fs/ext4/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 55b187c..0554b0b 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4345,7 +4345,7 @@ static void ext4_update_other_inodes_time(struct super_block *sb,
>  	int inode_size = EXT4_INODE_SIZE(sb);
>  
>  	oi.orig_ino = orig_ino;
> -	ino = orig_ino & ~(inodes_per_block - 1);
> +	ino = (orig_ino & ~(inodes_per_block - 1)) + 1;
>  	for (i = 0; i < inodes_per_block; i++, ino++, buf += inode_size) {
>  		if (ino == orig_ino)
>  			continue;
> 
-- 
Regards,
Jörg.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-15 15:14     ` Jörg-Volker Peetz
@ 2015-05-15 23:11       ` Theodore Ts'o
  2015-05-20  8:48         ` Jörg-Volker Peetz
  0 siblings, 1 reply; 16+ messages in thread
From: Theodore Ts'o @ 2015-05-15 23:11 UTC (permalink / raw)
  To: Jörg-Volker Peetz; +Cc: linux-ext4

On Fri, May 15, 2015 at 05:14:10PM +0200, Jörg-Volker Peetz wrote:
> running nearly two hours without any file timestamp related anomalies while
> doing some file activity and a sync from time to time :-)
> Thanks for caring.

Many thanks for the bug report!   :-)

     	    	    	- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-13  9:35 ext4 lazytime: ctime of some files changed Jörg-Volker Peetz
  2015-05-13 16:20 ` Jörg-Volker Peetz
  2015-05-14  2:17 ` Theodore Ts'o
@ 2015-05-16 14:30 ` Holger Hoffstätte
  2 siblings, 0 replies; 16+ messages in thread
From: Holger Hoffstätte @ 2015-05-16 14:30 UTC (permalink / raw)
  To: linux-fsdevel

On Wed, 13 May 2015 11:35:31 +0200, Jörg-Volker Peetz wrote:

> By the way, the command "mount -o remount,lazytime /" does not do the switch to
> lazytime.

Had the same problem, found the regression:

http://article.gmane.org/gmane.comp.file-systems.ext4/48663

Solution: downgrade to util-linux-2.25.2.

cheers
Holger

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-15 23:11       ` Theodore Ts'o
@ 2015-05-20  8:48         ` Jörg-Volker Peetz
  2015-05-23 13:24           ` Jörg-Volker Peetz
  0 siblings, 1 reply; 16+ messages in thread
From: Jörg-Volker Peetz @ 2015-05-20  8:48 UTC (permalink / raw)
  To: linux-ext4; +Cc: Theodore Ts'o

Hi Ted,

Theodore Ts'o wrote on 05/16/2015 01:11:
> On Fri, May 15, 2015 at 05:14:10PM +0200, Jörg-Volker Peetz wrote:
>> running nearly two hours without any file timestamp related anomalies while
>> doing some file activity and a sync from time to time :-)
>> Thanks for caring.
> 
> Many thanks for the bug report!   :-)
> 
>      	    	    	- Ted

after a few days of running the patch, I seem to have again two files with
changed mtime without touching them (only reading by rsync).

I took a look into the file fs/ext4/inode.c and saw this code in function
__ext4_get_inode_loc(struct inode *inode,
				struct ext4_iloc *iloc, int in_mem)
:

		if (in_mem) {
			struct buffer_head *bitmap_bh;
			int i, start;

			start = inode_offset & ~(inodes_per_block - 1);

			/* Is the inode bitmap in cache? */
			bitmap_bh = sb_getblk(sb, ext4_inode_bitmap(sb, gdp));

I'm not sure, if this is relevant, but just for curiosity, why does "start" here
not need a "+ 1"?
-- 
Regards,
Jörg.


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ext4 lazytime: ctime of some files changed
  2015-05-20  8:48         ` Jörg-Volker Peetz
@ 2015-05-23 13:24           ` Jörg-Volker Peetz
  0 siblings, 0 replies; 16+ messages in thread
From: Jörg-Volker Peetz @ 2015-05-23 13:24 UTC (permalink / raw)
  To: linux-ext4; +Cc: Theodore Ts'o

Jörg-Volker Peetz wrote on 05/20/2015 10:48:
<snip>
> after a few days of running the patch, I seem to have again two files with
> changed mtime without touching them (only reading by rsync).
> 
<snip>
I can affirm this error, but am not sure where to hunt.
I'm using several USB drives in a cycle for backup.
I have a directory with a file originally older than a few years.
Mount options are

$ grep sda /proc/mounts
/dev/sda2 /home ext4 rw,lazytime,relatime,nobarrier,errors=remount-ro 0 0

(using lazytime with relatime).
As reported, while I started using lazytime, this file's mtime got changed.
I reset the mtime with the "touch -r <intact_copy> <file>" command.
After a backup to one of the USB drives with something like

$ rsync -acv --exclude-from=<file> --delete-excluded <SRC> <DEST_ON_USB_DRIVE>

the namely file had its mtime changed  on the *source* device (the USB drive has
an ext4 fs mounted without the lazytime option).
I reset that again on the source SSD using "touch". Another file in the same was
also modified.

Next backup on another USB drive, same thing.
I took a look into the file list on the backup medium before the backup.
There the file also had a different mtime, but not the same mtime the file got
after the backup.

I'm confused.
Any idea?
-- 
Regards,
Jörg.


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-05-23 13:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-13  9:35 ext4 lazytime: ctime of some files changed Jörg-Volker Peetz
2015-05-13 16:20 ` Jörg-Volker Peetz
2015-05-14 22:20   ` Theodore Ts'o
2015-05-15  7:17     ` Jörg-Volker Peetz
2015-05-15 15:14     ` Jörg-Volker Peetz
2015-05-15 23:11       ` Theodore Ts'o
2015-05-20  8:48         ` Jörg-Volker Peetz
2015-05-23 13:24           ` Jörg-Volker Peetz
2015-05-14  2:17 ` Theodore Ts'o
2015-05-14  8:27   ` Jörg-Volker Peetz
2015-05-14 12:38     ` Theodore Ts'o
2015-05-14 12:58       ` Jörg-Volker Peetz
2015-05-14 13:09         ` Jörg-Volker Peetz
2015-05-14 17:58         ` Jörg-Volker Peetz
2015-05-14  8:34   ` Jörg-Volker Peetz
2015-05-16 14:30 ` Holger Hoffstätte

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.