summaryrefslogtreecommitdiffstats
path: root/include/xen/xenbus.h
diff options
context:
space:
mode:
authorSeongJae Park <sjpark@amazon.de>2020-01-27 09:18:09 +0100
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>2020-01-29 14:35:49 +0100
commit060eabe8fbe726aca341b518366da4d79e338100 (patch)
treede0003cb6dc543be114115605aae0f3e518803ac /include/xen/xenbus.h
parentxenbus/backend: Add memory pressure handler callback (diff)
downloadlinux-060eabe8fbe726aca341b518366da4d79e338100.tar.xz
linux-060eabe8fbe726aca341b518366da4d79e338100.zip
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/xenbus.h')
-rw-r--r--include/xen/xenbus.h1
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)