Problem with FUSE + fts
Hiroshi Nishida
nishida at asusa.net
Thu Mar 24 18:23:08 UTC 2016
Hi,
I found a weird error with FUSE + fts_read().
Every time a command like find, rm -r that calls fts_read() is used for a FUSE mounted filesystem, it outputs "XXX: No such file or directory" errors for some (not all) files/directories.
In /usr/src/lib/libc/gen/fts.c, there is fts_safe_changedir(FTS *, FTSENT *, int, char *) and the error seems to occur there in the following way:
FTS *sp;
FTSENT *p = sp->fts_cur; // Current node
DIR *dirp = opendir2(p->fts_accpath, oflag); // Open dir
int fd = _dirfd(dirp); // File descriptor of dirp
struct stat sb; _fstat(fd, &sb); // fstat current node through fd
p->fts_ino != sb.st_ino // This happens for some reason...... and sets errno = ENOENT
When the error happens, p->fts_ino always has a small number and sb.st_ino has a great number like:
p->fts_ino = 13, sb.st_ino = 54136
So, a new inode number seems to be allocated to sb.st_ino though the node already has an inode number.
I would appreciate hearing any feedback on this, though I already posted fuse-devel ML and haven't received any helpful responses yet.
The problem seems to be particular to FreeBSD because I don't get any errors with Ubuntu.
The sample FUSE program is located at
https://github.com/scopedog/FUSE-Test
and fts.c is also located under freebsd and ubuntu dirs (interestingly, fts.c of FreeBSD and Ubuntu are almost identical).
Thank you.
--
Hiroshi Nishida
nishida at asusa.net
More information about the freebsd-fs
mailing list