Module Name:    src
Committed By:   snj
Date:           Mon Jun  8 20:49:54 UTC 2015

Modified Files:
        src/lib/libperfuse [netbsd-7]: ops.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #828):
        lib/libperfuse/ops.c: revision 1.84
Fix dot-lookup when readdir does not provide inodes
Some filesystems do not provide inode numbers through readdir (FUSE
mounts without -o use_ino). We therefore have to lookup each directory
entry to get the missing numbers.
dot and double-dot are exceptions, as we already know the values.
Moreover, the lookup code does not expect to get requests for dot and
will abort perfused(8) when it gets some. In order to fix that, we just
check for dot and double-dot special case and use the known values
instead of sending a lookup.


To generate a diff of this commit:
cvs rdiff -u -r1.66.2.15 -r1.66.2.16 src/lib/libperfuse/ops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.66.2.15 src/lib/libperfuse/ops.c:1.66.2.16
--- src/lib/libperfuse/ops.c:1.66.2.15	Fri Feb 27 19:39:56 2015
+++ src/lib/libperfuse/ops.c	Mon Jun  8 20:49:54 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.66.2.15 2015/02/27 19:39:56 martin Exp $ */
+/*  $NetBSD: ops.c,v 1.66.2.16 2015/06/08 20:49:54 snj Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -651,13 +651,17 @@ fuse_to_dirent(struct puffs_usermount *p
 			struct puffs_node *pn;
 			struct perfuse_node_data *pnd = PERFUSE_NODE_DATA(opc);
 
-			/* 
-			 * Avoid breaking out of fs 
-			 * by lookup to .. on root
-			 */
-			if ((strcmp(name, "..") == 0) && 
-			    (pnd->pnd_nodeid == FUSE_ROOT_ID)) {
-				fd->ino = FUSE_ROOT_ID;
+			if (strcmp(name, "..") == 0) {
+				/* 
+				 * Avoid breaking out of fs 
+				 * by lookup to .. on root
+				 */
+				if (pnd->pnd_nodeid == FUSE_ROOT_ID)
+					fd->ino = FUSE_ROOT_ID;
+				else
+					fd->ino = pnd->pnd_parent_nodeid;
+			} else if (strcmp(name, ".") == 0 ) {
+				fd->ino = pnd->pnd_nodeid;
 			} else {
 				int error;
 

Reply via email to