[Samba] Missing Files/Missing Folders from an NFS Share

Conor Armstrong conorarmstrong at gmail.com
Wed Feb 15 13:06:38 UTC 2023


Folks

I'm having trouble with a samba share of a folder.  When the number of
entries in the folder is large, then large numbers of entries are missing
when viewed from a Windows 10 client.  For example a folder with 5000 sub
folders, only about 550 show up.

If I share an identical folder, which is backed on local block storage on
the server all the folders appear as expected on the windows client.

If I access the share locally on the server using smbclient, then I can see
all the folders as expected.

It is not a permissions issue - there is full read/write for owner, group &
world on all folders, parent folder etc.  Also, folder names are not long -
just a 4 digit number.

The server is Unbuntu 22.04 and the Samba version is 4.15.13.

I have run the server at Debug Level 10 and captured the logs of the folder
mounted via an NFS share and then compare it to the same folder mounted
from a local block storage device, I can see that the error seems to be
arising within the smbd_marshall_dir_entry function in trans2.c as follows:

[2023/02/15 00:03:11.268209,  9, pid=2573823, efective(33, 33), real(33,
0)] ../../source3/smbd/trans2.c:2426(smbd_marshall_dir_entry)

  smbd_marshall_dir_entry: out of space (wanted 112, had 8)

I have looked at the source code and it appears to be the size of the
*in_output_buffer* is too small.  Not yet sure where that buffer is
allocated and why it would be sufficient for a share from block storage and
not one from an NFS share when the contents of both are identical.

Any help appreciated on how to either fix or bypass.

Many thanks
Conor

The smb.conf file is as follows:

[global]

workgroup = WORKGROUP

server string = Samba Server %v

netbios name = ubuntu

security = user

map to guest = bad user

dns proxy = no

dfree command = /etc/samba/samba-dfree

dfree cache time = 60


#============================ Share Definitions
==============================


[block_share]

path = /mnt/ebs/home/REDACTED

browsable =no

writable = yes

guest ok = yes

read only = no


[nfs_share]

path = /mnt/efs/home/REDACTED

browsable =no

writable = yes

guest ok = yes

read only = no

