Need advices for development back-up Samba module

Igor Yu. Zhbanov bsg at
Thu Jun 24 21:08:27 GMT 2004


I need to write Samba module for backing-up purposes. It will copy all
changed files to back-up server. The main purpose of thit module is
to keep two servers synchronized, so when the main server crashes
the back-up server will temporarily act as the main server.

Can you give me some advices how to make it robust and clear?

The current idea is to write module for Samba that will copy changed
files to the back-up server (on-the-fly) by the means of rsync utility.

1) Should module be integrated deeply into smbd or should it be written
as a VFS module?

The idea is to copy changed files when it will be closed or when file
was changed (and still open) and some time of inactivity (about 5 minutes)
was passed.

2) If I intercept VSF write operation, do I have exclusively lock on file
to be changed? Or only on region to be changed?

3) Can two Samba users change the same file simultaneously? This may
be important because in the case of VFS module each connection will
be served by its own forked child smbd process.

Also I need to copy files that was changed and still open (after some
time passed after last write).
4)  How can I do this? Should I make it by setting alarm() signal handler
in VFS module in child process?
5) Should I (and how?) acquire lock for changed file?

6) Or is it easier to copy changed files from main smbd process
(opposite to childs serving users connections)?

Thank you in advance.

More information about the samba-technical mailing list