From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: Why xs_domain_open() in fs_backend Date: Wed, 13 Oct 2010 14:47:36 +0100 Message-ID: <1286977656.2003.3346.camel@zakaz.uk.xensource.com> References: <789F9655DD1B8F43B48D77C5D30659732F9D7EBD@shsmsx501.ccr.corp.intel.com> <1286974627.2003.3294.camel@zakaz.uk.xensource.com> <1286975935.2003.3310.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1286975935.2003.3310.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Jiang, Yunhong" Cc: "xen-devel@lists.xensource.com" , "gm281@cam.ac.uk" List-Id: xen-devel@lists.xenproject.org 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/ 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. Ian. # HG changeset patch # User Ian Campbell # 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 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); return; } }