vasi / squashfuse

FUSE filesystem to mount squashfs archives
Other
294 stars 69 forks source link

fileattr_get returns -61 for symlinks #82

Closed hallyn closed 1 year ago

hallyn commented 1 year ago

I'm mounting overlay over squashfuse. To do a lchown on a symbolic link, overlay calls copy_up, which calls vfs_fileattr_get.

The overlay code has a special case for:

 142         err = ovl_real_fileattr_get(old, &oldfa);
 143         if (err) {
 144                 /* Ntfs-3g returns -EINVAL for "no fileattr support" */
 145                 if (err == -ENOTTY || err == -EINVAL)
 146                         return 0;
 147                 pr_warn("failed to retrieve lower fileattr (%pd2, err=%i)\n",
 148                         old->dentry, err);
 149                 return err;
 150         }

However, squashfuse returns not EINVAL or ENOTTY but ENXIO, so overlay fails the copy_up, failing the chown. (I work around this by removing the symlink and recreating it, so that the chown (and fileattr_get) happen on the upperdir, but that's not ideal).

Is there a way that squashfuse could either return -EINVAL or implement the call?

hallyn commented 1 year ago

The debug output from squashfuse:

unique: 12, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 312210
LOOKUP /lib64
getattr[NULL] /lib64
   NODEID: 2
   unique: 12, success, outsize: 144
unique: 14, opcode: GETXATTR (22), nodeid: 2, insize: 68, pid: 312210
getxattr /lib64 security.capability 0
   unique: 14, error: -61 (No data available), outsize: 16
unique: 16, opcode: READLINK (5), nodeid: 2, insize: 40, pid: 312210
readlink /lib64 4097
   unique: 16, success, outsize: 19
unique: 18, opcode: LISTXATTR (23), nodeid: 2, insize: 48, pid: 312210
listxattr /lib64 0
   unique: 18, success, outsize: 24
DrDaveD commented 1 year ago

I believe this was fixed in #83.