aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorCurt Wohlgemuth <curtw@google.com>2010-04-03 16:45:06 -0400
committerTheodore Ts'o <tytso@mit.edu>2010-04-03 16:45:06 -0400
commit8b472d739b2ddd8ab7fb278874f696cd95b25a5e (patch)
treec820b44837a7e6130bbf7710e09ce5c06118e764 /fs
parent2eaa9cfdf33b8d7fb7aff27792192e0019ae8fc6 (diff)
ext4: Fix possible lost inode write in no journal mode
In the no-journal case, ext4_write_inode() will fetch the bh and call sync_dirty_buffer() on it. However, if the bh has already been written and the bh reclaimed for some other purpose, AND if the inode is the only one in the inode table block in use, then ext4_get_inode_loc() will not read the inode table block from disk, but as an optimization, fill the block with zero's assuming that its caller will copy in the on-disk version of the inode. This is not done by ext4_write_inode(), so the contents of the inode can simply get lost. The fix is to use __ext4_get_inode_loc() with in_mem set to 0, instead of ext4_get_inode_loc(). Long term the API needs to be fixed so it's obvious why latter is not safe. Addresses-Google-Bug: #2526446 Signed-off-by: Curt Wohlgemuth <curtw@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/inode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 11119e07233b..87e3c70d0692 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5374,7 +5374,7 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc)
5374 } else { 5374 } else {
5375 struct ext4_iloc iloc; 5375 struct ext4_iloc iloc;
5376 5376
5377 err = ext4_get_inode_loc(inode, &iloc); 5377 err = __ext4_get_inode_loc(inode, &iloc, 0);
5378 if (err) 5378 if (err)
5379 return err; 5379 return err;
5380 if (wbc->sync_mode == WB_SYNC_ALL) 5380 if (wbc->sync_mode == WB_SYNC_ALL)