[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH V4] libxenstore: filter watch events in libxenstore when we unwatch



Julien Grall writes ("[PATCH V4] libxenstore: filter watch events in 
libxenstore when we unwatch"):
> XenStore puts in queued watch events via a thread and notifies the user.
> Sometimes xs_unwatch is called before all related message is read. The use
> case is non-threaded libevent, we have two event A and B:
>     - Event A will destroy something and call xs_unwatch;
>     - Event B is used to notify that a node has changed in XenStore.
> As the event is called one by one, event A can be handled before event B.
> So on next xs_watch_read the user could retrieve an unwatch token and
> a segfault occured if the token store the pointer of the structure
> (ie: "backend:0xcafe").
> 
> To avoid problem with previous application using libXenStore, this behaviour
> will only be enabled if XS_UNWATCH_FILTER is given to xs_open.
...
> -     return xs_bool(xs_talkv(h, XBT_NULL, XS_UNWATCH, iov,
> -                             ARRAY_SIZE(iov), NULL));
> +     res = xs_bool(xs_talkv(h, XBT_NULL, XS_UNWATCH, iov,
> +                                                ARRAY_SIZE(iov), NULL));

Thanks!

I think the only things left are some formatting glitches.  Here, you
change the indentation but the new indentation doesn't match.

> +     if (!h->unwatch_filter) /* Don't filter the watch list */
> +             return res;
...
> +     if (list_empty(&h->watch_list)) {
> +         mutex_unlock(&h->watch_mutex);
> +         return res;

And here's a 4-character indent.  xs.c seems to use hard tabs so we
should continue that convention.

> +             if (l_token && !strcmp(token, l_token)
> +                     && l_path && xs_path_is_subpath(path, l_path)) {

Style in xs seems to have the && on the previous line and to align the
next line with the inside of the opening paren.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.