diff options
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 958c3ff800e9..f1bc1e338828 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -983,6 +983,8 @@ static int ext4_ind_get_blocks(handle_t *handle, struct inode *inode, | |||
983 | goto cleanup; | 983 | goto cleanup; |
984 | 984 | ||
985 | set_buffer_new(bh_result); | 985 | set_buffer_new(bh_result); |
986 | |||
987 | ext4_update_inode_fsync_trans(handle, inode, 1); | ||
986 | got_it: | 988 | got_it: |
987 | map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key)); | 989 | map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key)); |
988 | if (count > blocks_to_boundary) | 990 | if (count > blocks_to_boundary) |
@@ -4738,6 +4740,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | |||
4738 | struct ext4_inode *raw_inode; | 4740 | struct ext4_inode *raw_inode; |
4739 | struct ext4_inode_info *ei; | 4741 | struct ext4_inode_info *ei; |
4740 | struct inode *inode; | 4742 | struct inode *inode; |
4743 | journal_t *journal = EXT4_SB(sb)->s_journal; | ||
4741 | long ret; | 4744 | long ret; |
4742 | int block; | 4745 | int block; |
4743 | 4746 | ||
@@ -4802,6 +4805,31 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | |||
4802 | ei->i_data[block] = raw_inode->i_block[block]; | 4805 | ei->i_data[block] = raw_inode->i_block[block]; |
4803 | INIT_LIST_HEAD(&ei->i_orphan); | 4806 | INIT_LIST_HEAD(&ei->i_orphan); |
4804 | 4807 | ||
4808 | /* | ||
4809 | * Set transaction id's of transactions that have to be committed | ||
4810 | * to finish f[data]sync. We set them to currently running transaction | ||
4811 | * as we cannot be sure that the inode or some of its metadata isn't | ||
4812 | * part of the transaction - the inode could have been reclaimed and | ||
4813 | * now it is reread from disk. | ||
4814 | */ | ||
4815 | if (journal) { | ||
4816 | transaction_t *transaction; | ||
4817 | tid_t tid; | ||
4818 | |||
4819 | spin_lock(&journal->j_state_lock); | ||
4820 | if (journal->j_running_transaction) | ||
4821 | transaction = journal->j_running_transaction; | ||
4822 | else | ||
4823 | transaction = journal->j_committing_transaction; | ||
4824 | if (transaction) | ||
4825 | tid = transaction->t_tid; | ||
4826 | else | ||
4827 | tid = journal->j_commit_sequence; | ||
4828 | spin_unlock(&journal->j_state_lock); | ||
4829 | ei->i_sync_tid = tid; | ||
4830 | ei->i_datasync_tid = tid; | ||
4831 | } | ||
4832 | |||
4805 | if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) { | 4833 | if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) { |
4806 | ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); | 4834 | ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); |
4807 | if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > | 4835 | if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > |
@@ -5056,6 +5084,7 @@ static int ext4_do_update_inode(handle_t *handle, | |||
5056 | err = rc; | 5084 | err = rc; |
5057 | ei->i_state &= ~EXT4_STATE_NEW; | 5085 | ei->i_state &= ~EXT4_STATE_NEW; |
5058 | 5086 | ||
5087 | ext4_update_inode_fsync_trans(handle, inode, 0); | ||
5059 | out_brelse: | 5088 | out_brelse: |
5060 | brelse(bh); | 5089 | brelse(bh); |
5061 | ext4_std_error(inode->i_sb, err); | 5090 | ext4_std_error(inode->i_sb, err); |