staging: lustre: obdclass: use workqueue for zombie management.
authorNeilBrown <neilb@suse.com>
Thu, 1 Mar 2018 23:31:25 +0000 (10:31 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Mar 2018 12:20:22 +0000 (04:20 -0800)
commit1a6cc3b1a903b6a133467dccb05ad938c852680c
tree258768939823daa7c077e91e02a376e587444ff6
parentf8b1c4a8d83cbb80222e4b51cc55f37b5a9087de
staging: lustre: obdclass: use workqueue for zombie management.

obdclass currently maintains two lists of data structures
(imports and exports), and a kthread which will free
anything on either list.  The thread is woken whenever
anything is added to either list.

This is exactly the sort of thing that workqueues exist for.

So discard the zombie kthread and the lists and locks, and
create a single workqueue.  Each obd_import and obd_export
gets a work_struct to attach to this workqueue.

This requires a small change to import_sec_validate_get()
which was testing if an obd_import was on the zombie
list.  This cannot have every safely found it to be
on the list (as it could be freed asynchronously)
so it must be dead code.

We could use system_wq instead of creating a dedicated
zombie_wq, but as we occasionally want to flush all pending
work, it is a little nicer to only have to wait for our own
work items.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/lustre_export.h
drivers/staging/lustre/lustre/include/lustre_import.h
drivers/staging/lustre/lustre/obdclass/genops.c
drivers/staging/lustre/lustre/ptlrpc/sec.c