Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: linkinjeon@kernel.org, sfrench@samba.org,
	senozhatsky@chromium.org, tom@talpey.com,
	linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	David Howells <dhowells@redhat.com>
Subject: Re: [PATCH] ksmbd: use F_SETLK when unlocking a file
Date: Tue, 15 Nov 2022 10:22:42 -0500	[thread overview]
Message-ID: <81a329d44cb2def622ddfcde88984caf51b4a017.camel@kernel.org> (raw)
In-Reply-To: <Y3NVZ6e7Hnddsdl6@infradead.org>

On Tue, 2022-11-15 at 01:01 -0800, Christoph Hellwig wrote:
> On Fri, Nov 11, 2022 at 08:11:53AM -0500, Jeff Layton wrote:
> > ksmbd seems to be trying to use a cmd value of 0 when unlocking a file.
> > That activity requires a type of F_UNLCK with a cmd of F_SETLK. For
> > local POSIX locking, it doesn't matter much since vfs_lock_file ignores
> > @cmd, but filesystems that define their own ->lock operation expect to
> > see it set sanely.
> 
> Btw, I really wonder if we should split vfs_lock_file into separate
> calls for locking vs unlocking.  The current interface seems very
> confusing.

Maybe, though the current scheme basically of mirrors the userland API,
as do the ->lock and ->flock file_operations.

FWIW, the filelocking API is pretty rife with warts. Several other
things that I wouldn't mind doing, just off the top of my head:

- move the file locking API into a separate header. No need for it to be
in fs.h, which is already too bloated.

- define a new struct for leases, and drop lease-specific fields from
file_lock

- remove more separate filp and inode arguments

- maybe rename locks.c to filelock.c? "locks.c" is too ambiguous

Any others?
-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2022-11-15 15:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11 13:11 [PATCH] ksmbd: use F_SETLK when unlocking a file Jeff Layton
2022-11-11 15:16 ` Namjae Jeon
2022-11-14 11:40 ` David Howells
2022-11-15  9:01 ` Christoph Hellwig
2022-11-15 15:22   ` Jeff Layton [this message]
2022-11-16  6:14     ` Christoph Hellwig

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=81a329d44cb2def622ddfcde88984caf51b4a017.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=hch@infradead.org \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=sfrench@samba.org \
    --cc=tom@talpey.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