• Jakob Unterwurzacher's avatar
    nodefs: do not overwrite the "out.Ino" inode number · 1b3f7953
    Jakob Unterwurzacher authored
    ...if it has already been set by the filesystem.
    
    "out.Ino" is the user-facing inode number that is displayed by "ls -li".
    
    This change allows loopback filesystems to expose the inode number of
    the underlying filesystem.
    As a "real" inode number, this one is stable for the lifetime of the file,
    even across remounts.
    
    libfuse has the `use_ino` option that allows the inode numbers to be set
    arbitrarily as well. This has been used by EncFS for years.
    
    The Linux kernel stores the inode number in `orig_ino`. Grepping in
    `fs/fuse` shows that it is only read once in `fuse_update_attributes`,
    and only if the `stat` argument is not NULL. There is only one caller
    that passes that argument: `fuse_getattr`.
    
    In short, the kernel does not use the inode number for anything but
    reporting it via `stat()`, hence setting the inode number is safe.
    
    This functionality will be used for improving log output in gocryptfs,
    where file names cannot be used because they are encrypted.
    1b3f7953
fsconnector.go 10.5 KB