Sat Nov 3 15:43:20 2012 UTC ()
When lookup returns a node with null inode number, it means the ENOENT,
with negative caching. We do not implement negative caching yet, but
we honour the ENOENT.


(manu)
diff -r1.59 -r1.60 src/lib/libperfuse/ops.c

cvs diff -r1.59 -r1.60 src/lib/libperfuse/ops.c (expand / switch to unified diff)

--- src/lib/libperfuse/ops.c 2012/07/21 05:49:42 1.59
+++ src/lib/libperfuse/ops.c 2012/11/03 15:43:20 1.60
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ops.c,v 1.59 2012/07/21 05:49:42 manu Exp $ */ 1/* $NetBSD: ops.c,v 1.60 2012/11/03 15:43:20 manu Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved. 4 * Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
5 *  5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 *  14 *
@@ -423,26 +423,36 @@ node_lookup_common(struct puffs_usermoun @@ -423,26 +423,36 @@ node_lookup_common(struct puffs_usermoun
423 "looking up freed node opc = %p, name = \"%s\"", 423 "looking up freed node opc = %p, name = \"%s\"",
424 opc, path); 424 opc, path);
425#endif /* PERFUSE_DEBUG */ 425#endif /* PERFUSE_DEBUG */
426 426
427 len = strlen(path) + 1; 427 len = strlen(path) + 1;
428 pm = ps->ps_new_msg(pu, opc, FUSE_LOOKUP, len, pcr); 428 pm = ps->ps_new_msg(pu, opc, FUSE_LOOKUP, len, pcr);
429 (void)strlcpy(_GET_INPAYLOAD(ps, pm, char *), path, len); 429 (void)strlcpy(_GET_INPAYLOAD(ps, pm, char *), path, len);
430 430
431 if ((error = xchg_msg(pu, opc, pm, sizeof(*feo), wait_reply)) != 0) 431 if ((error = xchg_msg(pu, opc, pm, sizeof(*feo), wait_reply)) != 0)
432 return error; 432 return error;
433 433
434 feo = GET_OUTPAYLOAD(ps, pm, fuse_entry_out); 434 feo = GET_OUTPAYLOAD(ps, pm, fuse_entry_out);
435 435
 436 /*
 437 * Starting with ABI 7.4, inode number 0 means ENOENT,
 438 * with entry_valid / entry_valid_nsec giving negative
 439 * cache timeout (which we do not implement yet).
 440 */
 441 if (feo->attr.ino == 0) {
 442 ps->ps_destroy_msg(pm);
 443 return ENOENT;
 444 }
 445
436 /* 446 /*
437 * Check for a known node, not reclaimed, with another name. 447 * Check for a known node, not reclaimed, with another name.
438 * It may have been moved, or we can lookup ../ 448 * It may have been moved, or we can lookup ../
439 */ 449 */
440 if (((oldpnd = perfuse_node_bynodeid(ps, feo->nodeid)) != NULL) && 450 if (((oldpnd = perfuse_node_bynodeid(ps, feo->nodeid)) != NULL) &&
441 !(oldpnd->pnd_flags & PND_RECLAIMED)) { 451 !(oldpnd->pnd_flags & PND_RECLAIMED)) {
442 /* 452 /*
443 * Save the new node name if not .. 453 * Save the new node name if not ..
444 */ 454 */
445 if (strncmp(path, "..", len) != 0) 455 if (strncmp(path, "..", len) != 0)
446 (void)strlcpy(oldpnd->pnd_name,  456 (void)strlcpy(oldpnd->pnd_name,
447 path, MAXPATHLEN); 457 path, MAXPATHLEN);
448 pn = oldpnd->pnd_pn; 458 pn = oldpnd->pnd_pn;