summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergiu Ivanov <unlimitedscolobb@gmail.com>2009-02-20 18:43:57 +0200
committerSergiu Ivanov <unlimitedscolobb@gmail.com>2009-02-20 18:43:57 +0200
commit2fc7f8c49fc34cd2db65c36400200082a62138a1 (patch)
tree0ec2e55368532c8a12cfae9650cf211c63fc7e50
parent0a878aaf9fadb891a6067f8f084baa8ca5c30521 (diff)
Dynamic translator stacks are set in series of retries
When a client wants nsmux to set several translators on a node using a syntax like ``file,,x,,y'', nsmux sets the first translator on a shadow node mirroring ``file'' and punts a retry to the client. The client (commonly) does the retry and thus control comes back to nsmux, which creates another shadow node and sets the second translator on this node. At the moment translator stacks do not include proxy nodes, i.e. the structure of a dynamic translator stack is: ...---dynamic translator -- shadow node -- dynamic translator ---...
-rw-r--r--node.c13
-rw-r--r--node.h2
-rw-r--r--nsmux.c22
3 files changed, 30 insertions, 7 deletions
diff --git a/node.c b/node.c
index 5f24a5379..f7db74107 100644
--- a/node.c
+++ b/node.c
@@ -821,11 +821,22 @@ error_t
*underlying = p = ports_get_send_right (newpi);
*underlying_type = MACH_MSG_TYPE_COPY_SEND;
+ /**underlying_type = MACH_MSG_TYPE_COPY_SEND;*/
+ /**underlying_type = MACH_MSG_TYPE_MOVE_SEND;*/
+
LOG_MSG ("node_set_translators.open_port: %ld", (long) *underlying);
/*Drop our reference to the port */
ports_port_deref (newpi);
+ /*
+ char buf[256];
+ char *_buf = buf;
+ size_t len = 256;
+ io_read (p, &_buf, &len, 0, len);
+ LOG_MSG ("node_set_translator: Read from np: '%s'", buf);
+ */
+
/*Return the result of operations (everything should be okay here) */
return err;
} /*open_port */
@@ -905,6 +916,6 @@ error_t
/*Everything is OK here */
return 0;
-} /*node_set_translators */
+} /*node_set_translator */
/*---------------------------------------------------------------------------*/
diff --git a/node.h b/node.h
index 89de42118..9ae760f01 100644
--- a/node.h
+++ b/node.h
@@ -37,7 +37,7 @@
/*---------------------------------------------------------------------------*/
/*--------Macros-------------------------------------------------------------*/
/*Checks whether the give node is the root of the proxy filesystem*/
-#define NODE_IS_ROOT(n) (((n)->nn->lnode->dir) ? (0) : (1))
+#define NODE_IS_ROOT(n) (((n)->nn->lnode && (n)->nn->lnode->dir) ? (0) : (1))
/*---------------------------------------------------------------------------*/
/*Node flags*/
#define FLAG_NODE_ULFS_FIXED 0x00000001 /*this node should not be updated */
diff --git a/nsmux.c b/nsmux.c
index 312552858..0f713f14a 100644
--- a/nsmux.c
+++ b/nsmux.c
@@ -166,7 +166,8 @@ error_t
/*Validates the stat data for the node*/
error_t netfs_validate_stat (struct node * np, struct iouser * cred)
{
- LOG_MSG ("netfs_validate_stat: '%s'", (np ? np->nn->lnode->name : ""));
+ LOG_MSG ("netfs_validate_stat: '%s'",
+ ((np && np->nn->lnode) ? np->nn->lnode->name : ""));
error_t err = 0;
@@ -896,8 +897,21 @@ error_t
/*We have to create a shadow node and set a translator
on it. */
- error = netfs_attempt_lookup_improved
- (diruser->user, dnp, filename, flags, lastcomp, &np, &file, 1);
+ if (sep == filename + 2)
+ {
+ /*this is a retry, so no need to do lookups */
+ error = 0;
+ np = dnp;
+ netfs_nref (np);
+
+ mutex_unlock (&np->lock);
+ }
+ else
+ /*lookup the file in the real filesystem */
+ error = netfs_attempt_lookup_improved
+ (diruser->user, dnp, filename, flags,
+ lastcomp, &np, &file, 1);
+
if (!error && !excl)
{
/*if there is at least one more separator in the
@@ -921,8 +935,6 @@ error_t
free (trans);
/*prepare the information for the retry */
-
-/* *retry_port_type = MACH_MSG_TYPE_MOVE_SEND; */
strcpy (retry_name, nextsep);
if (nextname)
{