0

I am implementing a FUSE filesystem and as a first step have implemented only the getattr function. The code looks like this:

int test_getattr(const char *path, struct stat *statbuf){
    return lstat(path, statbuf);
}

The code works fine when I give any directory other than the directory on which the FUSE is mounted. For example, the above code works for /home, /home/ubuntu/mnt/, but hangs on lstat when path is /home/ubuntu/mnt/fuse/ where /home/ubuntu/mnt/fuse/ is the path passed to fuse_main. The code just hangs at lstat.

Mike Laren
  • 8,028
  • 17
  • 51
  • 70
Unknown
  • 57
  • 8

1 Answers1

2

Your getattr implementation is stuck on an infinite loop, because lstat with FUSE paths invokes test_getattr again and again.

If your implementation is a wrapper to another filesystem, then you need to lstat the real path of the other filesystem.

Bilk
  • 418
  • 6
  • 19