]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.17/0026-ext4-Fix-possible-lost-inode-write-in-no-journal-mod.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.17 / 0026-ext4-Fix-possible-lost-inode-write-in-no-journal-mod.patch
1 From 457ad9487d209f3c7bcb6de32aa393f75ba5e22d Mon Sep 17 00:00:00 2001
2 From: Curt Wohlgemuth <curtw@google.com>
3 Date: Sun, 30 May 2010 22:49:40 -0400
4 Subject: ext4: Fix possible lost inode write in no journal mode
5
6 commit 8b472d739b2ddd8ab7fb278874f696cd95b25a5e upstream (as of v2.6.34-rc6)
7
8 In the no-journal case, ext4_write_inode() will fetch the bh and call
9 sync_dirty_buffer() on it. However, if the bh has already been
10 written and the bh reclaimed for some other purpose, AND if the inode
11 is the only one in the inode table block in use, then
12 ext4_get_inode_loc() will not read the inode table block from disk,
13 but as an optimization, fill the block with zero's assuming that its
14 caller will copy in the on-disk version of the inode. This is not
15 done by ext4_write_inode(), so the contents of the inode can simply
16 get lost. The fix is to use __ext4_get_inode_loc() with in_mem set to
17 0, instead of ext4_get_inode_loc(). Long term the API needs to be
18 fixed so it's obvious why latter is not safe.
19
20 Addresses-Google-Bug: #2526446
21
22 Signed-off-by: Curt Wohlgemuth <curtw@google.com>
23 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
25 ---
26 fs/ext4/inode.c | 2 +-
27 1 file changed, 1 insertion(+), 1 deletion(-)
28
29 --- a/fs/ext4/inode.c
30 +++ b/fs/ext4/inode.c
31 @@ -5260,7 +5260,7 @@ int ext4_write_inode(struct inode *inode
32 } else {
33 struct ext4_iloc iloc;
34
35 - err = ext4_get_inode_loc(inode, &iloc);
36 + err = __ext4_get_inode_loc(inode, &iloc, 0);
37 if (err)
38 return err;
39 if (wait)