[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <x49lj0uj4rk.fsf@segfault.boston.devel.redhat.com>
Date: Fri, 04 Mar 2011 10:15:43 -0500
From: Jeff Moyer <jmoyer@...hat.com>
To: Lukas Czerner <lczerner@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] block: fix mis-synchronisation in blkdev_issue_zeroout()
Lukas Czerner <lczerner@...hat.com> writes:
> On Fri, 4 Mar 2011, Jeff Moyer wrote:
>> It seems to me like it might be better to just not complete anything
>> until the count is zero. Why issue a wakeup for every bio?
>> fs/direct-io does something similar, maybe take a look at the
>> dio_bio_end* routines and see if that would fit well here. With your
>> scheme, I worry about missing a completion, maybe because the first bio
>> completes before you are done submitting bios. Is that possible?
>
> I do not think it is possible. For every bio submitted there is
> wait_for_completion called. When bio complete()s completion->done is
> incremented (under the wait->lock). In wait_for_completion() we are
> waiting for single submitted bio to complete (completion->done > 0),
> then completion->done is decremented. It seems like simple
> synchronization.
>
> I am not sure what wakeup you have in mind, but thanks for the tip I'll
> look in fs/direct-io.
Let's say you have several bios to submit, and the first bio is errored
immediately in submit_bio. Since you didn't add yourself to the
waitqueue yet, you might miss the wakeup and sleep forever.
Cheers,
Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists