aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/move_extent.c
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2012-09-29 00:41:21 -0400
committerTheodore Ts'o <tytso@mit.edu>2012-09-29 00:41:21 -0400
commit17335dcc471199717839b2fa3492ca36f70f1168 (patch)
tree5f39f51868f60f8be94ca7e811d34bba443ef288 /fs/ext4/move_extent.c
parent28a535f9a0df060569dcc786e5bc2e1de43d7dc7 (diff)
ext4: serialize dio nonlocked reads with defrag workers
Inode's block defrag and ext4_change_inode_journal_flag() may affect nonlocked DIO reads result, so proper synchronization required. - Add missed inode_dio_wait() calls where appropriate - Check inode state under extra i_dio_count reference. Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/move_extent.c')
-rw-r--r--fs/ext4/move_extent.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index 8076b96b5299..292daeeed455 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -1323,6 +1323,12 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
1323 /* Protect orig and donor inodes against a truncate */ 1323 /* Protect orig and donor inodes against a truncate */
1324 mext_inode_double_lock(orig_inode, donor_inode); 1324 mext_inode_double_lock(orig_inode, donor_inode);
1325 1325
1326 /* Wait for all existing dio workers */
1327 ext4_inode_block_unlocked_dio(orig_inode);
1328 ext4_inode_block_unlocked_dio(donor_inode);
1329 inode_dio_wait(orig_inode);
1330 inode_dio_wait(donor_inode);
1331
1326 /* Protect extent tree against block allocations via delalloc */ 1332 /* Protect extent tree against block allocations via delalloc */
1327 double_down_write_data_sem(orig_inode, donor_inode); 1333 double_down_write_data_sem(orig_inode, donor_inode);
1328 /* Check the filesystem environment whether move_extent can be done */ 1334 /* Check the filesystem environment whether move_extent can be done */
@@ -1521,6 +1527,8 @@ out:
1521 kfree(holecheck_path); 1527 kfree(holecheck_path);
1522 } 1528 }
1523 double_up_write_data_sem(orig_inode, donor_inode); 1529 double_up_write_data_sem(orig_inode, donor_inode);
1530 ext4_inode_resume_unlocked_dio(orig_inode);
1531 ext4_inode_resume_unlocked_dio(donor_inode);
1524 mext_inode_double_unlock(orig_inode, donor_inode); 1532 mext_inode_double_unlock(orig_inode, donor_inode);
1525 1533
1526 return ret; 1534 return ret;