# mount_smbfs: FreeBSD client can't view mounted shares of Illumos CIFS server



## LSDave (Aug 2, 2015)

I have an OpenIndiana fileserver, running Solaris CIFS service in Domain Mode (or in Samba-speak, security = ads).  It serves Windows clients without problem, but when I mount the shares on a FreeBSD 10.1 client using `mount_smbfs`, the command appears to work but the mountpoint remains empty. 

On the OpenIndiana server, I have created and shared a zfs filesystem.  For this troubleshooting exercise, I granted full permissions.

```
OIserver# zfs create -o casesensitivity=mixed -o nbmand=on rpool/testfs
OIserver# touch /rpool/testfs/foo
OIserver# touch /rpool/testfs/foo.bar
OIserver# chmod -R 777 /rpool/testfs
```
I share the filesystem. 

```
OIserver# zfs set sharesmb=on rpool/testpool
OIserver# zfs set sharesmb=name=testpool rpool/testpool
```
Next, I confirmed it's accessible from Windows clients.  Back on the OpenIndiana server, I confirm the share's status:

```
OIserver# sharemgr show –vp
[...]
  zfs/rpool/testfs smb=()
[INDENT]  testfs=/rpool/testfs[/INDENT]
```
I should add that on the OIserver, `kinit` tests perfectly. 

Now to the FreeBSD client, which is a barebones installation intended to host jails, and is NOT joined to any domain.  It is current.

```
root@LANjailhost:/ # freebsd-version -ku
10.1-RELEASE-p10
10.1-RELEASE-p14
```
Configured hosts file:

```
root@LANjailhost:/ # cat /etc/hosts
::1  localhost localhost.my.domain
127.0.0.1  localhost localhost.my.domain
127.0.0.1  LANjailhost $LANjailhost.redacted.domain.com

# DMZ Hosts
#10.0.0.2  myname.my.domain myname
#10.0.0.3  myfriend.my.domain myfriend
10.0.28.3  webdns

#LAN Hosts
192.168.5.7  oiserver oiserver.redacted.domain.com
192.168.5.107  vault01 vault01.redacted.domain.com
192.168.5.200  LANjailhost.redacted.domain.com
192.168.5.201  btm.redacted.domain.com
```
When I run `mount_smbfs`, I enter the password when prompted and the command appears to succeed:

```
mkdir /mnt/testfs
root@LANjailhost:/mnt #mount_smbfs -W {REDACTED} //{PrivilegedWinUser}@oiserver/testfs /mnt/testfs
Password:
root@LANjailhost:/mnt #
```
Listing mounted file systems on the client shows:

```
[...]
//{PRIVILEGEDWINUSER}@OISERVER/TESTFS on /mnt/testfs (smbfs)
```
If I check free space, testfs is detected and the free space reading is accurate:

```
root@LANjailhost:/mnt # df -H
[...]
//{PRIVILEGEDWINUSER}@OISERVER/TESTFS  2.1G  48k  2.1G  0%  /mnt/testfs
```
But when I navigate to the mount location, it appears empty:

```
root@LANjailhost:/mnt # cd testfs/
root@LANjailhost:/mnt/testfs # ls -l
total 0
root@LANjailhost:/mnt/testfs #
```
I know there are files there, and I created some new ones from a Windows client.

Questions:
1. I’ve read that SMB protocol used by Solaris is SMB v1, and FreeBSD uses something newer.  Could that be the cause?  How can I find out?
2.  What log(s) should I be viewing to gather more clues?
3.  Any thoughts or suggestions on what to try next to gather more info?

Many thanks.

LSDave


----------



## LSDave (Aug 4, 2015)

Bump for a new week.  Does anybody have a hint for me?   TIA


----------



## G4 (Aug 5, 2015)

Maybe this is related to my problem:
https://forums.freebsd.org/threads/samba-files-created-on-windows-not-visible-on-freebsd.51811/

It seems that the SMB client is broken somehow, or there's a weird permission thing going on, which I've been unable to figure out.


----------



## LSDave (Aug 25, 2015)

Bump, with some new clues:

