fuse-sshfs and linux binaries

Discussion related to network/web services such as Apache, BIND Sendmail, etc.

fuse-sshfs and linux binaries

Postby mrgz » 29 Apr 2010, 00:53

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.
mrgz
Junior Member
 
Posts: 22
Joined: 29 Apr 2010, 00:41
Location: Sao Paulo, Brazil

Details..

Postby mrgz » 01 May 2010, 15:16

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

- With the modules "kldloaded": linux, linprocfs, fuse, mount a remote folder with sshfs:
Code: Select all
sshfs user@server:/home/user /home/user/remote
Password: ******

Supose inside server's [FILE]/home/user[/FILE] there is one regular file, [FILE]file.txt[/FILE].

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


- This one, does not:
Code: Select all
[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: Select all
          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 [FILE]/var/log/messages[/FILE] prints the following:
Code: Select all
May  1 11:22:05 freebsd kernel: linux (1091): f_type: 0 = 1, v_type: 2 = 2


The file descriptor type [FILE](fp->f_type)[/FILE] is 0 (should be [FILE]DTYPE_VNODE[/FILE], 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!
mrgz
Junior Member
 
Posts: 22
Joined: 29 Apr 2010, 00:41
Location: Sao Paulo, Brazil

Postby DutchDaemon » 01 May 2010, 18:02

Entirely unreadable pile of garbage ... Posting and Editing in the FreeBSD Forums
User avatar
DutchDaemon
Old Fart
 
Posts: 10466
Joined: 16 Nov 2008, 20:17
Location: The Netherlands

Not an excuse, but..

Postby mrgz » 01 May 2010, 18:31

I'm an entirely new user around here.
mrgz
Junior Member
 
Posts: 22
Joined: 29 Apr 2010, 00:41
Location: Sao Paulo, Brazil

Postby DutchDaemon » 01 May 2010, 18:34

This information was mailed to you when you signed up.
User avatar
DutchDaemon
Old Fart
 
Posts: 10466
Joined: 16 Nov 2008, 20:17
Location: The Netherlands

Postby mrgz » 01 May 2010, 18:46

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.
mrgz
Junior Member
 
Posts: 22
Joined: 29 Apr 2010, 00:41
Location: Sao Paulo, Brazil


Return to Web & Network Services

Who is online

Users browsing this forum: No registered users and 1 guest