Creating a VFS backend

Stefan Metzmacher metze at
Wed Aug 12 07:44:01 UTC 2020

Hello Matthew,

> I'm investigating using Samba to host a custom filesystem which
> currently relies on FUSE.
> To get started, I wanted to make a trivial VFS backend which exposed a
> few hard-coded files in a single directory. Samba is invoking
> connectpath, get_realpath, and some other methods that I've
> implemented but for some reason it's giving up ("it" refers to either
> Samba's smbclient and the macOS SMB client). It never seems to attempt
> an opendir or openat operation.
> TL;DR: what VFS operation did I omit or implement wrongly that, if
> fixed, will result in opendir or openat being attempted?
> Here is the source code:
> Only the last commit is relevant - the others are hacks and tweaks to
> make the code work on macOS. Detailed output follows.
> Thank you,
> Matt
> ---
> This is what I tried to do in smbclient:
> $ ~/samba_build/bin/smbclient -p 8111 //localhost/sambashare
> Enter WORKGROUP\matvore's password:
> Try "help" to get a list of possible commands.
> smb: \> dir
> smb: \> ls
> smb: \> more foo
> smb1cli_req_writev_submit: called for dialect[SMB3_11] server[localhost]
> NT_STATUS_REVISION_MISMATCH opening remote file \foo
> smb: \>

My guess should be hello_create_dfs_pathat or hello_get_dfs_referrals.

> Here is the output of smbd:
> $ sudo ~/samba_build/sbin/smbd  --foreground --port 8111 --debuglevel=1 -S

Add debug messages to all the calls, btw. you should use
DBG_{ERR,WARNING,DEBUG,...}() instead of the raw DEBUG() macro.

And let it run with log level 10, I'd also skip the -S option.

Also look take network captures on the server side
(because the timestamps of the capture and log files come from the same clock).
and check what requests are sent on the wire.

With that you should be able to make progress.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the samba-technical mailing list