Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-10 Thread Jeff Layton
On Tue, 9 Sep 2014 12:18:21 -0400 "J. Bruce Fields" wrote: > On Tue, Sep 02, 2014 at 11:07:14PM +0400, Pavel Emelyanov wrote: > > > Would it make sense to return the lock type held instead, so you could > > > do one flock(fd, LOCK_TEST) instead of flock(fd, LOCK_TEST|LOCK_SH) and > > > flock(fd,

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-09 Thread J. Bruce Fields
On Tue, Sep 02, 2014 at 11:07:14PM +0400, Pavel Emelyanov wrote: > > Would it make sense to return the lock type held instead, so you could > > do one flock(fd, LOCK_TEST) instead of flock(fd, LOCK_TEST|LOCK_SH) and > > flock(fd, LOCK_TEST|LOCK_EX) ? > > Well, in our case we parse /proc/locks anyw

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-03 Thread Andy Lutomirski
On Sep 3, 2014 9:04 AM, "Jeff Layton" wrote: > > On Wed, 3 Sep 2014 20:00:02 +0400 > Pavel Emelyanov wrote: > > > On 09/03/2014 07:55 PM, Jeff Layton wrote: > > > On Wed, 3 Sep 2014 18:38:24 +0400 > > > Pavel Emelyanov wrote: > > > > > >> On 09/02/2014 11:53 PM, Jeff Layton wrote: > > >>> On Tue

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-03 Thread Jeff Layton
On Wed, 3 Sep 2014 20:00:02 +0400 Pavel Emelyanov wrote: > On 09/03/2014 07:55 PM, Jeff Layton wrote: > > On Wed, 3 Sep 2014 18:38:24 +0400 > > Pavel Emelyanov wrote: > > > >> On 09/02/2014 11:53 PM, Jeff Layton wrote: > >>> On Tue, 2 Sep 2014 15:43:00 -0400 > >>> "J. Bruce Fields" wrote: > >>

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-03 Thread Pavel Emelyanov
On 09/03/2014 07:55 PM, Jeff Layton wrote: > On Wed, 3 Sep 2014 18:38:24 +0400 > Pavel Emelyanov wrote: > >> On 09/02/2014 11:53 PM, Jeff Layton wrote: >>> On Tue, 2 Sep 2014 15:43:00 -0400 >>> "J. Bruce Fields" wrote: >>> On Tue, Sep 02, 2014 at 11:07:14PM +0400, Pavel Emelyanov wrote: >>>

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-03 Thread Pavel Emelyanov
On 09/03/2014 07:44 PM, J. Bruce Fields wrote: ... >> Hope this explanation is more clear. > > Thanks, I think I understand. > > Remind me how you figure out which file descriptors point to the same > file description (struct file)? We do it with the help of kcmp() syscall: https://github.com/c

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-03 Thread J. Bruce Fields
On Wed, Sep 03, 2014 at 06:38:24PM +0400, Pavel Emelyanov wrote: > On 09/02/2014 11:53 PM, Jeff Layton wrote: > > On Tue, 2 Sep 2014 15:43:00 -0400 > > "J. Bruce Fields" wrote: > > > >> On Tue, Sep 02, 2014 at 11:07:14PM +0400, Pavel Emelyanov wrote: > >>> On 09/02/2014 10:44 PM, J. Bruce Fields

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-03 Thread Jeff Layton
On Wed, 3 Sep 2014 18:38:24 +0400 Pavel Emelyanov wrote: > On 09/02/2014 11:53 PM, Jeff Layton wrote: > > On Tue, 2 Sep 2014 15:43:00 -0400 > > "J. Bruce Fields" wrote: > > > >> On Tue, Sep 02, 2014 at 11:07:14PM +0400, Pavel Emelyanov wrote: > >>> On 09/02/2014 10:44 PM, J. Bruce Fields wrote:

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-03 Thread Pavel Emelyanov
On 09/02/2014 11:53 PM, Jeff Layton wrote: > On Tue, 2 Sep 2014 15:43:00 -0400 > "J. Bruce Fields" wrote: > >> On Tue, Sep 02, 2014 at 11:07:14PM +0400, Pavel Emelyanov wrote: >>> On 09/02/2014 10:44 PM, J. Bruce Fields wrote: On Tue, Sep 02, 2014 at 09:17:34PM +0400, Pavel Emelyanov wrote:

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-02 Thread Jeff Layton
On Tue, 2 Sep 2014 15:43:00 -0400 "J. Bruce Fields" wrote: > On Tue, Sep 02, 2014 at 11:07:14PM +0400, Pavel Emelyanov wrote: > > On 09/02/2014 10:44 PM, J. Bruce Fields wrote: > > > On Tue, Sep 02, 2014 at 09:17:34PM +0400, Pavel Emelyanov wrote: > > >> Hi, > > >> > > >> There's a problem with g

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-02 Thread J. Bruce Fields
On Tue, Sep 02, 2014 at 11:07:14PM +0400, Pavel Emelyanov wrote: > On 09/02/2014 10:44 PM, J. Bruce Fields wrote: > > On Tue, Sep 02, 2014 at 09:17:34PM +0400, Pavel Emelyanov wrote: > >> Hi, > >> > >> There's a problem with getting information about who has a flock on > >> a specific file. The thi

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-02 Thread Pavel Emelyanov
On 09/02/2014 10:44 PM, J. Bruce Fields wrote: > On Tue, Sep 02, 2014 at 09:17:34PM +0400, Pavel Emelyanov wrote: >> Hi, >> >> There's a problem with getting information about who has a flock on >> a specific file. The thing is that the "owner" field, that is shown in >> /proc/locks is the pid of t

Re: [PATCH] locks: Ability to test for flock presence on fd

2014-09-02 Thread J. Bruce Fields
On Tue, Sep 02, 2014 at 09:17:34PM +0400, Pavel Emelyanov wrote: > Hi, > > There's a problem with getting information about who has a flock on > a specific file. The thing is that the "owner" field, that is shown in > /proc/locks is the pid of the task who created the flock, not the one > who _may