Linux FUSE 错误:传输端点未连接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16002539/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 22:42:29  来源:igfitidea点击:

FUSE error: Transport endpoint is not connected

linuxmountfuse

提问by AndroidDev

I'm trying to implement the FUSE filesystem. I am receiving this error:

我正在尝试实现 FUSE 文件系统。我收到此错误:

cannot access MountDir: Transport endpoint is not connected

无法访问 MountDir:传输端点未连接

This the relevant parts of the program. There are two directories, MirrorDirand MountDir, that exist withing the same directory as all of the code. I am calling the program like this:

这是程序的相关部分。有两个目录MirrorDirMountDir,它们与所有代码位于同一目录中。我这样调用程序:

./myFS -o nonempty -o allow_other MirrorDir MountDir

Can anyone see what I am doing wrong?

谁能看到我做错了什么?

static struct fuse_operations xmp_oper = {
    .getattr    = xmp_getattr,
    .readdir    = xmp_readdir,
    .open       = xmp_open,
    .read       = xmp_read,
};

int main(int argc, char *argv[]) {
    int fuse_stat;
    char* mirrorDir;

    mirrorDir = malloc(sizeof(strlen(argv[argc-2]+1)));
    if (mirrorDir == NULL) {
        perror("main calloc");
        abort();
    }

    // Pull the rootdir out of the argument list and save it in my internal data
    mirrorDir = realpath(argv[argc-2], NULL);

    argv[argc-2] = argv[argc-1];
    argv[argc-1] = NULL;
    argc--;

    // turn over control to fuse
    fprintf(stderr, "about to call fuse_main\n");   
    fuse_stat = fuse_main(argc, argv, &xmp_oper, mirrorDir);
    fprintf(stderr, "fuse_main returned %d\n", fuse_stat);
    return fuse_stat;
}

回答by Jonathan Brown

This typically is caused by the mount directory being left mounted due to a crash of your filesystem. Go to the parent directory of the mount point and enter fusermount -u YOUR_MNT_DIR.

这通常是由于文件系统崩溃导致挂载目录被挂载造成的。进入挂载点的父目录,输入fusermount -u YOUR_MNT_DIR.

If this doesn't do the trick, do sudo umount -l YOUR_MNT_DIR.

如果这不起作用,请执行sudo umount -l YOUR_MNT_DIR.

回答by Jonathan Brown

I mounted a ssh file system (sshfs command line) and left it mounted and I had same problem, fusermount -u YOUR_MNT_DIRsolved my problem. Thanks

我挂载了一个 ssh 文件系统(sshfs 命令行)并将其挂载,我遇到了同样的问题,fusermount -u YOUR_MNT_DIR解决了我的问题。谢谢

回答by Thiago Mata