linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Calum Mackay <calum.mackay@oracle.com>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>, NeilBrown <neilb@suse.de>,
	Steve Dickson <steved@redhat.com>
Cc: Calum Mackay <calum.mackay@oracle.com>,
	linux-nfs@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH nfs-utils] start-statd: use flock -x instead of -e for busybox compatibility
Date: Wed, 28 Feb 2024 21:09:07 +0000	[thread overview]
Message-ID: <fd6db153-669f-4635-bacf-a23b0f7d2c7c@oracle.com> (raw)
In-Reply-To: <20240228185644.2743036-1-a.fatoum@pengutronix.de>


[-- Attachment #1.1: Type: text/plain, Size: 1736 bytes --]

On 28/02/2024 6:56 pm, Ahmad Fatoum wrote:
> busybox flock(1) only supports -x and not -e. util-linux flock(1)
> treats both -e and -x the same, documents them both in its man page,
> but lists only -x in its help output.
> 
> Referring to util-linux git, it seems both options were added between
> util-linux-2.13-pre1 and util-linux-2.13-pre2 back in 2006, so there
> should be no harm in switching over to flock -x to avoid confusing
> error output when attempting to mount a NFS on a busybox system:
> 
>    $ mount -t nfs 192.168.2.13:/home/afa/nfsroot/imx8mn-evk /mnt
>    flock: invalid option -- 'e'
>    BusyBox v1.36.0 () multi-call binary.
> 
>    Usage: flock [-sxun] FD | { FILE [-c] PROG ARGS }
> 
>    [Un]lock file descriptor, or lock FILE, run PROG
> 
>            -s      Shared lock
>            -x      Exclusive lock (default)
>            -u      Unlock FD
>            -n      Fail rather than wait
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

hi Ahmad,

Since the default is an exclusive lock, in both BusyBox and util-linux, 
might it be simpler just to run flock without that option?

best wishes,
calum.

> ---
>   utils/statd/start-statd | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/statd/start-statd b/utils/statd/start-statd
> index b11a7d91a7f6..67a2f4ad8e0e 100755
> --- a/utils/statd/start-statd
> +++ b/utils/statd/start-statd
> @@ -8,7 +8,7 @@ PATH="/sbin:/usr/sbin:/bin:/usr/bin"
>   
>   # Use flock to serialize the running of this script
>   exec 9> /run/rpc.statd.lock
> -flock -e 9
> +flock -x 9
>   
>   if [ -s /run/rpc.statd.pid ] &&
>          [ "1$(cat /run/rpc.statd.pid)" -gt 1 ] &&



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2024-02-28 21:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 18:56 [PATCH nfs-utils] start-statd: use flock -x instead of -e for busybox compatibility Ahmad Fatoum
2024-02-28 21:09 ` Calum Mackay [this message]
2024-02-29 10:38   ` Ahmad Fatoum
2024-03-15 13:11 ` Steve Dickson

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=fd6db153-669f-4635-bacf-a23b0f7d2c7c@oracle.com \
    --to=calum.mackay@oracle.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=steved@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).