[PATCH v3 2/2] pvcalls-front: wait for other operations to return when release passive sockets
Passive sockets can have ongoing operations on them, specifically, we have two wait_event_interruptable calls in pvcalls_front_accept. Add two wake_up calls in pvcalls_front_release, then wait for the potential waiters to return and release the sock_mapping refcount. Signed-off-by: Stefano StabelliniAcked-by: Juergen Gross --- drivers/xen/pvcalls-front.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c index 18d1bac..ca5b773 100644 --- a/drivers/xen/pvcalls-front.c +++ b/drivers/xen/pvcalls-front.c @@ -1018,6 +1018,12 @@ int pvcalls_front_release(struct socket *sock) pvcalls_front_free_map(bedata, map); } else { + wake_up(>inflight_req); + wake_up(>passive.inflight_accept_req); + + while (atomic_read(>refcount) > 1) + cpu_relax(); + spin_lock(>socket_lock); list_del(>list); spin_unlock(>socket_lock); -- 1.9.1
[PATCH v3 2/2] pvcalls-front: wait for other operations to return when release passive sockets
Passive sockets can have ongoing operations on them, specifically, we have two wait_event_interruptable calls in pvcalls_front_accept. Add two wake_up calls in pvcalls_front_release, then wait for the potential waiters to return and release the sock_mapping refcount. Signed-off-by: Stefano Stabellini Acked-by: Juergen Gross --- drivers/xen/pvcalls-front.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c index 18d1bac..ca5b773 100644 --- a/drivers/xen/pvcalls-front.c +++ b/drivers/xen/pvcalls-front.c @@ -1018,6 +1018,12 @@ int pvcalls_front_release(struct socket *sock) pvcalls_front_free_map(bedata, map); } else { + wake_up(>inflight_req); + wake_up(>passive.inflight_accept_req); + + while (atomic_read(>refcount) > 1) + cpu_relax(); + spin_lock(>socket_lock); list_del(>list); spin_unlock(>socket_lock); -- 1.9.1