0

I have written a fuse mirror file system using FUSE-JNA, Which mirror local directory.

This Mirror file system allow me to open all types of files correctly with no issue but it does not open all types of office files e.g. .docs , .xls etc. And give me be below error while opening any office file.

http://i61.tinypic.com/2wd4j9c.png

Note: I thought its LibreOffice issue, so I removed it and installed OpenOffice. But get the same issue. Secondly, the errors only pops up when I try to access an office file from my MirrorFileSystem. Office files opens correctly if accessed normally via ubuntu default file system.

So its some thing wrong with my File system.

Finally, (i don't know whether its related to the question or not but) in my mirror file system when I Right Click on a file>Properties> Permission its shows all the fields disabled, as below

enter image description here

This is my getatt() method:

public int getattr(final String path, final StatWrapper stat)
{
....
if (f.isFile())
    {
        stat.setMode(NodeType.FILE,true,true,true,true,true,true,true,true,true);
        stat.size(f.length());
        stat.atime(f.lastModified()/ 1000L);
        stat.mtime(0);
        stat.nlink(1);
        stat.uid(0);
        stat.gid(0);
        stat.blocks((int) ((f.length() + 511L) / 512L));
        return 0;
    }
...
}

Please guide me how to fix general input/output error while office files?

2 Answers2

1

Office files are not special. There is some other problem with your filesystem implementation, and you need to do more debugging work to find out precisely what the trigger and the cause is. It's very unlikely that the trigger truly is "the file is an office file", unless you have stuff in your filesystem code that operates differently based on the type of file it's dealing with (in which case you should look there). As a first debugging step, you could compare the sha1sum and stat output of the files from the fuse filesystem and from the root filesystem to see if they match. If they don't, adjust the filesystem code such that they do. You could also enable logging on your filesystem class and check if it's returning an I/O error code anywhere. The error message "general input/output error" makes it sound like that is the case.

As for the reason the permissions fields are disabled, that's because the file is owned by root, and you are not root so you can't change the permissions. The reason the file is owned by root is because you set stat.uid(0); and stat.gid(0); in getattr. UID 0 and GID 0 are for the root user and root group respectively. Fuse-JNA already puts the current UID and GID as default stat attributes in getattr, so if you want to use these then just don't call stat.uid(0); or stat.gid(0);.

Etienne Perot
  • 4,764
  • 7
  • 40
  • 50
0

Thanks for the answer.

I searched on web, on many websites they showed file locking as the reason e.g. https://forum.openoffice.org/en/forum/viewtopic.php?f=10&t=2020 etc

So in fuse, I implemented file lock function and simply return 0

My problem solved. Now I can open all types of office files.

But I do not know, is it perfect solution