diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2014-04-03 17:47:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 19:20:56 -0400 |
commit | 6fdb702d6262b18b1b41a35f1f81903b0a2bc2c9 (patch) | |
tree | fd2dad0ad0c3706f7e511ffd1b47a5af144a0981 | |
parent | f81c20158f8d5f7938d5eb86ecc42ecc09273ce6 (diff) |
ocfs2: call ocfs2_update_inode_fsync_trans when updating any inode
Ensure that ocfs2_update_inode_fsync_trans() is called any time we touch
an inode in a given transaction. This is a follow-on to the previous
patch to reduce lock contention and deadlocking during an fsync
operation.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Wengang <wen.gang.wang@oracle.com>
Cc: Greg Marsden <greg.marsden@oracle.com>
Cc: Srinivas Eeda <srinivas.eeda@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/ocfs2/acl.c | 1 | ||||
-rw-r--r-- | fs/ocfs2/alloc.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/dir.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 7 | ||||
-rw-r--r-- | fs/ocfs2/move_extents.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 1 | ||||
-rw-r--r-- | fs/ocfs2/suballoc.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/xattr.c | 3 |
8 files changed, 20 insertions, 1 deletions
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c index 555f4cddefe3..7e8282dcea2a 100644 --- a/fs/ocfs2/acl.c +++ b/fs/ocfs2/acl.c | |||
@@ -205,6 +205,7 @@ static int ocfs2_acl_set_mode(struct inode *inode, struct buffer_head *di_bh, | |||
205 | di->i_mode = cpu_to_le16(inode->i_mode); | 205 | di->i_mode = cpu_to_le16(inode->i_mode); |
206 | di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); | 206 | di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); |
207 | di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); | 207 | di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); |
208 | ocfs2_update_inode_fsync_trans(handle, inode, 0); | ||
208 | 209 | ||
209 | ocfs2_journal_dirty(handle, di_bh); | 210 | ocfs2_journal_dirty(handle, di_bh); |
210 | 211 | ||
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 6b97d68e34d3..b4deb5f750d9 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -5728,6 +5728,7 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
5728 | } | 5728 | } |
5729 | 5729 | ||
5730 | ocfs2_et_update_clusters(et, -len); | 5730 | ocfs2_et_update_clusters(et, -len); |
5731 | ocfs2_update_inode_fsync_trans(handle, inode, 1); | ||
5731 | 5732 | ||
5732 | ocfs2_journal_dirty(handle, et->et_root_bh); | 5733 | ocfs2_journal_dirty(handle, et->et_root_bh); |
5733 | 5734 | ||
@@ -7209,6 +7210,7 @@ int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh, | |||
7209 | di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec); | 7210 | di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec); |
7210 | di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); | 7211 | di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); |
7211 | 7212 | ||
7213 | ocfs2_update_inode_fsync_trans(handle, inode, 1); | ||
7212 | ocfs2_journal_dirty(handle, di_bh); | 7214 | ocfs2_journal_dirty(handle, di_bh); |
7213 | 7215 | ||
7214 | out_commit: | 7216 | out_commit: |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 8b48e9b7ad0e..0717662b4aef 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -3006,6 +3006,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
3006 | di->i_size = cpu_to_le64(sb->s_blocksize); | 3006 | di->i_size = cpu_to_le64(sb->s_blocksize); |
3007 | di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec); | 3007 | di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec); |
3008 | di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(dir->i_ctime.tv_nsec); | 3008 | di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(dir->i_ctime.tv_nsec); |
3009 | ocfs2_update_inode_fsync_trans(handle, dir, 1); | ||
3009 | 3010 | ||
3010 | /* | 3011 | /* |
3011 | * This should never fail as our extent list is empty and all | 3012 | * This should never fail as our extent list is empty and all |
@@ -4405,6 +4406,7 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir, | |||
4405 | di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); | 4406 | di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); |
4406 | spin_unlock(&OCFS2_I(dir)->ip_lock); | 4407 | spin_unlock(&OCFS2_I(dir)->ip_lock); |
4407 | di->i_dx_root = cpu_to_le64(0ULL); | 4408 | di->i_dx_root = cpu_to_le64(0ULL); |
4409 | ocfs2_update_inode_fsync_trans(handle, dir, 1); | ||
4408 | 4410 | ||
4409 | ocfs2_journal_dirty(handle, di_bh); | 4411 | ocfs2_journal_dirty(handle, di_bh); |
4410 | 4412 | ||
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 0f14f906dc65..ff33c5ef87f2 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -286,6 +286,7 @@ int ocfs2_update_inode_atime(struct inode *inode, | |||
286 | inode->i_atime = CURRENT_TIME; | 286 | inode->i_atime = CURRENT_TIME; |
287 | di->i_atime = cpu_to_le64(inode->i_atime.tv_sec); | 287 | di->i_atime = cpu_to_le64(inode->i_atime.tv_sec); |
288 | di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); | 288 | di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); |
289 | ocfs2_update_inode_fsync_trans(handle, inode, 0); | ||
289 | ocfs2_journal_dirty(handle, bh); | 290 | ocfs2_journal_dirty(handle, bh); |
290 | 291 | ||
291 | out_commit: | 292 | out_commit: |
@@ -335,6 +336,7 @@ int ocfs2_simple_size_update(struct inode *inode, | |||
335 | if (ret < 0) | 336 | if (ret < 0) |
336 | mlog_errno(ret); | 337 | mlog_errno(ret); |
337 | 338 | ||
339 | ocfs2_update_inode_fsync_trans(handle, inode, 0); | ||
338 | ocfs2_commit_trans(osb, handle); | 340 | ocfs2_commit_trans(osb, handle); |
339 | out: | 341 | out: |
340 | return ret; | 342 | return ret; |
@@ -429,6 +431,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb, | |||
429 | di->i_size = cpu_to_le64(new_i_size); | 431 | di->i_size = cpu_to_le64(new_i_size); |
430 | di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec); | 432 | di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec); |
431 | di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); | 433 | di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); |
434 | ocfs2_update_inode_fsync_trans(handle, inode, 0); | ||
432 | 435 | ||
433 | ocfs2_journal_dirty(handle, fe_bh); | 436 | ocfs2_journal_dirty(handle, fe_bh); |
434 | 437 | ||
@@ -737,6 +740,7 @@ static handle_t *ocfs2_zero_start_ordered_transaction(struct inode *inode, | |||
737 | OCFS2_JOURNAL_ACCESS_WRITE); | 740 | OCFS2_JOURNAL_ACCESS_WRITE); |
738 | if (ret) | 741 | if (ret) |
739 | mlog_errno(ret); | 742 | mlog_errno(ret); |
743 | ocfs2_update_inode_fsync_trans(handle, inode, 1); | ||
740 | 744 | ||
741 | out: | 745 | out: |
742 | if (ret) { | 746 | if (ret) { |
@@ -834,6 +838,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from, | |||
834 | di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); | 838 | di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); |
835 | di->i_mtime_nsec = di->i_ctime_nsec; | 839 | di->i_mtime_nsec = di->i_ctime_nsec; |
836 | ocfs2_journal_dirty(handle, di_bh); | 840 | ocfs2_journal_dirty(handle, di_bh); |
841 | ocfs2_update_inode_fsync_trans(handle, inode, 1); | ||
837 | ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); | 842 | ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); |
838 | } | 843 | } |
839 | 844 | ||
@@ -1338,6 +1343,7 @@ static int __ocfs2_write_remove_suid(struct inode *inode, | |||
1338 | 1343 | ||
1339 | di = (struct ocfs2_dinode *) bh->b_data; | 1344 | di = (struct ocfs2_dinode *) bh->b_data; |
1340 | di->i_mode = cpu_to_le16(inode->i_mode); | 1345 | di->i_mode = cpu_to_le16(inode->i_mode); |
1346 | ocfs2_update_inode_fsync_trans(handle, inode, 0); | ||
1341 | 1347 | ||
1342 | ocfs2_journal_dirty(handle, bh); | 1348 | ocfs2_journal_dirty(handle, bh); |
1343 | 1349 | ||
@@ -1570,6 +1576,7 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1570 | if (ret) | 1576 | if (ret) |
1571 | mlog_errno(ret); | 1577 | mlog_errno(ret); |
1572 | } | 1578 | } |
1579 | ocfs2_update_inode_fsync_trans(handle, inode, 1); | ||
1573 | 1580 | ||
1574 | ocfs2_commit_trans(osb, handle); | 1581 | ocfs2_commit_trans(osb, handle); |
1575 | out: | 1582 | out: |
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c index 64c304d668f0..3ca939552d9c 100644 --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c | |||
@@ -151,6 +151,7 @@ static int __ocfs2_move_extent(handle_t *handle, | |||
151 | old_blkno, len); | 151 | old_blkno, len); |
152 | } | 152 | } |
153 | 153 | ||
154 | ocfs2_update_inode_fsync_trans(handle, inode, 0); | ||
154 | out: | 155 | out: |
155 | ocfs2_free_path(path); | 156 | ocfs2_free_path(path); |
156 | return ret; | 157 | return ret; |
@@ -957,6 +958,7 @@ static int ocfs2_move_extents(struct ocfs2_move_extents_context *context) | |||
957 | inode->i_ctime = CURRENT_TIME; | 958 | inode->i_ctime = CURRENT_TIME; |
958 | di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); | 959 | di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); |
959 | di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); | 960 | di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); |
961 | ocfs2_update_inode_fsync_trans(handle, inode, 0); | ||
960 | 962 | ||
961 | ocfs2_journal_dirty(handle, di_bh); | 963 | ocfs2_journal_dirty(handle, di_bh); |
962 | 964 | ||
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 4a797f22239d..2060fc398445 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -2480,6 +2480,7 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir, | |||
2480 | di->i_orphaned_slot = 0; | 2480 | di->i_orphaned_slot = 0; |
2481 | set_nlink(inode, 1); | 2481 | set_nlink(inode, 1); |
2482 | ocfs2_set_links_count(di, inode->i_nlink); | 2482 | ocfs2_set_links_count(di, inode->i_nlink); |
2483 | ocfs2_update_inode_fsync_trans(handle, inode, 1); | ||
2483 | ocfs2_journal_dirty(handle, di_bh); | 2484 | ocfs2_journal_dirty(handle, di_bh); |
2484 | 2485 | ||
2485 | status = ocfs2_add_entry(handle, dentry, inode, | 2486 | status = ocfs2_add_entry(handle, dentry, inode, |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index 47ae2663a6f5..482d6c2a3ea1 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -771,6 +771,7 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb, | |||
771 | spin_unlock(&OCFS2_I(alloc_inode)->ip_lock); | 771 | spin_unlock(&OCFS2_I(alloc_inode)->ip_lock); |
772 | i_size_write(alloc_inode, le64_to_cpu(fe->i_size)); | 772 | i_size_write(alloc_inode, le64_to_cpu(fe->i_size)); |
773 | alloc_inode->i_blocks = ocfs2_inode_sector_count(alloc_inode); | 773 | alloc_inode->i_blocks = ocfs2_inode_sector_count(alloc_inode); |
774 | ocfs2_update_inode_fsync_trans(handle, alloc_inode, 0); | ||
774 | 775 | ||
775 | status = 0; | 776 | status = 0; |
776 | 777 | ||
@@ -2091,7 +2092,7 @@ int ocfs2_find_new_inode_loc(struct inode *dir, | |||
2091 | 2092 | ||
2092 | ac->ac_find_loc_priv = res; | 2093 | ac->ac_find_loc_priv = res; |
2093 | *fe_blkno = res->sr_blkno; | 2094 | *fe_blkno = res->sr_blkno; |
2094 | 2095 | ocfs2_update_inode_fsync_trans(handle, dir, 0); | |
2095 | out: | 2096 | out: |
2096 | if (handle) | 2097 | if (handle) |
2097 | ocfs2_commit_trans(OCFS2_SB(dir->i_sb), handle); | 2098 | ocfs2_commit_trans(OCFS2_SB(dir->i_sb), handle); |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 4217fedb2c11..14b8c46b4fbb 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -2602,6 +2602,7 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh) | |||
2602 | oi->ip_dyn_features &= ~(OCFS2_INLINE_XATTR_FL | OCFS2_HAS_XATTR_FL); | 2602 | oi->ip_dyn_features &= ~(OCFS2_INLINE_XATTR_FL | OCFS2_HAS_XATTR_FL); |
2603 | di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); | 2603 | di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); |
2604 | spin_unlock(&oi->ip_lock); | 2604 | spin_unlock(&oi->ip_lock); |
2605 | ocfs2_update_inode_fsync_trans(handle, inode, 0); | ||
2605 | 2606 | ||
2606 | ocfs2_journal_dirty(handle, di_bh); | 2607 | ocfs2_journal_dirty(handle, di_bh); |
2607 | out_commit: | 2608 | out_commit: |
@@ -3621,6 +3622,7 @@ int ocfs2_xattr_set(struct inode *inode, | |||
3621 | } | 3622 | } |
3622 | 3623 | ||
3623 | ret = __ocfs2_xattr_set_handle(inode, di, &xi, &xis, &xbs, &ctxt); | 3624 | ret = __ocfs2_xattr_set_handle(inode, di, &xi, &xis, &xbs, &ctxt); |
3625 | ocfs2_update_inode_fsync_trans(ctxt.handle, inode, 0); | ||
3624 | 3626 | ||
3625 | ocfs2_commit_trans(osb, ctxt.handle); | 3627 | ocfs2_commit_trans(osb, ctxt.handle); |
3626 | 3628 | ||
@@ -5483,6 +5485,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode, | |||
5483 | ret = ocfs2_truncate_log_append(osb, handle, blkno, len); | 5485 | ret = ocfs2_truncate_log_append(osb, handle, blkno, len); |
5484 | if (ret) | 5486 | if (ret) |
5485 | mlog_errno(ret); | 5487 | mlog_errno(ret); |
5488 | ocfs2_update_inode_fsync_trans(handle, inode, 0); | ||
5486 | 5489 | ||
5487 | out_commit: | 5490 | out_commit: |
5488 | ocfs2_commit_trans(osb, handle); | 5491 | ocfs2_commit_trans(osb, handle); |