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-10 Thread Jeff Layton
On Tue, 9 Sep 2014 12:18:21 -0400 J. Bruce Fields bfie...@fieldses.org 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

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

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 anyway to

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

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:

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

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-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 bfie...@fieldses.org 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

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 xe...@parallels.com wrote: On 09/02/2014 11:53 PM, Jeff Layton wrote: On Tue, 2 Sep 2014 15:43:00 -0400 J. Bruce Fields bfie...@fieldses.org wrote: On Tue, Sep 02, 2014 at 11:07:14PM +0400, Pavel Emelyanov wrote: On 09/02/2014 10:44

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 bfie...@fieldses.org wrote: On Tue, Sep 02, 2014 at 11:07:14PM +0400, Pavel Emelyanov wrote: On 09/02/2014 10:44 PM, J. Bruce

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:

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 xe...@parallels.com wrote: On 09/02/2014 11:53 PM, Jeff Layton wrote: On Tue, 2 Sep 2014 15:43:00 -0400 J. Bruce Fields bfie...@fieldses.org wrote: On Tue, Sep 02, 2014 at 11:07:14PM +0400, Pavel

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 xe...@parallels.com wrote: On 09/03/2014 07:55 PM, Jeff Layton wrote: On Wed, 3 Sep 2014 18:38:24 +0400 Pavel Emelyanov xe...@parallels.com wrote: On 09/02/2014 11:53 PM, Jeff Layton wrote: On Tue, 2 Sep 2014 15:43:00 -0400 J. Bruce

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 jlay...@poochiereds.net wrote: On Wed, 3 Sep 2014 20:00:02 +0400 Pavel Emelyanov xe...@parallels.com wrote: On 09/03/2014 07:55 PM, Jeff Layton wrote: On Wed, 3 Sep 2014 18:38:24 +0400 Pavel Emelyanov xe...@parallels.com wrote: On 09/02/2014

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

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

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

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

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_ hold

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 the task who

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 thing is that the

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 bfie...@fieldses.org 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