mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: Race in wb_do_writeback() ???
  2010-06-29 20:28 Race in wb_do_writeback() ??? Larry Woodman
@ 2010-06-29 20:26 ` Christoph Hellwig
  2010-06-30 19:15   ` Brian Bloniarz
  2010-07-02 14:05   ` Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Hellwig @ 2010-06-29 20:26 UTC (permalink / raw)
  To: Larry Woodman; +Cc: hch, linux-kernel, riel

On Tue, Jun 29, 2010 at 04:28:16PM -0400, Larry Woodman wrote:
> Can you have one unconditional call to wb_clear_pending() after the
> calling wb_writeback()???

In fact we should only have a conditional call after wb_writeback.
I've done that already and it's in Jens' tree for 2.6.36:

	http://git.kernel.dk/?p=linux-2.6-block.git;a=commitdiff;h=79338d2a78ab78efdc1698f1309766a039addf9d


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Race in wb_do_writeback() ???
@ 2010-06-29 20:28 Larry Woodman
  2010-06-29 20:26 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Larry Woodman @ 2010-06-29 20:28 UTC (permalink / raw)
  To: hch, linux-kernel, riel

Chistoph, I am seeing slabcache corruption.  wb_do_writeback() calls
wb_clear_pending() which can queue up the freeing of the bdi_work. Then
it calls wb_writeback() which can block, resulting in using the bdi_work
after its freed.

------------------------------------------------------------------
  /*
   * If this isn't a data integrity operation, just notify
   * that we have seen this work and we are now starting it.
   */
  if (!test_bit(WS_ONSTACK, &work->state))
         wb_clear_pending(wb, work);

  wrote += wb_writeback(wb, &args);

 /*
  * This is a data integrity writeback, so only do the
  * notification when we have completed the work.
  */
  if (test_bit(WS_ONSTACK, &work->state))
         wb_clear_pending(wb, work);
------------------------------------------------------------------

Can you have one unconditional call to wb_clear_pending() after the
calling wb_writeback()???

Larry



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Race in wb_do_writeback() ???
  2010-06-29 20:26 ` Christoph Hellwig
@ 2010-06-30 19:15   ` Brian Bloniarz
  2010-07-02 14:05   ` Christoph Hellwig
  1 sibling, 0 replies; 4+ messages in thread
From: Brian Bloniarz @ 2010-06-30 19:15 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Larry Woodman, linux-kernel, riel, Mark Lord, stefan.bader, kees

On 06/29/2010 04:26 PM, Christoph Hellwig wrote:
> On Tue, Jun 29, 2010 at 04:28:16PM -0400, Larry Woodman wrote:
>> Chistoph, I am seeing slabcache corruption.  wb_do_writeback() calls
>> wb_clear_pending() which can queue up the freeing of the bdi_work. Then
>> it calls wb_writeback() which can block, resulting in using the bdi_work
>> after its freed.
>> 
>> ------------------------------------------------------------------
>>   /*
>>    * If this isn't a data integrity operation, just notify
>>    * that we have seen this work and we are now starting it.
>>    */
>>   if (!test_bit(WS_ONSTACK, &work->state))
>>          wb_clear_pending(wb, work);
>> 
>>   wrote += wb_writeback(wb, &args);
>> 
>>  /*
>>   * This is a data integrity writeback, so only do the
>>   * notification when we have completed the work.
>>   */
>>   if (test_bit(WS_ONSTACK, &work->state))
>>          wb_clear_pending(wb, work);
>> ------------------------------------------------------------------
>> 
>> Can you have one unconditional call to wb_clear_pending() after the
>> calling wb_writeback()???
> 
> In fact we should only have a conditional call after wb_writeback.
> I've done that already and it's in Jens' tree for 2.6.36:
> 
>   http://git.kernel.dk/?p=linux-2.6-block.git;a=commitdiff;h=79338d2a78ab78efdc1698f1309766a039addf9d

Hi Christoph, 

Is this a problem that was introduced by your writeback patch
series which just got merged for 2.6.35?
Are you going to try to get a fix for this into 2.6.35?

(CCing some people who were interested in your writeback series).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Race in wb_do_writeback() ???
  2010-06-29 20:26 ` Christoph Hellwig
  2010-06-30 19:15   ` Brian Bloniarz
@ 2010-07-02 14:05   ` Christoph Hellwig
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2010-07-02 14:05 UTC (permalink / raw)
  To: Larry Woodman; +Cc: hch, linux-kernel, riel, axboe

Jens, I think we need to pull this patch into 2.6.35 still.  While
we could fix the various races with the kfree and wakeup vs ->state
manipulation in a slightly smaller way at least this patch has gotten
lots of testing in linux-next and targeted stress testing.

On Tue, Jun 29, 2010 at 04:26:50PM -0400, Christoph Hellwig wrote:
> On Tue, Jun 29, 2010 at 04:28:16PM -0400, Larry Woodman wrote:
> > Can you have one unconditional call to wb_clear_pending() after the
> > calling wb_writeback()???
> 
> In fact we should only have a conditional call after wb_writeback.
> I've done that already and it's in Jens' tree for 2.6.36:
> 
> 	http://git.kernel.dk/?p=linux-2.6-block.git;a=commitdiff;h=79338d2a78ab78efdc1698f1309766a039addf9d
> 
---end quoted text---

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-02 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-29 20:28 Race in wb_do_writeback() ??? Larry Woodman
2010-06-29 20:26 ` Christoph Hellwig
2010-06-30 19:15   ` Brian Bloniarz
2010-07-02 14:05   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome