aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2010-10-27 21:30:07 -0400
committerTheodore Ts'o <tytso@mit.edu>2010-10-27 21:30:07 -0400
commitc999af2b347a55174f702702e0df814d05ef5491 (patch)
tree47957b52c9a54babe4d8aefdda4f09cee5f76249 /fs/ext4
parent3e1e5f501632460184a98237d5460c521510535e (diff)
ext4: queue conversion after adding to inode's completed IO list
By queuing the io end on the unwritten workqueue before adding it to our inode's list of completed IOs, I think we run the risk of the work getting completed, and the IO freed, before we try to add it to the inode's i_completed_io_list. It should be safe to add it to the inode's list of completed IOs, and -then- queue it for completion, I think. Thanks to Dave Chinner for pointing out the race. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Jiaying Zhang <jiayingz@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/inode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 1e824a3ec538..670ab15e4f9a 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3850,14 +3850,14 @@ out:
3850 } 3850 }
3851 wq = EXT4_SB(io_end->inode->i_sb)->dio_unwritten_wq; 3851 wq = EXT4_SB(io_end->inode->i_sb)->dio_unwritten_wq;
3852 3852
3853 /* queue the work to convert unwritten extents to written */
3854 queue_work(wq, &io_end->work);
3855
3856 /* Add the io_end to per-inode completed aio dio list*/ 3853 /* Add the io_end to per-inode completed aio dio list*/
3857 ei = EXT4_I(io_end->inode); 3854 ei = EXT4_I(io_end->inode);
3858 spin_lock_irqsave(&ei->i_completed_io_lock, flags); 3855 spin_lock_irqsave(&ei->i_completed_io_lock, flags);
3859 list_add_tail(&io_end->list, &ei->i_completed_io_list); 3856 list_add_tail(&io_end->list, &ei->i_completed_io_list);
3860 spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); 3857 spin_unlock_irqrestore(&ei->i_completed_io_lock, flags);
3858
3859 /* queue the work to convert unwritten extents to written */
3860 queue_work(wq, &io_end->work);
3861 iocb->private = NULL; 3861 iocb->private = NULL;
3862} 3862}
3863 3863