Log file for the nfs share (MISSING FILES).is as follows:

  1 [2023/02/15 00:03:11.175077,  4, pid=2573823, effective(33, 33),
real(33, 0), class=vfs] ../../source3/smbd/vfs.c:938(vfs_ChDir)

  2   vfs_ChDir to /mnt/efs/home/REDACTED

  3 [2023/02/15 00:03:11.175098,  5, pid=2573823, effective(33, 33),
real(33, 0), class=vfs] ../../source3/smbd/vfs.c:1000(vfs_ChDir)

  4   vfs_ChDir: vfs_ChDir got /mnt/efs/home/REDACTED

  5 [2023/02/15 00:03:11.175112,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/uid.c:294(print_impersonation_info)

  6   print_impersonation_info: Impersonated user: uid=(33,33), gid=(0,33),
cwd=[/mnt/efs/home/REDACTED]

  7 [2023/02/15 00:03:11.175124, 10, pid=2573823, effective(33, 33),
real(33, 0), class=smb2]
../../source3/smbd/smb2_query_directory.c:98(smbd_smb2_request_process_query_directory)

  8   smbd_smb2_request_find_done: in_output_buffer_length = 65536

  9 [2023/02/15 00:03:11.175135, 10, pid=2573823, effective(33, 33),
real(33, 0), class=smb2]
../../source3/smbd/smb2_query_directory.c:289(smbd_smb2_query_directory_send)

 10   smbd_smb2_query_directory_send: . - fnum 1174090446

 11 [2023/02/15 00:03:11.175146, 10, pid=2573823, effective(33, 33),
real(33, 0), class=smb2_credits]
../../source3/smbd/smb2_server.c:2646(smbd_smb2_request_verify_creditcharge)

 12   smbd_smb2_request_verify_creditcharge: mid 53, CreditCharge: 1,
NeededCharge: 1

 13 [2023/02/15 00:03:11.175156,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:217(dptr_create)

 14   dptr_create: dir=.

 15 [2023/02/15 00:03:11.175192,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:318(dptr_create)

 16   dptr_create: creating new dirptr [0] for path [.], expect_close = 0

 17 [2023/02/15 00:03:11.175203,  8, pid=2573823, effective(33, 33),
real(33, 0), class=smb2]
../../source3/smbd/smb2_query_directory.c:465(smbd_smb2_query_directory_send)

 18   smbd_smb2_query_directory_send: dirpath=<.> dontdescend=<>,
in_output_buffer_length = 65528

 19 [2023/02/15 00:03:11.175219,  6, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:792(smbd_dirptr_get_entry)

 20   smbd_dirptr_get_entry: dirptr 0x5586360f2220 now at offset 0

 21 [2023/02/15 00:03:11.175234, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:448(openat_pathref_fsp)

 22   openat_pathref_fsp: smb_fname [.]

 23 [2023/02/15 00:03:11.175244,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:74(fsp_new)

 24   fsp_new: allocated files structure (8 used)

 25 [2023/02/15 00:03:11.175254, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:1380(file_name_hash)

 26   file_name_hash: /mnt/efs/home/REDACTED/. hash 0x5fc870f7

 27 [2023/02/15 00:03:11.175268, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/open.c:934(fd_openat)

 28   fd_openat: name ., flags = 0200000 mode = 00, fd = 45

 29 [2023/02/15 00:03:11.175278, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:565(openat_pathref_fsp)

 30   openat_pathref_fsp: fsp [.]: OK

 31 [2023/02/15 00:03:11.175288, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:742(fdos_mode)

 32   fdos_mode: .

 33 [2023/02/15 00:03:11.175304,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:396(fget_ea_dos_attribute)

 34   fget_ea_dos_attribute: Cannot get attribute from EA on file .: Error
= Operation not supported

 35 [2023/02/15 00:03:11.175315,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:68(dos_mode_debug_print)

 36   dos_mode_debug_print: fdos_mode returning (0x10): "d"

 37 [2023/02/15 00:03:11.175325,  3, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:1031(smbd_dirptr_get_entry)

 38   smbd_dirptr_get_entry mask=[*] found . fname=. (.)

 39 [2023/02/15 00:03:11.175339, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:1842(smbd_marshall_dir_entry)

 40   smbd_marshall_dir_entry: space_remaining = 65528

 41 [2023/02/15 00:03:11.175349, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:2246(smbd_marshall_dir_entry)

 42   smbd_marshall_dir_entry: SMB_FIND_ID_BOTH_DIRECTORY_INFO

 43 [2023/02/15 00:03:11.175364, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:335(get_ea_names_from_fsp)

 44   get_ea_names_from_fsp: ea_namelist size = 0

 45 [2023/02/15 00:03:11.175375, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:648(fill_ea_chained_buffer)

 46   fill_ea_chained_buffer: data_size = 0

 47 [2023/02/15 00:03:11.175389,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:1174(file_free)

 48   freed files structure 0 (7 used)

 49 [2023/02/15 00:03:11.175399,  6, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:792(smbd_dirptr_get_entry)

 50   smbd_dirptr_get_entry: dirptr 0x5586360f2220 now at offset 2147483648

 51 [2023/02/15 00:03:11.175411, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:448(openat_pathref_fsp)

 52   openat_pathref_fsp: smb_fname [..]

 53 [2023/02/15 00:03:11.175421,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:74(fsp_new)

 54   fsp_new: allocated files structure (8 used)

 55 [2023/02/15 00:03:11.175431, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:1380(file_name_hash)

 56   file_name_hash: /mnt/efs/home/REDACTED/.. hash 0xecd0e981

 57 [2023/02/15 00:03:11.175443, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/open.c:934(fd_openat)

 58   fd_openat: name .., flags = 0200000 mode = 00, fd = 45

 59 [2023/02/15 00:03:11.175453, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:565(openat_pathref_fsp)

 60   openat_pathref_fsp: fsp [..]: OK


 61 [2023/02/15 00:03:11.175464,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:1174(file_free)

 62   freed files structure 0 (7 used)

 63 [2023/02/15 00:03:11.175473,  3, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:1031(smbd_dirptr_get_entry)

 64   smbd_dirptr_get_entry mask=[*] found .. fname=.. (..)

 65 [2023/02/15 00:03:11.175483, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:1842(smbd_marshall_dir_entry)

 66   smbd_marshall_dir_entry: space_remaining = 65416

 67 [2023/02/15 00:03:11.175493, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:2246(smbd_marshall_dir_entry)

 68   smbd_marshall_dir_entry: SMB_FIND_ID_BOTH_DIRECTORY_INFO

 69 [2023/02/15 00:03:11.175828,  6, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:792(smbd_dirptr_get_entry)

 70   smbd_dirptr_get_entry: dirptr 0x5586360f2220 now at offset
-376809156201132964

 71 [2023/02/15 00:03:11.175842, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:448(openat_pathref_fsp)

 72   openat_pathref_fsp: smb_fname [2617]

 73 [2023/02/15 00:03:11.175852,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:74(fsp_new)

 74   fsp_new: allocated files structure (8 used)

 75 [2023/02/15 00:03:11.175862, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:1380(file_name_hash)

 76   file_name_hash: /mnt/efs/home/REDACTED/2617 hash 0x398605a

 77 [2023/02/15 00:03:11.176256, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/open.c:934(fd_openat)

 78   fd_openat: name 2617, flags = 0200000 mode = 00, fd = 45

 79 [2023/02/15 00:03:11.176273, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:565(openat_pathref_fsp)

 80   openat_pathref_fsp: fsp [2617]: OK

 81 [2023/02/15 00:03:11.176284, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:742(fdos_mode)

 82   fdos_mode: 2617

 83 [2023/02/15 00:03:11.176302,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:396(fget_ea_dos_attribute)

 84   fget_ea_dos_attribute: Cannot get attribute from EA on file 2617:
Error = Operation not supported

 85 [2023/02/15 00:03:11.176319,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:68(dos_mode_debug_print)

 86   dos_mode_debug_print: fdos_mode returning (0x10): "d"

 87 [2023/02/15 00:03:11.176329,  3, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:1031(smbd_dirptr_get_entry)

 88   smbd_dirptr_get_entry mask=[*] found 2617 fname=2617 (2617)

 89 [2023/02/15 00:03:11.176340, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:1842(smbd_marshall_dir_entry)

 90   smbd_marshall_dir_entry: space_remaining = 65304

 91 [2023/02/15 00:03:11.176350, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:2246(smbd_marshall_dir_entry)

 92   smbd_marshall_dir_entry: SMB_FIND_ID_BOTH_DIRECTORY_INFO

 93 [2023/02/15 00:03:11.176364, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:335(get_ea_names_from_fsp)

 94   get_ea_names_from_fsp: ea_namelist size = 0

 95 [2023/02/15 00:03:11.176374, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:648(fill_ea_chained_buffer)

 96   fill_ea_chained_buffer: data_size = 0

 97 [2023/02/15 00:03:11.176388,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:1174(file_free)

 98   freed files structure 0 (7 used)

 99 [2023/02/15 00:03:11.176401,  6, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:792(smbd_dirptr_get_entry)

100   smbd_dirptr_get_entry: dirptr 0x5586360f2220 now at offset
-376809156200608676

101

102 <snip>

103

104 [2023/02/15 00:03:11.267914,  6, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:792(smbd_dirptr_get_entry)

105   smbd_dirptr_get_entry: dirptr 0x5586360f2220 now at offset
-376809155104584612

106 [2023/02/15 00:03:11.267924, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:448(openat_pathref_fsp)

107   openat_pathref_fsp: smb_fname [6653]

108 [2023/02/15 00:03:11.267933,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:74(fsp_new)

109   fsp_new: allocated files structure (8 used)

110 [2023/02/15 00:03:11.267943, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:1380(file_name_hash)

111   file_name_hash: /mnt/efs/home/REDACTED/6653 hash 0xb73673c1

112 [2023/02/15 00:03:11.267955, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/open.c:934(fd_openat)

113   fd_openat: name 6653, flags = 0200000 mode = 00, fd = 45

114 [2023/02/15 00:03:11.267964, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:565(openat_pathref_fsp)

115   openat_pathref_fsp: fsp [6653]: OK

116 [2023/02/15 00:03:11.267974, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:742(fdos_mode)

117   fdos_mode: 6653


118 [2023/02/15 00:03:11.267986,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:396(fget_ea_dos_attribute)

119   fget_ea_dos_attribute: Cannot get attribute from EA on file 6653:
Error = Operation not supported

120 [2023/02/15 00:03:11.267996,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:68(dos_mode_debug_print)

121   dos_mode_debug_print: fdos_mode returning (0x10): "d"

122 [2023/02/15 00:03:11.268005,  3, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:1031(smbd_dirptr_get_entry)

123   smbd_dirptr_get_entry mask=[*] found 6653 fname=6653 (6653)

124 [2023/02/15 00:03:11.268015, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:1842(smbd_marshall_dir_entry)

125   smbd_marshall_dir_entry: space_remaining = 120

126 [2023/02/15 00:03:11.268024, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:2246(smbd_marshall_dir_entry)

127   smbd_marshall_dir_entry: SMB_FIND_ID_BOTH_DIRECTORY_INFO

128 [2023/02/15 00:03:11.268035, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:335(get_ea_names_from_fsp)

129   get_ea_names_from_fsp: ea_namelist size = 0

130 [2023/02/15 00:03:11.268044, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:648(fill_ea_chained_buffer)

131   fill_ea_chained_buffer: data_size = 0

132 [2023/02/15 00:03:11.268055,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:1174(file_free)

133   freed files structure 0 (7 used)

134 [2023/02/15 00:03:11.268066,  6, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:792(smbd_dirptr_get_entry)

135   smbd_dirptr_get_entry: dirptr 0x5586360f2220 now at offset
-376809155102749604

136 [2023/02/15 00:03:11.268076, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:448(openat_pathref_fsp)

137   openat_pathref_fsp: smb_fname [5924]

138 [2023/02/15 00:03:11.268086,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:74(fsp_new)

139   fsp_new: allocated files structure (8 used)

140 [2023/02/15 00:03:11.268095, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:1380(file_name_hash)

141   file_name_hash: /mnt/efs/home/REDACTED/5924 hash 0xaa807709

142 [2023/02/15 00:03:11.268107, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/open.c:934(fd_openat)

143   fd_openat: name 5924, flags = 0200000 mode = 00, fd = 45

144 [2023/02/15 00:03:11.268120, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:565(openat_pathref_fsp)

145   openat_pathref_fsp: fsp [5924]: OK

146 [2023/02/15 00:03:11.268129, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:742(fdos_mode)

147   fdos_mode: 5924

148 [2023/02/15 00:03:11.268141,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:396(fget_ea_dos_attribute)

149   fget_ea_dos_attribute: Cannot get attribute from EA on file 5924:
Error = Operation not supported

150 [2023/02/15 00:03:11.268151,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dosmode.c:68(dos_mode_debug_print)

151   dos_mode_debug_print: fdos_mode returning (0x10): "d"

152 [2023/02/15 00:03:11.268160,  3, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/dir.c:1031(smbd_dirptr_get_entry)

153   smbd_dirptr_get_entry mask=[*] found 5924 fname=5924 (5924)

154 [2023/02/15 00:03:11.268170, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:1842(smbd_marshall_dir_entry)

155   smbd_marshall_dir_entry: space_remaining = 8

156 [2023/02/15 00:03:11.268179, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:2246(smbd_marshall_dir_entry)

157   smbd_marshall_dir_entry: SMB_FIND_ID_BOTH_DIRECTORY_INFO

158 [2023/02/15 00:03:11.268190, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:335(get_ea_names_from_fsp)

159   get_ea_names_from_fsp: ea_namelist size = 0

160 [2023/02/15 00:03:11.268200, 10, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:648(fill_ea_chained_buffer)

161   fill_ea_chained_buffer: data_size = 0

162 [2023/02/15 00:03:11.268209,  9, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/trans2.c:2426(smbd_marshall_dir_entry)

163   smbd_marshall_dir_entry: out of space (wanted 112, had 8)

164 [2023/02/15 00:03:11.268227,  5, pid=2573823, effective(33, 33),
real(33, 0)] ../../source3/smbd/files.c:1174(file_free)

165   freed files structure 0 (7 used)

166 [2023/02/15 00:03:11.268237, 10, pid=2573823, effective(33, 33),
real(33, 0), class=smb2]
../../source3/smbd/smb2_query_directory.c:188(smbd_smb2_request_find_done)

167   smbd_smb2_request_find_done: out_output_buffer.length = 65520

168 [2023/02/15 00:03:11.268248, 10, pid=2573823, effective(33, 33),
real(33, 0), class=smb2]
../../source3/smbd/smb2_server.c:3840(smbd_smb2_request_done_ex)

169   smbd_smb2_request_done_ex: mid [53] idx[5] status[NT_STATUS_OK]
body[8] dyn[yes:65520] at ../../source3/smbd/smb2_query_directory.c:193

170 [2023/02/15 00:03:11.268541, 10, pid=2573823, effective(33, 33),
real(33, 0), class=smb2]
../../source3/smbd/smb2_server.c:3808(smbd_smb2_request_dispatch_immediate)

171

<SNIP>


198 [2023/02/15 00:03:11.268610, 10, pid=2573823, effective(33, 33),
real(33, 0), class=smb2]
../../source3/smbd/smb2_server.c:2979(smbd_smb2_request_dispatch)

199   smbd_smb2_request_dispatch: opcode[SMB2_OP_QUERY_DIRECTORY] mid = 54


More information about the samba mailing list