On Thu, Nov 9, 2023 at 4:43 AM Paulo Alcantara <pc@xxxxxxxxxxxxx> wrote: > > Eduard Bachmakov <e.bachmakov@xxxxxxxxx> writes: > > > When attempting to mount (mount.cifs version 7.0) a share using > > > > $ mount -t cifs -o > > vers=3.1.1,cred=/home/u/.secret.txt,uid=1000,gid=100 > > //smb.server.example.com/scans /home/u/mnt > > > > it succeeds on 6.5.9: > > > > mount("//smb.server.example.com/scans", ".", "cifs", 0, > > "ip=192.168.5.43,unc=\\\\smb.server.example.com\\scans,vers=3.1.1,uid=1000,gid=100,user=u,pass=mypassword") > > = 0 > > > > but fails on 6.0.0: > > > > mount("//smb.server.example.com/scans", ".", "cifs", 0, > > "ip=192.168.5.43,unc=\\\\smb.server.example.com\\scans,vers=3.1.1,uid=1000,gid=100,user=u,pass=mypassword") > > = -1 ENOKEY (Required key not available) > > > > (or ENOENT) though it still works with using the IP instead of the domain: > > > > mount("//192.168.5.43/scans", ".", "cifs", 0, > > "ip=192.168.5.43,unc=\\\\192.168.5.43\\scans,vers=3.1.1,uid=1000,gid=100,user=u,pass=mypassword") > > = 0 > > > > Based on my reading ever since 348a04a ("smb: client: get rid of dfs > > code dep in namespace.c") dfs_mount_share() is now calling > > dns_resolve_server_name_to_ip() early and unconditionally. This can be > > verified on a running system by enabling dns_resolver logging (echo 1 > > | sudo tee /sys/module/dns_resolver/parameters/debug + watch dmesg). > > An additional DNS lookup is attempted in 6.0.0 that previously wasn't. > > My best guess is that ENOENT is "didn't work" and ENOKEY means "didn't > > work but cached". > > Yes, this is a regression. Commit assumed that there would be always a > dns_resolver key set up on kernels built with CONFIG_CIFS_DFS_UPCALL=y > so that cifs.ko could safely upcall to resolve UNC hostname regardless > whether mounting a DFS share or a regular share. > > Could you please try attached patch? Can confirm, this works. No more UMH DNS lookup, share is mounted successfully. I don't see is_dfs_mount() being called so in my scenario we're simply relying on kzalloc initializing dfs_automount to false. > Thanks.