[SCSI] async: make async_synchronize_full() flush all work regardless of domain

In response to an async related regression James noted:

  "My theory is that this is an init problem: The assumption in a lot of
   our code is that async_synchronize_full() waits for everything ... even
   the domain specific async schedules, which isn't true."

...so make this assumption true.

Each domain, including the default one, registers itself on a global domain
list when work is scheduled.  Once all entries complete it exits that
list.  Waiting for the list to be empty syncs all in-flight work across
all domains.

Domains can opt-out of global syncing if they are declared as exclusive
ASYNC_DOMAIN_EXCLUSIVE().  All stack-based domains have been declared
exclusive since the domain may go out of scope as soon as the last work
item completes.

Statically declared domains are mostly ok, but async_unregister_domain()
is there to close any theoretical races with pending
async_synchronize_full waiters at module removal time.

Signed-off-by: Dan Williams <[email protected]>
Acked-by: Arjan van de Ven <[email protected]>
Reported-by: Meelis Roos <[email protected]>
Reported-by: Eldad Zack <[email protected]>
Tested-by: Eldad Zack <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
This commit is contained in:
Dan Williams 2012-07-09 19:33:30 -07:00 • committed by James Bottomley
commit a4683487f9
3 changed files with 43 additions and 2 deletions

View file

@ -1355,6 +1355,7 @@ static void __exit exit_scsi(void)
scsi_exit_devinfo();
scsi_exit_procfs();
scsi_exit_queue();
async_unregister_domain(&scsi_sd_probe_domain);
}
subsys_initcall(init_scsi);