linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Jeff Layton <jlayton@kernel.org>,
	Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>
Subject: Re: The file_lock_operatoins.lock API seems to be a BAD API.
Date: Fri, 29 May 2020 11:01:59 +1000	[thread overview]
Message-ID: <87y2pb7dvc.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20200528220112.GD20602@fieldses.org>

[-- Attachment #1: Type: text/plain, Size: 1379 bytes --]

On Thu, May 28 2020, J. Bruce Fields wrote:

> On Thu, May 28, 2020 at 04:14:44PM +1000, NeilBrown wrote:
>> I don't think we should just fix all those bugs in those filesystems.
>> I think that F_UNLCK should *always* remove the lock/lease.
>> I imaging this happening by  *always* calling posix_lock_file() (or
>> similar) in the unlock case - after calling f_op->lock() first if that
>> is appropriate.
>> 
>> What do people think?  It there on obvious reason that is a non-starter?
>
> Isn't NFS unlock like close, in that it may be our only chance to return
> IO errors?

Is it?  fcntl() isn't documented as returning ENOSPC, EDQUOT or EIO.

>
> But I guess you're not saying that unlock can't return errors, just that
> it should always remove the lock whether it returns 0 or not.

No I wasn't, but I might.
One approach that I was considering for making the API more robust was
to propose a separate "unlock" file_operation.  All unlock requests
would go through this, and it would have a 'void' return type.
Would that be sufficient to encourage programmers to handle their own
errors and not think they can punt?

But yes - even if unlock returns an error, it should (locally) remove
any locks - much as 'close()' will always close the fd (if it was
actually open) even if it reports an error.

Thanks,
NeilBrown

>
> Hm.
>
> --b.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2020-05-29  1:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28  6:14 The file_lock_operatoins.lock API seems to be a BAD API NeilBrown
2020-05-28 22:01 ` J. Bruce Fields
2020-05-29  1:01   ` NeilBrown [this message]
2020-05-29  1:16     ` J. Bruce Fields

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=87y2pb7dvc.fsf@notabene.neil.brown.name \
    --to=neilb@suse.de \
    --cc=bfields@fieldses.org \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.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 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).