All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jeff Layton <jlayton-vpEMnDpepFuMZCB2o+C8xQ@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH man-pages v1] fcntl.2: update manpage with verbiage about open file description locks
Date: Wed, 30 Apr 2014 16:41:22 +0200	[thread overview]
Message-ID: <53610B92.4000308@gmail.com> (raw)
In-Reply-To: <20140430081501.3aca5cba-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>

Hi Jeff,

Thanks for your reply. Comments below.

On 04/30/2014 02:15 PM, Jeff Layton wrote:
> On Wed, 30 Apr 2014 12:50:23 +0200
> "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

[...]

>> #      The record locks described above are associated with the  process
>> #      (unlike  the  open file description locks described below).  This
>> #      has some unfortunate consequences:
>>
>> #      *  If a process holding a lock on a file closes any file descrip‐
>> #         tor  referring to the file, then all of the process's locks on
>> #         the file are released, no matter which  file  descriptor  they
>> #         were  obtained  via.  This is bad: it means that a process can
> 
> "were obtained via" is a little awkward. How about "regardless of which
> file descriptor on which they were obtained".

Yeah, it is clumsy. I fixed, and also otherwise made the text more 
precise/concise:

       *  If a process closes any file descriptor referring to a file,
          then  all  of the process's locks on that file are released,
          regardless of the file descriptor(s) on which the locks were
          obtained.
 

[...]

>>   ERRORS
>>   [...]
>>
>> #      EINVAL cmd is  F_OFD_SETLK,  F_OFD_SETLKW,  or  F_OFD_GETLK,  and
>> #             l_pid was not specified as zero.
>>
> 
> The kernel will also return -EINVAL if it doesn't recognize the cmd
> value being passed in. It may be worth mentioning that as well as
> that's the best mechanism to tell whether the kernel actually supports
> OFD locks.

Good point. I added that error case under ERRORS, and added this text to
the top of the page:

       Certain  of  the operations below are supported only since a par‐
       ticular Linux kernel version.  The preferred method  of  checking
       whether  the  host  kernel  supports a aprticular operation is to
       invoke fcntl() with the desired cmd value and then  test  whether
       the  call failed with EINVAL, indicating that the kernel does not
       recognize this value.

==

And getting back to the missed piece:

>>>> The "EACCES or EAGAIN" thing comes from POSIX, because different
>>>> implementations of tradition record locks returned one of these errors.
>>>> So, portable applications using traditional locks must handle either
>>>> possibility. However, that argument doesn't apply for these new locks.
>>>> Surely, we just want to say "set errno to EAGAIN" for this case?
>
> Ahh good catch. I fixed that in the glibc doc but I missed it here.
> Yes, we should be clear that this OFD locks will get back EAGAIN in
> this situation. Can you fix it, or would you prefer I respin the
> patch?

No problem. I fixed it.

Thanks for checking over my revisions!

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Jeff Layton <jlayton@poochiereds.net>
Cc: mtk.manpages@gmail.com, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>
Subject: Re: [PATCH man-pages v1] fcntl.2: update manpage with verbiage about open file description locks
Date: Wed, 30 Apr 2014 16:41:22 +0200	[thread overview]
Message-ID: <53610B92.4000308@gmail.com> (raw)
In-Reply-To: <20140430081501.3aca5cba@tlielax.poochiereds.net>

Hi Jeff,

Thanks for your reply. Comments below.

On 04/30/2014 02:15 PM, Jeff Layton wrote:
> On Wed, 30 Apr 2014 12:50:23 +0200
> "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> wrote:

[...]

>> #      The record locks described above are associated with the  process
>> #      (unlike  the  open file description locks described below).  This
>> #      has some unfortunate consequences:
>>
>> #      *  If a process holding a lock on a file closes any file descrip‐
>> #         tor  referring to the file, then all of the process's locks on
>> #         the file are released, no matter which  file  descriptor  they
>> #         were  obtained  via.  This is bad: it means that a process can
> 
> "were obtained via" is a little awkward. How about "regardless of which
> file descriptor on which they were obtained".

Yeah, it is clumsy. I fixed, and also otherwise made the text more 
precise/concise:

       *  If a process closes any file descriptor referring to a file,
          then  all  of the process's locks on that file are released,
          regardless of the file descriptor(s) on which the locks were
          obtained.
 

[...]

>>   ERRORS
>>   [...]
>>
>> #      EINVAL cmd is  F_OFD_SETLK,  F_OFD_SETLKW,  or  F_OFD_GETLK,  and
>> #             l_pid was not specified as zero.
>>
> 
> The kernel will also return -EINVAL if it doesn't recognize the cmd
> value being passed in. It may be worth mentioning that as well as
> that's the best mechanism to tell whether the kernel actually supports
> OFD locks.

Good point. I added that error case under ERRORS, and added this text to
the top of the page:

       Certain  of  the operations below are supported only since a par‐
       ticular Linux kernel version.  The preferred method  of  checking
       whether  the  host  kernel  supports a aprticular operation is to
       invoke fcntl() with the desired cmd value and then  test  whether
       the  call failed with EINVAL, indicating that the kernel does not
       recognize this value.

==

And getting back to the missed piece:

>>>> The "EACCES or EAGAIN" thing comes from POSIX, because different
>>>> implementations of tradition record locks returned one of these errors.
>>>> So, portable applications using traditional locks must handle either
>>>> possibility. However, that argument doesn't apply for these new locks.
>>>> Surely, we just want to say "set errno to EAGAIN" for this case?
>
> Ahh good catch. I fixed that in the glibc doc but I missed it here.
> Yes, we should be clear that this OFD locks will get back EAGAIN in
> this situation. Can you fix it, or would you prefer I respin the
> patch?

No problem. I fixed it.

Thanks for checking over my revisions!

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

  parent reply	other threads:[~2014-04-30 14:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29 18:51 [PATCH man-pages v1] fcntl.2: update manpage with verbiage about open file description locks Jeff Layton
2014-04-30 10:50 ` Michael Kerrisk (man-pages)
2014-04-30 12:15   ` Jeff Layton
2014-04-30 12:15     ` Jeff Layton
2014-04-30 14:05     ` Michael Kerrisk (man-pages)
     [not found]     ` <20140430081501.3aca5cba-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2014-04-30 14:41       ` Michael Kerrisk (man-pages) [this message]
2014-04-30 14:41         ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53610B92.4000308@gmail.com \
    --to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=jlayton-vpEMnDpepFuMZCB2o+C8xQ@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.