diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
index 0f68b8a14560e1be631606a9689c083797e80096..1b0dfd963d3f01992dc70893849fd4c701c30ef7 100644
--- a/fs/ext4/migrate.c
+++ b/fs/ext4/migrate.c
@@ -664,8 +664,8 @@ int ext4_ind_migrate(struct inode *inode)
 	if (unlikely(ret2 && !ret))
 		ret = ret2;
 errout:
-	ext4_journal_stop(handle);
 	up_write(&EXT4_I(inode)->i_data_sem);
+	ext4_journal_stop(handle);
 out_unlock:
 	ext4_writepages_up_write(inode->i_sb, alloc_ctx);
 	return ret;