* [PATCH] ext4: queue conversion after adding to inode's completed IO list
@ 2010-08-06 19:52 Eric Sandeen
2010-08-06 20:45 ` Jiaying Zhang
2010-10-07 17:23 ` Eric Sandeen
0 siblings, 2 replies; 4+ messages in thread
From: Eric Sandeen @ 2010-08-06 19:52 UTC (permalink / raw)
To: ext4 development; +Cc: Jiaying Zhang
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>
---
(At least I think this is right; I haven't actually demonstrated a race...)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 0afc8c1..7f56c48 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3804,14 +3804,14 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
io_end->flag = EXT4_IO_UNWRITTEN;
wq = EXT4_SB(io_end->inode->i_sb)->dio_unwritten_wq;
- /* queue the work to convert unwritten extents to written */
- queue_work(wq, &io_end->work);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: queue conversion after adding to inode's completed IO list
2010-08-06 19:52 [PATCH] ext4: queue conversion after adding to inode's completed IO list Eric Sandeen
@ 2010-08-06 20:45 ` Jiaying Zhang
2010-10-07 17:23 ` Eric Sandeen
1 sibling, 0 replies; 4+ messages in thread
From: Jiaying Zhang @ 2010-08-06 20:45 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development
Lgtm. Thanks for the fixing patch.
Jiaying
On Fri, Aug 6, 2010 at 12:52 PM, Eric Sandeen <sandeen@redhat.com> wrote:
>
> 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>
> ---
>
> (At least I think this is right; I haven't actually demonstrated a race...)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 0afc8c1..7f56c48 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3804,14 +3804,14 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
> io_end->flag = EXT4_IO_UNWRITTEN;
> wq = EXT4_SB(io_end->inode->i_sb)->dio_unwritten_wq;
>
> - /* queue the work to convert unwritten extents to written */
> - queue_work(wq, &io_end->work);
> -
> /* Add the io_end to per-inode completed aio dio list*/
> ei = EXT4_I(io_end->inode);
> spin_lock_irqsave(&ei->i_completed_io_lock, flags);
> list_add_tail(&io_end->list, &ei->i_completed_io_list);
> spin_unlock_irqrestore(&ei->i_completed_io_lock, flags);
> +
> + /* queue the work to convert unwritten extents to written */
> + queue_work(wq, &io_end->work);
> iocb->private = NULL;
> out:
> if (is_async)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: queue conversion after adding to inode's completed IO list
2010-08-06 19:52 [PATCH] ext4: queue conversion after adding to inode's completed IO list Eric Sandeen
2010-08-06 20:45 ` Jiaying Zhang
@ 2010-10-07 17:23 ` Eric Sandeen
2010-10-09 23:14 ` Ted Ts'o
1 sibling, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2010-10-07 17:23 UTC (permalink / raw)
To: ext4 development; +Cc: Jiaying Zhang
On 08/06/2010 02:52 PM, Eric Sandeen wrote:
> 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.
Ping? would be good to fix this race, this has jiaying's ack too.
> Thanks to Dave Chinner for pointing out the race.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> (At least I think this is right; I haven't actually demonstrated a race...)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 0afc8c1..7f56c48 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3804,14 +3804,14 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
> io_end->flag = EXT4_IO_UNWRITTEN;
> wq = EXT4_SB(io_end->inode->i_sb)->dio_unwritten_wq;
>
> - /* queue the work to convert unwritten extents to written */
> - queue_work(wq, &io_end->work);
> -
> /* Add the io_end to per-inode completed aio dio list*/
> ei = EXT4_I(io_end->inode);
> spin_lock_irqsave(&ei->i_completed_io_lock, flags);
> list_add_tail(&io_end->list, &ei->i_completed_io_list);
> spin_unlock_irqrestore(&ei->i_completed_io_lock, flags);
> +
> + /* queue the work to convert unwritten extents to written */
> + queue_work(wq, &io_end->work);
> iocb->private = NULL;
> out:
> if (is_async)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: queue conversion after adding to inode's completed IO list
2010-10-07 17:23 ` Eric Sandeen
@ 2010-10-09 23:14 ` Ted Ts'o
0 siblings, 0 replies; 4+ messages in thread
From: Ted Ts'o @ 2010-10-09 23:14 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development, Jiaying Zhang
On Thu, Oct 07, 2010 at 12:23:56PM -0500, Eric Sandeen wrote:
> On 08/06/2010 02:52 PM, Eric Sandeen wrote:
> > 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.
>
> Ping? would be good to fix this race, this has jiaying's ack too.
Added to the ext4 patch queue, thanks for the ping.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-09 23:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06 19:52 [PATCH] ext4: queue conversion after adding to inode's completed IO list Eric Sandeen
2010-08-06 20:45 ` Jiaying Zhang
2010-10-07 17:23 ` Eric Sandeen
2010-10-09 23:14 ` Ted Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).