aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/file.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2010-01-24 14:34:07 -0500
committerTheodore Ts'o <tytso@mit.edu>2010-01-24 14:34:07 -0500
commit19f5fb7ad679bb361222c7916086435020c37cce (patch)
tree9e301163075c4faaf340cf50afd51855c76acd8c /fs/ext4/file.c
parentd2eecb03936878ec574ade5532fa83df7d75dde7 (diff)
ext4: Use bitops to read/modify EXT4_I(inode)->i_state
At several places we modify EXT4_I(inode)->i_state without holding i_mutex (ext4_release_file, ext4_bmap, ext4_journalled_writepage, ext4_do_update_inode, ...). These modifications are racy and we can lose updates to i_state. So convert handling of i_state to use bitops which are atomic. Cc: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/file.c')
-rw-r--r--fs/ext4/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 9630583cef28..f6071ce0b155 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -35,9 +35,9 @@
35 */ 35 */
36static int ext4_release_file(struct inode *inode, struct file *filp) 36static int ext4_release_file(struct inode *inode, struct file *filp)
37{ 37{
38 if (EXT4_I(inode)->i_state & EXT4_STATE_DA_ALLOC_CLOSE) { 38 if (ext4_test_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE)) {
39 ext4_alloc_da_blocks(inode); 39 ext4_alloc_da_blocks(inode);
40 EXT4_I(inode)->i_state &= ~EXT4_STATE_DA_ALLOC_CLOSE; 40 ext4_clear_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE);
41 } 41 }
42 /* if we are the last writer on the inode, drop the block reservation */ 42 /* if we are the last writer on the inode, drop the block reservation */
43 if ((filp->f_mode & FMODE_WRITE) && 43 if ((filp->f_mode & FMODE_WRITE) &&