xenstore: fix suspension when using the xenstore device
Lock the xenstore request mutex when suspending user-space processes, in order to prevent any process from holding this lock when going into suspension, or else the xenstore suspend process is going to deadlock. Submitted by: Liuyingdong <liuyingdong@huawei.com> Reviewed by: royger MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D9638
This commit is contained in:
parent
8dee0e9bd6
commit
41716b8d51
@ -199,7 +199,9 @@ xctrl_suspend()
|
||||
#endif
|
||||
|
||||
EVENTHANDLER_INVOKE(power_suspend_early);
|
||||
xs_lock();
|
||||
stop_all_proc();
|
||||
xs_unlock();
|
||||
EVENTHANDLER_INVOKE(power_suspend);
|
||||
|
||||
#ifdef EARLY_AP_STARTUP
|
||||
|
@ -1699,3 +1699,20 @@ xs_unregister_watch(struct xs_watch *watch)
|
||||
sx_xunlock(&xs.xenwatch_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xs_lock(void)
|
||||
{
|
||||
|
||||
sx_xlock(&xs.request_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
xs_unlock(void)
|
||||
{
|
||||
|
||||
sx_xunlock(&xs.request_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -338,4 +338,15 @@ void xs_unregister_watch(struct xs_watch *watch);
|
||||
*/
|
||||
struct sbuf *xs_join(const char *, const char *);
|
||||
|
||||
/**
|
||||
* Lock the xenstore request mutex.
|
||||
*/
|
||||
void xs_lock(void);
|
||||
|
||||
/**
|
||||
* Unlock the xenstore request mutex.
|
||||
*/
|
||||
void xs_unlock(void);
|
||||
|
||||
#endif /* _XEN_XENSTORE_XENSTOREVAR_H */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user