AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  Samba File Refresh Issue

    Posted Wed October 02, 2013 10:22 AM

    Originally posted by: NewbieBryan


    First I need to start off by saying I've been a tech for Windows environment for almost 20 years now.  With that being said, I've never touched unix/linux/aix before so all of this is new to me.  If you can bare with me, I'll gladly provide any configs/logs you may need to help me.

    I'm having an issue with SAMBA where the file contents are not refreshed immediately after the server (aix) changes the file.  I have a program in windows that is reading a file across a SAMBA share.  When I make changes to the file from the server side, the next file read still contains the old stale data content.  If I read the file about 30 seconds later, the new content is displayed. My question is, is there any way to force these data to update immediately?

    I've read somewhere that adding "refresh = 1" to the config file would do the trick but that doesn't seem to be working and isn't recognized by "testparm" anyway.  I've also read that adding "kernel oplocks = yes" would do the trick but no go on that either.

    Here is everything I can think to include:

    AIX version 6.1

    smbclient -V = Version 3.6.9-cdc-4.5.5-222

    smb.conf global section:

    [global]
        security = ADS
        realm = PFSGROUP.LOCAL
        workgroup = PFSGROUP
        netbios name = pfs-cubs-aix
        refresh = 1
        kernel oplocks = yes
        auth methods = guest, sam, winbind, ntdomain
        machine password timeout = 0
        passdb backend = tdbsam:/etc/samba/private/passdb.tdb
        change notify timeout = 0
     

    I need to add that this is a centrify modified version of SAMBA to allow direct integration into their product, but they're saying this isn't their problem because the portion they modify for this doesn't affect this issue.

    If there is more information necessary, please let me know and I'll add it.



  • 2.  Re: Samba File Refresh Issue

    Posted Thu October 03, 2013 06:17 AM

    Originally posted by: Wouter Liefting


    I would think that if you access the files both from Samba and via AIX direct, you have to *disable* oplocks completely. Both the regular oplocks and the kernel oplocks. (oplocks = no and kernel oplocks = no in the smb.conf file.) With oplocks turned on, client-side caching is allowed. That's why you see the original file from Windows, even after you've changed the file in AIX.

    Windows clients and supported UNIX implementations work together to "break an oplock", and thereby disable client side caching and causing a global refresh, if multiple clients want to access the same file. But AIX is not able to participate in this scheme, so the only way to ensure the file is synchronized is to disable client side caching. Which is done by disabling oplocks altogether.

    I found the following on the Samba website:

    Oplocks essentially means that the client is allowed to download and cache a file on its hard drive while making changes; if a second client wants to access the file, the first client receives a break and must synchronize the file back to the server. This can give significant performance gains in some cases; some programs insist on synchronizing the contents of the entire file back to the server for a single change.

    [...]

    Kernel Oplocks are essentially a method that allows the Linux kernel to co-exist with Samba's oplocked files, although this has provided better integration of MS Windows network file locking with the underlying OS. SGI IRIX and Linux are the only two OSs that are oplock-aware at this time.

    Unless your system supports kernel oplocks, you should disable oplocks if you are accessing the same files from both UNIX/Linux and SMB clients.

    http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/locking.html



  • 3.  Re: Samba File Refresh Issue

    Posted Thu October 03, 2013 11:00 AM

    Originally posted by: NewbieBryan


    I finally did get this working.  It was a combination of adding the other oplocks parameters you mentioned here along with adding the "csc policy = disable" to my shares.  After adding those to the server I actually had to reboot any clients that had accessed the shares previously.  Once rebooted, they all started refreshing immediately and working perfectly.  Thanks for the advice!