xenbus/backend: Protect xenbus callback with lock
authorSeongJae Park <sjpark@amazon.de>
Mon, 27 Jan 2020 08:18:09 +0000 (09:18 +0100)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Wed, 29 Jan 2020 13:35:49 +0000 (07:35 -0600)
commit060eabe8fbe726aca341b518366da4d79e338100
treede0003cb6dc543be114115605aae0f3e518803ac
parent8a105678fb3ec4763352db84745968bf2cb4aa65
xenbus/backend: Protect xenbus callback with lock

A driver's 'reclaim_memory' callback can race with 'probe' or 'remove'
because it will be called whenever memory pressure is detected.  To
avoid such race, this commit embeds a spinlock in each 'xenbus_device'
and make 'xenbus' to hold the lock while the corresponded callbacks are
running.

Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: SeongJae Park <sjpark@amazon.de>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/xen/xenbus/xenbus_probe.c
drivers/xen/xenbus/xenbus_probe_backend.c
include/xen/xenbus.h