fuse-sshfs and linux binaries

hi, everyone.

Recently, I decided to replace samba mounts with fuse-sshfs shares on FreeBSD. It's working fine, except when I'm using linux binaries (with linux compat). The fact is that linux binaries can read files but not directories. Is there a workaround to fix this issue? Does anyone have the same problem too?

Thanx in advance.
 
Details..

Well, here is the complete explanation and a little PoC:

- With the modules "kldloaded": linux, linprocfs, fuse, mount a remote folder with sshfs:
Code:
sshfs user@server:/home/user /home/user/remote
Password: ******
Supose inside server's /home/user there is one regular file, file.txt.

- This command prints the expected output:
Code:
$ /usr/compat/linux/bin/ls /home/user/remote/file.txt
$ /home/user/remote/file.txt

- This one, does not:
Code:
[user@localhost]$ /usr/compat/linux/bin/ls /home/user/remote
[user@localhost]$ /usr/compat/linux/bin/ls: cannot open directory /mnt/smb/server/: Not a directory

I hacked around the FreeBSD's linux module source and inserted some debug info. On /usr/src/sys/compat/linux/linux_file.c there is a linux_common_open function. Line 158 holds the conditional statement for checking the opened file:

Code:
		    if (l_flags & LINUX_O_DIRECTORY) {
			    if (fp->f_type != DTYPE_VNODE ||
				fp->f_vnode->v_type != VDIR) {
				printf(LMSG("f_type: %d = %d, v_type: %d = %d"), fp->f_type, DTYPE_VNODE, fp->f_vnode->v_type,VDIR);    
				error = ENOTDIR;
			    }
		    }

I added this printf line for debugging and /var/log/messages prints the following:
Code:
May  1 11:22:05 freebsd kernel: linux (1091): f_type: 0 = 1, v_type: 2 = 2

The file descriptor type (fp->f_type) is 0 (should be DTYPE_VNODE, I think). I really don't know where to find the source of this error, but I'm still looking for. If someone has a direction to take (like search on fusefs-kmod, sshfs sources) it should help.

By the way, I'm trying to run Eclipse Galileo (linux version) and the good and old DBDesigner with linux compat and don't want to use smbfs.
My system info: FreeBSD 8.0-RELEASE-p2

Thanks!
 
Actualy not. Maybe because I have changed my e-mail after registration. But did not receive this info on both of them.

Anyway, thanks for the advice.
 
Back
Top