diff options
author | Jan Kara <jack@suse.cz> | 2010-01-06 15:58:48 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-03-04 18:20:20 -0500 |
commit | 9df93939b735dd273e49cbee290b9f4738500ef4 (patch) | |
tree | 2840172239e13d1c0fea496755b8346a9b394336 /fs/ext3/file.c | |
parent | 26245c949c8473ea7352907b5a54bc34487eb87f (diff) |
ext3: Use bitops to read/modify EXT3_I(inode)->i_state
At several places we modify EXT3_I(inode)->i_state without holding i_mutex
(ext3_release_file, ext3_bmap, ext3_journalled_writepage, ext3_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.
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3/file.c')
-rw-r--r-- | fs/ext3/file.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext3/file.c b/fs/ext3/file.c index 388bbdfa0b4e..a86d3302cdc2 100644 --- a/fs/ext3/file.c +++ b/fs/ext3/file.c | |||
@@ -33,9 +33,9 @@ | |||
33 | */ | 33 | */ |
34 | static int ext3_release_file (struct inode * inode, struct file * filp) | 34 | static int ext3_release_file (struct inode * inode, struct file * filp) |
35 | { | 35 | { |
36 | if (EXT3_I(inode)->i_state & EXT3_STATE_FLUSH_ON_CLOSE) { | 36 | if (ext3_test_inode_state(inode, EXT3_STATE_FLUSH_ON_CLOSE)) { |
37 | filemap_flush(inode->i_mapping); | 37 | filemap_flush(inode->i_mapping); |
38 | EXT3_I(inode)->i_state &= ~EXT3_STATE_FLUSH_ON_CLOSE; | 38 | ext3_clear_inode_state(inode, EXT3_STATE_FLUSH_ON_CLOSE); |
39 | } | 39 | } |
40 | /* if we are the last writer on the inode, drop the block reservation */ | 40 | /* if we are the last writer on the inode, drop the block reservation */ |
41 | if ((filp->f_mode & FMODE_WRITE) && | 41 | if ((filp->f_mode & FMODE_WRITE) && |