1 ext4: fix fencepost error in lazytime optimization
3 Commit 8f4d8558391: "ext4: fix lazytime optimization" was not a
4 complete fix. In the case where the inode number is a multiple of 16,
5 and we could still end up updating an inode with dirty timestamps
6 written to the wrong inode on disk. Oops.
8 This can be easily reproduced by using generic/005 with a file system
9 with metadata_csum and lazytime enabled.
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 Cc: stable@vger.kernel.org
14 fs/ext4/inode.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
17 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
18 index e057c6f..0b4dd57 100644
21 @@ -4348,7 +4348,7 @@ static void ext4_update_other_inodes_time(struct super_block *sb,
22 int inode_size = EXT4_INODE_SIZE(sb);
24 oi.orig_ino = orig_ino;
25 - ino = (orig_ino & ~(inodes_per_block - 1)) + 1;
26 + ino = ((orig_ino - 1) & ~(inodes_per_block - 1)) + 1;
27 for (i = 0; i < inodes_per_block; i++, ino++, buf += inode_size) {