Lines Matching refs:inode

103 // the drawback that we can no longer re-use inode numbers, and thus
105 // right inode number).
134 Inode(Inode&& inode) = delete;
135 Inode& operator=(Inode&& inode) = delete;
175 Inode* inode = reinterpret_cast<Inode*>(ino);
176 if(inode->fd == -1) {
177 cerr << "INTERNAL ERROR: Unknown inode " << ino << endl;
180 return *inode;
219 Inode& inode = get_inode(ino);
221 auto res = fstatat(inode.fd, "", &attr,
233 Inode& inode = get_inode(ino);
234 int ifd = inode.fd;
340 cerr << "ERROR: Source directory tree must not include inode "
354 Inode& inode {*inode_p};
355 e->generation = inode.generation;
357 if (inode.fd == -ENOENT) { // found unlinked inode
359 cerr << "DEBUG: lookup(): inode " << e->attr.st_ino
360 << " recycled; generation=" << inode.generation << endl;
361 /* fallthrough to new inode but keep existing inode.nlookup */
364 if (inode.fd > 0) { // found existing inode
367 cerr << "DEBUG: lookup(): inode " << e->attr.st_ino
368 << " (userspace) already known; fd = " << inode.fd << endl;
369 lock_guard<mutex> g {inode.m};
371 inode.nlookup++;
374 << "inode " << inode.src_ino
375 << " count " << inode.nlookup << endl;
379 } else { // no existing inode
381 lock ordering requirement (inode.m must be acquired before
383 point no other thread has access to the inode mutex */
384 lock_guard<mutex> g {inode.m};
385 inode.src_ino = e->attr.st_ino;
386 inode.src_dev = e->attr.st_dev;
388 inode.nlookup++;
391 << "inode " << inode.src_ino
392 << " count " << inode.nlookup << endl;
394 inode.fd = newfd;
398 cerr << "DEBUG: lookup(): created userspace inode " << e->attr.st_ino
399 << "; fd = " << inode.fd << endl;
476 Inode& inode = get_inode(ino);
484 sprintf(procname, "/proc/self/fd/%i", inode.fd);
491 res = fstatat(inode.fd, "", &e.attr, AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW);
496 e.ino = reinterpret_cast<fuse_ino_t>(&inode);
498 lock_guard<mutex> g {inode.m};
499 inode.nlookup++;
502 << "inode " << inode.src_ino
503 << " count " << inode.nlookup << endl;
536 // Release inode.fd before last unlink like nfsd EXPORT_OP_CLOSE_BEFORE_UNLINK
537 // to test reused inode numbers.
538 // Skip this when inode has an open file and when writeback cache is enabled.
547 Inode& inode = get_inode(e.ino);
548 lock_guard<mutex> g {inode.m};
549 if (inode.fd > 0 && !inode.nopen) {
551 cerr << "DEBUG: unlink: release inode " << e.attr.st_ino
552 << "; fd=" << inode.fd << endl;
554 close(inode.fd);
555 inode.fd = -ENOENT;
556 inode.generation++;
569 Inode& inode = get_inode(ino);
570 unique_lock<mutex> l {inode.m};
572 if(n > inode.nlookup) {
573 cerr << "INTERNAL ERROR: Negative lookup count for inode "
574 << inode.src_ino << endl;
577 inode.nlookup -= n;
581 << "inode " << inode.src_ino
582 << " count " << inode.nlookup << endl;
584 if (!inode.nlookup) {
586 cerr << "DEBUG: forget: cleaning up inode " << inode.src_ino << endl;
590 fs.inodes.erase({inode.src_ino, inode.src_dev});
593 cerr << "DEBUG: forget: inode " << inode.src_ino
594 << " lookup count now " << inode.nlookup << endl;
612 Inode& inode = get_inode(ino);
614 auto res = readlinkat(inode.fd, "", buf, sizeof(buf));
647 Inode& inode = get_inode(ino);
657 lock_guard<mutex> g {inode.m};
659 auto fd = openat(inode.fd, ".", O_RDONLY);
697 Inode& inode = get_inode(ino);
698 lock_guard<mutex> g {inode.m};
835 Inode& inode = get_inode(e.ino);
836 lock_guard<mutex> g {inode.m};
837 inode.nopen++;
856 Inode& inode = get_inode(ino);
874 /* Unfortunately we cannot use inode.fd, because this was opened
877 sprintf(buf, "/proc/self/fd/%i", inode.fd);
887 lock_guard<mutex> g {inode.m};
888 inode.nopen++;
897 Inode& inode = get_inode(ino);
898 lock_guard<mutex> g {inode.m};
899 inode.nopen--;
1003 Inode& inode = get_inode(ino);
1008 sprintf(procname, "/proc/self/fd/%i", inode.fd);
1046 Inode& inode = get_inode(ino);
1051 sprintf(procname, "/proc/self/fd/%i", inode.fd);
1088 Inode& inode = get_inode(ino);
1093 sprintf(procname, "/proc/self/fd/%i", inode.fd);
1104 Inode& inode = get_inode(ino);
1108 sprintf(procname, "/proc/self/fd/%i", inode.fd);