Bug 146237 - [linux] [fusefs] Linux binaries not reading directories mounted with fusefs-sshfs
Summary: [linux] [fusefs] Linux binaries not reading directories mounted with fusefs-s...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-emulation (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-02 15:30 UTC by Marcos R. Gonzalez
Modified: 2017-06-26 10:30 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos R. Gonzalez 2010-05-02 15:30:09 UTC
Linux binaries can't read directories mounted with fusefs-sshfs. They can read regular files but not directories.

Native FreeBSD binaries are ok and linux binaries with smbfs are doing well too. The only problem is the combination fusefs-sshfs+linux+directories.

Fix: 

Not a fix, but I inserted some debugging on /usr/src/sys/compat/linux/linux_file.c on linux_common_open (line 158)

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;
  }
}

/var/log/messages gave me this output:
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).
How-To-Repeat: With the modules "kldloaded": linux, linprocfs, fuse, mount a remote folder with sshfs:

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:
$ /usr/compat/linux/bin/ls /home/user/remote/file.txt
$ /home/user/remote/file.txt

This one, does not:
$ /usr/compat/linux/bin/ls /home/user/remote
$ /usr/compat/linux/bin/ls: cannot open directory /mnt/smb/server/: Not a directory
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2010-05-03 21:42:39 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-emulation

Over to maintainer(s).
Comment 2 Dmitry Chagin freebsd_committer freebsd_triage 2017-06-26 10:30:59 UTC
I bet this is fixed by r205423.