1) From the mount point, I can actually `cd` into shared sub-directories, and even create files (which I can see from the server and Windows clients).  I still cannot list any contents.  

2) When I attempt `ls` command, or when I use Tab to complete a path under the mount point, the following errors appear in the console:

```
md_get_mem(476): incomplete copy
md_get_mem(476): incomplete copy
md_get_mem(476): incomplete copy
md_get_mem(476): incomplete copy
md_get_mem(476): incomplete copy
md_get_mem(476): incomplete copy
md_get_mem(476): incomplete copy
md_get_mem(476): incomplete copy
md_get_mem(476): incomplete copy
md_get_mem(476): incomplete copy
md_get_mem(476): incomplete copy
smbfs_findnextLM2: out of sync.
```
The problem has not resolved with upgrade to 10.2-RELEASE.

```
root@LANjailhost:/ # freebsd-version -ku
10.2-RELEASE
10.2-RELEASE-p1
```


----------



## thedonald (Jun 13, 2017)

I am having this problem as well...still not resolved in version 11.0


```
$ freebsd-version -ku
11.0-RELEASE-p1
11.0-RELEASE-p1
```

I found that message repeated in a log file... now, I just can't find the log file again to post it... but the error message "md_get_mem(476): incomplete copy" was exactly the same.....


----------



## LSDave (Jun 13, 2017)

Wow, funny timing for this thread resurrection.  I was just reading it the other day. 

I never fixed it, and moved on to a more complicated NFS solution.  But recently I was rebuilding some lab computers and had a chance to try again with FreeBSD 11 as client accessing OpenIndiana SMB server.  And yes, the problem indeed remains.

I can't believe we are the only people complaining about it.


----------



## durval (Feb 26, 2018)

Hello Everyone,

I have the same message (only the line number changed) on my FreeBSD 11.1-STABLE machine here:

```
Feb 24 13:35:42 nas md_get_mem(477): incomplete copy
```

This gets logged to dmesg, from where it gets picked up by syslog and sent to the log files (and my console, where I noticed it).

To be sent to the console, this supposedly has a pretty high syslog priority, and this has me really worried.

Certainly not a coincidence, it has happened while copying a very large (15TB and tens of millions of files) from a dedicated NAS via a SMB share mounted on the FreeBSD machine (with mount_smbfs).

I tried investigating this more and (due to my reading of md_get_mem(9) and the mbuf(9) it points to), I think this is related to the kernel hitting some error while copying SMB packets around.

Would really like more information as to the root cause, severity and what can/should be done to fix it.

Cheers,
--
   Durval.


----------



## diizzy (Feb 27, 2018)

Your best bet is probably use to fuse (ports) instead in the kernel module.


----------



## ggghhhjjj (Oct 31, 2020)

Looks like the problem is available in 12.1 as well

`root@microserver:/ # mount_smbfs -I 10.0.1.1 -U user -W WORKGROUP //10.0.1.1/archive /smb
Password:
root@microserver:/ # mount
/dev/raid/r0s1a on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
//USER@10.0.1.1/ARCHIVE on /smb (smbfs)
root@microserver:/ # df -h
Filesystem                      Size    Used   Avail Capacity  Mounted on
/dev/raid/r0s1a                 898G    681G    145G    82%    /
devfs                           1.0K    1.0K      0B   100%    /dev
//USER@10.0.1.1/ARCHIVE    1.8T    1.7T     82G    96%    /smb

root@microserver:/ # cd /smb
root@microserver:/smb # ls
root@microserver:/smb #

root@microserver:/ # freebsd-version -ku
12.1-RELEASE
12.1-RELEASE`

But smbclient shows I do have content

`ggghhhjjj@microserver ~]$ smbclient //10.0.1.1/archive --option="client use spnego = no" --user=user         
Unable to initialize messaging context
Enter WORKGROUP\user's password:
Try "help" to get a list of possible commands.
smb: \> ls
  .                                       D        0  Sat Oct 31 15:05:05 2020
  ..                                      D        0  Wed Sep  2 22:22:48 2020
  temp                                D        0  Sat Oct 31 15:05:05 2020`


----------

