diff options
author | SeongJae Park <sjpark@amazon.de> | 2020-01-27 11:18:09 +0300 |
---|---|---|
committer | Boris Ostrovsky <boris.ostrovsky@oracle.com> | 2020-01-29 16:35:49 +0300 |
commit | 060eabe8fbe726aca341b518366da4d79e338100 (patch) | |
tree | de0003cb6dc543be114115605aae0f3e518803ac /include/xen | |
parent | 8a105678fb3ec4763352db84745968bf2cb4aa65 (diff) | |
download | linux-060eabe8fbe726aca341b518366da4d79e338100.tar.xz |
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>
Diffstat (limited to 'include/xen')
-rw-r--r-- | include/xen/xenbus.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index 980952ea452b..89a889585ba0 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h @@ -76,6 +76,7 @@ struct xenbus_device { enum xenbus_state state; struct completion down; struct work_struct work; + spinlock_t reclaim_lock; }; static inline struct xenbus_device *to_xenbus_device(struct device *dev) |