<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 8, 2015 at 9:37 PM, Anand Avati <span dir="ltr"><<a href="mailto:avati@gluster.org" target="_blank">avati@gluster.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Note that the mandatory locks available in the locks translator is just the mandatory extensions for posix locks - at least one of the apps must be using locks to begin with. </blockquote><div><br></div><div>Linux mandatory locking definition seems to convey exactly the above meaning [1].<br><br></div><div><extract><br><pre>4. Semantics
------------<br></pre></div><div><pre>1. Mandatory locks can only be applied via the fcntl()/lockf() locking
interface - in other words the System V/POSIX interface. BSD style
locks using flock() never result in a mandatory lock.</pre></extract><br></div><div><br>[1]Â <a href="https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt">https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt</a><br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">What Harmeet is asking for is something different - automatic exclusive access to edit files. i.e, if one app has opened a file for editing, other apps which attempt an open must either fail (EBUSY) or block till the first app closes. We need to treat open(O_RDONLY) as a read lock and open(O_RDWR|O_WRONLY) as a write lock request (essentially an auto applied oplock). This is something gluster does not yet have.<br><div><br></div><div>Thanks</div><div class=""><div class="h5"><br><div class="gmail_quote">On Thu Jan 08 2015 at 2:49:29 AM Raghavendra Gowdappa <<a href="mailto:rgowdapp@redhat.com" target="_blank">rgowdapp@redhat.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
----- Original Message -----<br>
> From: "Raghavendra Gowdappa" <<a href="mailto:rgowdapp@redhat.com" target="_blank">rgowdapp@redhat.com</a>><br>
> To: "Harmeet Kalsi" <<a href="mailto:kharmeet@hotmail.com" target="_blank">kharmeet@hotmail.com</a>><br>
> Cc: "<a href="mailto:Gluster-devel@gluster.org" target="_blank">Gluster-devel@gluster.org</a>" <<a href="mailto:gluster-devel@gluster.org" target="_blank">gluster-devel@gluster.org</a>><br>
> Sent: Thursday, January 8, 2015 4:12:44 PM<br>
> Subject: Re: [Gluster-devel] mandatory lock<br>
><br>
><br>
><br>
> ----- Original Message -----<br>
> > From: "Harmeet Kalsi" <<a href="mailto:kharmeet@hotmail.com" target="_blank">kharmeet@hotmail.com</a>><br>
> > To: "<a href="mailto:Gluster-devel@gluster.org" target="_blank">Gluster-devel@gluster.org</a>" <<a href="mailto:gluster-devel@gluster.org" target="_blank">gluster-devel@gluster.org</a>><br>
> > Sent: Wednesday, January 7, 2015 5:55:43 PM<br>
> > Subject: [Gluster-devel] mandatory lock<br>
> ><br>
> > Dear All.<br>
> > Would it be possible for someone to guide me in the right direction to<br>
> > enable<br>
> > the mandatory lock on a volume please.<br>
> > At the moment two clients can edit the same file at the same time which is<br>
> > causing issues.<br>
><br>
> I see code related to mandatory locking in posix-locks xlator (pl_writev,<br>
> pl_truncate etc). To enable it you've to set "option mandatory-locks yes" in<br>
> posix-locks xlator loaded on bricks<br>
> (/var/lib/glusterd/vols/<<u></u>volname>/*.vol). We've no way to set this option<br>
> through gluster cli. Also, I am not sure to what extent this feature is<br>
> tested/used till now. You can try it out and please let us know whether it<br>
> worked for you :).<br>
<br>
If mandatory locking doesn't work for you, can you modify your application to use advisory locking, since advisory locking is tested well and being used for long time?<br>
<br>
><br>
> > Many thanks in advance<br>
> > Kind Regards<br>
> ><br>
> > ______________________________<u></u>_________________<br>
> > Gluster-devel mailing list<br>
> > <a href="mailto:Gluster-devel@gluster.org" target="_blank">Gluster-devel@gluster.org</a><br>
> > <a href="http://www.gluster.org/mailman/listinfo/gluster-devel" target="_blank">http://www.gluster.org/<u></u>mailman/listinfo/gluster-devel</a><br>
> ><br>
> ______________________________<u></u>_________________<br>
> Gluster-devel mailing list<br>
> <a href="mailto:Gluster-devel@gluster.org" target="_blank">Gluster-devel@gluster.org</a><br>
> <a href="http://www.gluster.org/mailman/listinfo/gluster-devel" target="_blank">http://www.gluster.org/<u></u>mailman/listinfo/gluster-devel</a><br>
><br>
______________________________<u></u>_________________<br>
Gluster-devel mailing list<br>
<a href="mailto:Gluster-devel@gluster.org" target="_blank">Gluster-devel@gluster.org</a><br>
<a href="http://www.gluster.org/mailman/listinfo/gluster-devel" target="_blank">http://www.gluster.org/<u></u>mailman/listinfo/gluster-devel</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
Gluster-devel mailing list<br>
<a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a><br>
<a href="http://www.gluster.org/mailman/listinfo/gluster-devel" target="_blank">http://www.gluster.org/mailman/listinfo/gluster-devel</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Raghavendra G<br></div>
</div></div>