Re: [PATCH] bcache: fix race in setting bdev state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tang Junhui <tang.junhui@xxxxxxxxxx>

Hello Mike:

> One race I think I see: we unset the dirty bit before setting ourselves 
> interruptible.  Can bch_writeback_add/queue wake writeback before then 
> (and then writeback sets itself interruptible and never wakes up)?
> bch_writeback_add usually holds the writeback lock, but the writeback 
> lock is already released at this time (and bch_writeback_queue as used 
> by bch_cached_dev_detach doesn't traverse the writeback lock).
Yes, It's true. but it's hard to resolve it by holding writeback lock, 
since not all codes in bch_writeback_thread() are held in writeback lock, 
actually in a previous patch I have resolved it by changing schedule() to 
schedule_timeout(WRITE_BACK_WAIT_CYCLE) to avoid permanent sleep.


> There's a pretty intricate set of dependencies between the dirty bit, 
> the state in the superblock, the refcount, the writeback lock, and the 
> runnable state of the writeback thread.  It feels dangerous, but maybe 
> after I draw graphs of all the dependencies I'll feel better.

> Writeback locking needs refactoring for performance anyways-- maybe this 
> can simplified at the same time.
Yes, we'd better make clear the process, and find the issues and point to 
do refactor, but I think it is a long run, we need to do it step by step.

Regards,
Tang
--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux