This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] Why xs_domain_open() in fs_backend

On Wed, 2010-10-13 at 14:18 +0100, Ian Campbell wrote:
> On Wed, 2010-10-13 at 13:57 +0100, Ian Campbell wrote:
> > 
> > I don't know how useful it is generally but it can be used to shows
> > that "xenstore-watch -s x" (i.e. xs_daemon_open) does appear to be
> > broken. 
> Actually this is backwards and I seem to be seeing the exact opposite to
> you. IOW for me:
> "xenstore-watch x"    -> xs_domain_open()     -- works
> "xenstore-watch -s x" -> xs_daemon_open()     -- does not work, XS_ERROR 
> reply from daemon
> Can you confirm which version fails for you?
> It also seems to be specific to the C xenstored, the ocaml oxenstored
> works fine.
> Lastly it seems to be a problem with relative paths only, absolute paths
> seem to be ok.

This appears to be deliberate. xenstore clients connecting via the
socket interface have no implicit /local/domain/<domid> home directory.
(see xenstored_core.c:canonicalize and its use from
xenstored_watch.c:do_watch) and therefore must use absolute paths. The
ocaml xenstored works around this by assuming that socket connections
originate in domain 0, which is a little dubious if oxenstored is
running in a stub domain but in that case there is no userspace and
hence no clients using the socket interface, so it is fine.

The only problem I see is that it uses whatever random errno happens to
be current in the error message.


# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1286977342 -3600
# Node ID 78f2c9b4d902fa04f7055012c63d6dd24e823da0
# Parent  9a5a576bcc8ae17f19c9f89b73a026a0acfb5cf1
xenstored: return EINVAL for attempt to watch invalid path

errno is essentially random at this point.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 9a5a576bcc8a -r 78f2c9b4d902 tools/xenstore/xenstored_watch.c
--- a/tools/xenstore/xenstored_watch.c  Wed Oct 13 13:56:12 2010 +0100
+++ b/tools/xenstore/xenstored_watch.c  Wed Oct 13 14:42:22 2010 +0100
@@ -134,7 +134,7 @@ void do_watch(struct connection *conn, s
                relative = !strstarts(vec[0], "/");
                vec[0] = canonicalize(conn, vec[0]);
                if (!is_valid_nodename(vec[0])) {
-                       send_error(conn, errno);
+                       send_error(conn, EINVAL);

Xen-devel mailing list