[Samba] How to handle multi process open smb.conf at the time

Jeremy Allison jra at samba.org
Tue Jul 8 17:39:52 GMT 2008

On Wed, Jul 09, 2008 at 12:39:13AM +0800, chenyun_zhou wrote:
>  Hi, everyone
>  I am try to write a program to edit smb.conf, and the question is "
>   If I open smb.conf for editing, but other process such as smbd , nmbd and winbind is reading the file, How to handle the this collision, and I want to open this file immediaetly ,and afte closing this file , tell these process to read it."

Do what all other unix programs do in this circumstance.
Create a temp smb.conf file and then do an atomic rename
into place. The next time smbd/nmbd re-read the file (or
when you tell them to do it via a MSG_SMB_CONF_UPDATED
message) they'll see the new contents.

Hope this helps,


More information about the samba mailing list