Hi samba experts, We have a strange file locking problem and i hope someone can help. We use some CentOS 5 servers, which use samba 3.0.33, to share files of a java application to clients. Clients are mostly CentOS 5 (same version as the server), but there are a few legacy windows clients (the reason why we use samba and not nfs). And now the problem. When our developer uploads a new jar file to the server via scp (or via local cp command) we encountered a problem. As soon as the server has the new file the Linux client (windows not yet tested) is seeing a corrupt file. And this state continues until the share gets remounted on the client. This was working before where we had a fedora core 4 servers and only windows clients, but now we are in the process of upgrading the servers and introducing Linux on the client side. You can also simulate the problem if you open a text file on a Linux client with tail -f and then change the file on the server locally. The file the client sees is corrupted until the share gets remounted. First thing. As these are remote locations and there is a lot of them, it is not possible to upload files via smb (we would like to make rpm packages for the application and the app will be distributed via yum). We tried various permutations of the parameters kernel oplocks, posix locks, oplocks, level2 oplocks, ... but nothing seems to work. We also tried to use a newer samba version (3.4.5). And now the question. Is there someone, that knows how this file locking works and can giwe a suggestion what we are doing wrong. Regards Janez
On Fri, Feb 19, 2010 at 07:33:48AM +0100, Janez Kosmrlj wrote:> We have a strange file locking problem and i hope someone can help. We use > some CentOS 5 servers, which use samba 3.0.33, to share files of a java > application to clients. Clients are mostly CentOS 5 (same version as the > server), but there are a few legacy windows clients (the reason why we use > samba and not nfs). And now the problem. When our developer uploads a new > jar file to the server via scp (or via local cp command) we encountered a > problem. As soon as the server has the new file the Linux client (windows > not yet tested) is seeing a corrupt file. And this state continues until the > share gets remounted on the client. This was working before where we had a > fedora core 4 servers and only windows clients, but now we are in the > process of upgrading the servers and introducing Linux on the client side. > > You can also simulate the problem if you open a text file on a Linux client > with tail -f and then change the file on the server locally. The file the > client sees is corrupted until the share gets remounted. > > First thing. As these are remote locations and there is a lot of them, it is > not possible to upload files via smb (we would like to make rpm packages for > the application and the app will be distributed via yum). > > We tried various permutations of the parameters kernel oplocks, posix locks, > oplocks, level2 oplocks, ... but nothing seems to work. We also tried to use > a newer samba version (3.4.5).Can you try to mount with -o directio? Not sure this will help, but it might be worth a try. Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: <http://lists.samba.org/pipermail/samba/attachments/20100219/734a3fd4/attachment.pgp>
On Sun, Feb 21, 2010 at 8:46 PM, Janez Kosmrlj <postnalista at googlemail.com>wrote:> > > On Fri, Feb 19, 2010 at 9:23 PM, Ernesto Silva <erniesilva at gmail.com>wrote: > >> Can you try to mount with -o directio? Not sure this will >>> help, but it might be worth a try. >>> >>> Volker >>> >> >> Hi, there is also another parameter similar to directio, I don't know the >> difference but seems more radical, it's "forcedirectio". I have been using >> it on linux clients which mounts a samba share or a w2k share. >> >> Best regards, >> Ernesto. >> > > > I think we tried -o, but i will check it again. I will also giwe > forcedirectio a try. > > Any other ideas. >It looks like forcedirectio is the right way to go. I tried it with the text file tests, that i mentioned before and for now it looks OK. All i have to do now is to test it with real life jar files and java. I will report to this list as soon as i get any results.
On Mon, Mar 15, 2010 at 6:52 AM, Janez Kosmrlj <postnalista at googlemail.com>wrote:> > >> >>> Hi, >>> I tried your configuration. Everything works, as long as i test with text >>> files. But when i tried with the java application i just get a lot of the >>> folowing errors: >>> *mmap failed for CEN and END part of zip file* >>> >>> Actually i get of them for every jar in the classpath. And the java app >>> doesn't start. >>> >>> From my testing it seems that java doesn't like the forcedirectio >>> parameter in fstab. Also it doesn't like the directio parameter. >>> >>> Regards >>> Janez >>> >> >> > I did some research and it is not possible to use java with > forcedirectio/directio. The explanation is in the mount.cifs man page. "Do > not do inode data caching on files opened on this mount. This precludes > mmaping files on this mount." Unfortunately java uses the mmap system call > to load the files from the classpath to memory. > > Maybe this will be usefull for someone in the future. >