The Samba copy file call flow

GongJinrong jinronggong at
Wed Apr 30 19:41:44 MDT 2014

Hi, Jeremy

    Thanks a lot, the guide is really useful, but I cannot see the
real_write_file() be called when I copy a file to linux shared directory,
which function will call the VFS routine? is the file data receiving routine
in the Tevent handler functions? sorry for so much question^^

-----Original Message-----
From: Jeremy Allison [mailto:jra at] 
Sent: Thursday, May 01, 2014 7:27 AM
To: GongJinrong
Cc: samba-technical at
Subject: Re: The Samba copy file call flow

On Thu, May 01, 2014 at 12:36:49AM +0800, GongJinrong wrote:

>    I am learning the samba source code, it's really hard to understand 
> the whole samba architecture, I don't find the detail call stack or 
> call flow in samba when I do a file copying from win7 to a linux 
> shared directory, I put some debug code to vfs_write_data() and 
> real_write_file(), but I cannot see the debug print in the log file, 
> can any nice guy tell me how the samba create file and write file data 
> to disk, which low level file operation wrapper function will be 
> called? Thanks a lot! I already spent a whole week, but got nothing!

Sorry you're having so much trouble. You can start from real_write_file() -
but notice it calls vfs_pwrite_data(), not vfs_write_data().

Feel free to ask specific questions
on the list. Richard Sharpe has a
good guide to the Samba VFS you
might want to read.

Keep at it - the more you read
the code the more you'll find a treasure trove of useful things :-). Talloc,
tevent, tdb, ctdb, pthreadpool, they're all here :-).


More information about the samba-technical mailing list