Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1670968 > unrolled thread
| Started by | Boris Ostrovsky <boris.ostrovsky@oracle.com> |
|---|---|
| First post | 2017-06-20 19:20 +0200 |
| Last post | 2017-06-21 23:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v4 13/18] xen/pvcalls: implement release command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-06-20 19:20 +0200
Re: [PATCH v4 13/18] xen/pvcalls: implement release command Stefano Stabellini <sstabellini@kernel.org> - 2017-06-21 23:40 +0200
| From | Boris Ostrovsky <boris.ostrovsky@oracle.com> |
|---|---|
| Date | 2017-06-20 19:20 +0200 |
| Subject | Re: [PATCH v4 13/18] xen/pvcalls: implement release command |
| Message-ID | <tUuYO-32j-13@gated-at.bofh.it> |
> +
> +static int pvcalls_back_release_passive(struct xenbus_device *dev,
> + struct pvcalls_fedata *fedata,
> + struct sockpass_mapping *mappass)
> +{
> + if (mappass->sock->sk != NULL) {
> + write_lock_bh(&mappass->sock->sk->sk_callback_lock);
> + mappass->sock->sk->sk_user_data = NULL;
> + mappass->sock->sk->sk_data_ready = mappass->saved_data_ready;
> + write_unlock_bh(&mappass->sock->sk->sk_callback_lock);
> + }
> + down(&fedata->socket_lock);
> + radix_tree_delete(&fedata->socketpass_mappings, mappass->id);
> + sock_release(mappass->sock);
> + flush_workqueue(mappass->wq);
> + destroy_workqueue(mappass->wq);
> + kfree(mappass);
> + up(&fedata->socket_lock);
Can you raise the semaphore earlier, once the mapping is deleted from
the tree?
Also, why are you not locking the tree in pvcalls_back_accept()?
-boris
[toc] | [next] | [standalone]
| From | Stefano Stabellini <sstabellini@kernel.org> |
|---|---|
| Date | 2017-06-21 23:40 +0200 |
| Message-ID | <tUVvY-3sm-43@gated-at.bofh.it> |
| In reply to | #1670968 |
On Tue, 20 Jun 2017, Boris Ostrovsky wrote:
> > +
> > +static int pvcalls_back_release_passive(struct xenbus_device *dev,
> > + struct pvcalls_fedata *fedata,
> > + struct sockpass_mapping *mappass)
> > +{
> > + if (mappass->sock->sk != NULL) {
> > + write_lock_bh(&mappass->sock->sk->sk_callback_lock);
> > + mappass->sock->sk->sk_user_data = NULL;
> > + mappass->sock->sk->sk_data_ready = mappass->saved_data_ready;
> > + write_unlock_bh(&mappass->sock->sk->sk_callback_lock);
> > + }
> > + down(&fedata->socket_lock);
> > + radix_tree_delete(&fedata->socketpass_mappings, mappass->id);
> > + sock_release(mappass->sock);
> > + flush_workqueue(mappass->wq);
> > + destroy_workqueue(mappass->wq);
> > + kfree(mappass);
> > + up(&fedata->socket_lock);
>
> Can you raise the semaphore earlier, once the mapping is deleted from
> the tree?
Yes, I think it can.
> Also, why are you not locking the tree in pvcalls_back_accept()?
Good point! Although socket_lock is used to protect insertions and
deletions to socketpass_mappings and socket_mappings, many of the sites
that only access socket_mappings and socketpass_mappings without making
modifications are left unprotected at the moment. I'll fix that, and to
do it I'll move radix_tree_delete out of pvcalls_back_release_passive.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web