The Samba copy file call flow

GongJinrong jinronggong at
Sun May 4 00:15:21 MDT 2014

Thanks Volker and Jeremy for your nice replies, my samba version is 3.5.10,
and the smb.conf is like the following, if I didn't enable any vfs object,
does samba still call functions in vfs_default.c?

#======================= Global Settings

	dos charset = GB2312
	unix charset = GB2312
	display charset = GB2312
	directory mask = 0777
	force directory mode = 0777
	directory security mask = 0777
	force directory security mode = 0777
	create mask = 0777
	force create mode = 0777
	security mask = 0777
	force security mode = 0777
	unix extensions= no

	workgroup = WORKGROUP
	server string = Samba Server Version %v

	log level = 10
	log file = /var/log/samba/log.%m
	# max 50KB per log file, then rotate
	max log size = 5000

	security = user
	passdb backend = tdbsam

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

        comment = Home Directories
        browseable = no
        writable = yes
;       valid users = %S
;       valid users = MYDOMAIN\%S

        comment = All Printers
        path = /var/spool/samba
        browseable = no
        guest ok = no
        writable = no
        printable = yes

# Un-comment the following and create the netlogon directory for Domain
;       [netlogon]
;       comment = Network Logon Service
;       path = /var/lib/samba/netlogon
;       guest ok = yes
;       writable = no
;       share modes = no

# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
;       [Profiles]
;       path = /var/lib/samba/profiles
;       browseable = no
;       guest ok = yes

# A publicly accessible directory, but read only, except for people in
# the "staff" group
        comment = Public Stuff
        path = /usr/local/Cavium_Networks/OCTEON-SDK
        public = yes
        writable = yes
        printable = no
        write list = +John
        unix extensions = no
        follow symlinks = yes
        wide links= yes


-----Original Message-----
From: samba-technical-bounces at
[mailto:samba-technical-bounces at] On Behalf Of Volker
Sent: Friday, May 02, 2014 4:09 PM
To: GongJinrong
Cc: samba-technical at
Subject: Re: The Samba copy file call flow

On Thu, May 01, 2014 at 11:52:12AM +0800, GongJinrong wrote:
>    I found that if I enable a vfs object(such as full_audit), I can 
> see the
> write_file() print log, but if I don't enable any VFS object, I cannot 
> find the file data write operations, can you tell me how samba store a 
> file to disk without VFS object? Where is the real file write code?

It's in source3/smbd/vfs.c, lines 456 and following. From there it goes into
source3/modules/vfs_default.c, line 610 and following.  From there it goes
into source3/lib/system.c, line 141. In 146 we have a pwrite system call.
>From there it is the C system library and on most implementations it will be
some kind of system call.
But beyond the call to the function pwrite it is essentially out of Samba's
hands and in the hands of someone else.

With best regards,

Volker Lendecke

SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9 AG Göttingen, HRB 2816, GF:
Dr. Johannes Loxen, mailto:kontakt at

More information about the samba-technical mailing list