From 3d778ca1f6df761ad309656749ed5332718aaced Mon Sep 17 00:00:00 2001 From: tol Date: Wed, 3 Jan 2007 13:16:06 +0000 Subject: [PATCH] (nnpfs_new_node): try not to mess up attrs if node already is in cache --- nnpfs/bsd/nnpfs_node-bsd.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/nnpfs/bsd/nnpfs_node-bsd.c b/nnpfs/bsd/nnpfs_node-bsd.c index 8bcfc7de3..edb77b77d 100644 --- a/nnpfs/bsd/nnpfs_node-bsd.c +++ b/nnpfs/bsd/nnpfs_node-bsd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995 - 2006 Kungliga Tekniska Högskolan + * Copyright (c) 1995 - 2007 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -217,6 +217,13 @@ retry: result = VNODE_TO_XNODE(v); result->anonrights = node->anonrights; + nnpfs_store_attr(&node->attr, result, 1); + +#ifndef __APPLE__ + result->vn->v_type = result->attr.va_type; + if (isrootp) + NNPFS_MAKE_VROOT(result->vn); +#endif } else if (error == EISDIR) { /* node is about to be deleted */ NNPFSDEB(XDEBNODE, ("nnpfs_new_node: node deleted\n")); @@ -225,35 +232,23 @@ retry: /* Node is already cached */ if (nnpfs_do_vget(XNODE_TO_VNODE(result), 0, p)) goto retry; - } - /* Init other fields */ - nnpfs_store_attr(&node->attr, result, 1); -#ifndef __APPLE__ - result->vn->v_type = result->attr.va_type; -#endif + if (result->flags & NNPFS_DATA_DIRTY) + XA_CLEAR_SIZE(&node->attr); + nnpfs_store_attr(&node->attr, result, 0); + } - result->tokens = node->tokens; + result->tokens |= node->tokens; /* XXX correct? */ if ((result->tokens & NNPFS_DATA_MASK) && result->index == NNPFS_NO_INDEX) { printf("nnpfs_new_node: tokens and no data (%d,%d,%d,%d) \n", node->handle.a, node->handle.b, node->handle.c, node->handle.d); result->tokens &= ~NNPFS_DATA_MASK; } + /* XXX scary -- could this remove creator's privileges for existing node? */ bcopy(node->id, result->id, sizeof(result->id)); bcopy(node->rights, result->rights, sizeof(result->rights)); -#if defined(__APPLE__) && 0 - if (nnpfs_vnode_isreg(result->vn) && (!UBCINFOEXISTS(result->vn))) - ubc_info_init(result->vn); -#endif - -#ifndef __APPLE__ - if (isrootp) { - NNPFS_MAKE_VROOT(result->vn); - } -#endif - *xpp = result; NNPFSDEB(XDEBNODE, ("return: nnpfs_new_node\n")); return 0; -- 2.11.4.GIT