From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:47180 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754935AbbG3AZ2 (ORCPT ); Wed, 29 Jul 2015 20:25:28 -0400 Subject: Patch "ext4: fix fencepost error in lazytime optimization" has been added to the 4.1-stable tree To: tytso@mit.edu, gregkh@linuxfoundation.org Cc: , From: Date: Wed, 29 Jul 2015 17:25:27 -0700 Message-ID: <14382159277315@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled ext4: fix fencepost error in lazytime optimization to the 4.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ext4-fix-fencepost-error-in-lazytime-optimization.patch and it can be found in the queue-4.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From 0f0ff9a9f3fa2ec6f427603fd521d5f3a0b076d1 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 1 Jul 2015 23:37:46 -0400 Subject: ext4: fix fencepost error in lazytime optimization From: Theodore Ts'o commit 0f0ff9a9f3fa2ec6f427603fd521d5f3a0b076d1 upstream. Commit 8f4d8558391: "ext4: fix lazytime optimization" was not a complete fix. In the case where the inode number is a multiple of 16, and we could still end up updating an inode with dirty timestamps written to the wrong inode on disk. Oops. This can be easily reproduced by using generic/005 with a file system with metadata_csum and lazytime enabled. Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4360,7 +4360,12 @@ static void ext4_update_other_inodes_tim int inode_size = EXT4_INODE_SIZE(sb); oi.orig_ino = orig_ino; - ino = (orig_ino & ~(inodes_per_block - 1)) + 1; + /* + * Calculate the first inode in the inode table block. Inode + * numbers are one-based. That is, the first inode in a block + * (assuming 4k blocks and 256 byte inodes) is (n*16 + 1). + */ + ino = ((orig_ino - 1) & ~(inodes_per_block - 1)) + 1; for (i = 0; i < inodes_per_block; i++, ino++, buf += inode_size) { if (ino == orig_ino) continue; Patches currently in stable-queue which might be from tytso@mit.edu are queue-4.1/ext4-correctly-migrate-a-file-with-a-hole-at-the-beginning.patch queue-4.1/ext4-set-lazytime-on-remount-if-ms_lazytime-is-set-by-mount.patch queue-4.1/jbd2-fix-ocfs2-corrupt-when-updating-journal-superblock-fails.patch queue-4.1/ext4-be-more-strict-when-migrating-to-non-extent-based-file.patch queue-4.1/jbd2-use-gfp_nofs-in-jbd2_cleanup_journal_tail.patch queue-4.1/ext4-fix-fencepost-error-in-lazytime-optimization.patch queue-4.1/ext4-replace-open-coded-nofail-allocation-in-ext4_free_blocks.patch queue-4.1/ext4-don-t-retry-file-block-mapping-on-bigalloc-fs-with-non-extent-file.patch queue-4.1/bufferhead-add-_gfp-version-for-sb_getblk.patch queue-4.1/ext4-avoid-deadlocks-in-the-writeback-path-by-using-sb_getblk_gfp.patch queue-4.1/ext4-call-sync_blockdev-before-invalidate_bdev-in-put_super.patch queue-4.1/ext4-fix-race-between-truncate-and-__ext4_journalled_writepage.patch queue-4.1/ext4-fix-reservation-release-on-invalidatepage-for-delalloc-fs.patch