# smbfs is broken in head and stable/10



## T-Aoki (Oct 13, 2013)

Hi.
I recently tried 10-ALPHA5 and found smbfs is broken.
After some builds and tests in VirtualBox, I could figure out it started broken until r255138 in head, and not fixed. (Also in recently branched stable/10)

After above commit, volumes mounted with smbfs is quite unstable in large directory.
(Mostly OK for small directory containing a few files and directories, but directories containing about 100 files and some directories, even `ls` does not shows its contents properly, accidentally traverses to subdirectories and drop many files)

Reverting r255138 fixes the problem, but alternatively, it seems that applying attached diff mostly fixes the problem, too.
(Not mesasured but I feel the latter slower, but original 5 * hz should be 5 seconds)

Can someone confirm and send-pr? I currently have no disclosable email address.


----------



## wblock@ (Oct 13, 2013)

Please enter a PR for this.


----------



## T-Aoki (Oct 14, 2013)

Posted, and registered as kern/182963.
As the email address I could disclose is regularly filled with SPAMs, replies there from non-white listed address should be surely missed.


----------



## T-Aoki (Nov 4, 2013)

No advance for kern/182963 until now. Can it be fixed in upcoming 10-RELEASE?
I read related sources a bit further, and confirmed that reverting r255138 is not needed.
My diff for sys/netsmb/smb_trantcp.c (attached in my first post) is sufficient to fix the issue. Without this, the timeout value should be too small (for sbintime_t type, time in seconds is stored in upper 32bits of 64bits and 5*tz should be usually too small).

By the way, another PR misc/183153 for smbfs is filed by Dominic Fandrey (I already mentioned in my forget-me-nots page).
This issue has another fix, setting 
	
	



```
WITH_LIBICONV_COMPAT=YES
```
 in /etc/src.cof and rebuild world. I think this should be default and opt-out if needed, as at least `mount_smbfs` in base requires libiconv.so (either base or converters/libiconv) if -E option is set.
Please note that I myself did NOT confirmed Dominic's patch, as I already have base libiconv.so installed (would need one more VM for clean testing).


----------



## T-Aoki (Nov 8, 2013)

My patch was committed to head as r257841, but MFC schedule is not shown in commit message.
Actually, it is needed for 10-RELEASE, too.


----------



## T-Aoki (Nov 16, 2013)

Confirmed r257841 in head is MFC'ed to stable/10 as r258123.
Currently releng/10.0 is not yet branched, so 10-RELEASE should be OK.

As the iconv issue PR PR misc/183153 I mentioned before is a different problem, mark this thread as [SOLVED] now.


----------



## Yamil Selman (Feb 24, 2015)

I confirm that FreeBSD 10.1-RELEASE-p5 still have a bug with mount_smbfs. any news about this ?

with FreeBSD 8.4-RELEASE-p23 (works perfectly)

```
root@hostA:/ # mount_smbfs -I 192.168.1.1 //guest@192.168.1.1/nas /mnt/nas
root@HostA:/ # ls /mnt/nas/
.DS_Store  audio.mp3
letter.pdf
root@HostA:/ #
```
with FreeBSD 10.1-RELEASE-p5 (not)

```
root@HostB:/ # mount_smbfs -I 192.168.1.1 //guest@192.168.1.1/nas /mnt/nas
root@HostB:/ # ls /mnt/nas/
root@HostB:/ #
root@HostB:/ # cd /mnt/nas/
root@HostB:/mnt/nas # mkdir tmp
mkdir: .: No such file or directory
root@HostB:/mnt/nas #
```


----------



## Terry_Kennedy (Feb 26, 2015)

Yamil Selman said:


> I confirm that FreeBSD 10.1-RELEASE-p5 still have a bug with mount_smbfs. any news about this ?


Both 10.0-RELEASE and 10.1-RELEASE have the fix shown above included. So either that did not completely fix the problem or you are experiencing a different issue.


----------



## Yamil Selman (Mar 6, 2015)

Well I don't know maybe I think that is a different issue, the problem is that `mount_smbfs` does not work, and works on my FreeBSD 8.4. Maybe it's broken again.


----------



## Yamil Selman (Mar 14, 2015)

Anyone can confirm this issue?


----------



## vm9 (Oct 18, 2015)

Looks like I have same problem. Mounts without errors but does not work


```
[root@localhost /mnt]# mount_smbfs -I 192.168.1.1 //dian@192.168.1.1/new /mnt/test
Password:
[root@localhost /mnt/test]# df -h
Filesystem  Size  Used  Avail Capacity  Mounted on
/dev/da0p2  222G  58G  146G  28%  /
devfs  1.0K  1.0K  0B  100%  /dev
//DIAN@192.168.1.1/NEW  300G  261G  39G  87%  /mnt/test
[root@localhost /mnt]# cd /mnt/test/
[root@localhost /mnt/test]# ls
[root@localhost /mnt/test]# mkdir 1
mkdir: .: No such file or directory
[root@localhost /mnt/test]# uname -a
FreeBSD localhost 10.2-RELEASE FreeBSD 10.2-RELEASE #0 r286666: Wed Aug 12 15:26:37 UTC 2015  root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```


----------

