On Tue, Jun 23, 2015 at 04:37:48PM +0800, Liu Bo wrote: ... > > | - clear BLK_STATE_IO | - clear BLK_STATE_IO | | > > | - page_read_complete | - page_read_complete | | > > | - returns true | - returns true | | > > | - unlock_page() | | | > > | | | lock_page() | > > | | - unlock_page() | | > > |-------------------------+-------------------------+-------------| > > > > So we end up incorrectly unlocking the page twice and "Task C" ends up working > > on an unlocked page. So private->io_lock makes sure that only one of the tasks > > gets "true" as the return value when page_read_complete() is invoked. As an > > optimization the patch gets the io_lock only when nr_sectors counter reaches > > the value 0 (i.e. when the last block of the bio_vec is being processed). > > Please let me know if my analysis was incorrect. > > Thanks for the nice explanation, it looks reasonable to me. Please don't hesitate to add your reviewed-by if you spent time on that and think it's ok, this rellay helps to make decisions about merging. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
