linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Aurélien Aptel" <aaptel@suse.com>
To: Pavel Shilovsky <piastryyy@gmail.com>, Tom Talpey <tom@talpey.com>
Cc: "Aurélien Aptel" <aaptel@suse.com>,
	"Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>,
	"Steve French" <smfrench@gmail.com>,
	linux-cifs <linux-cifs@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	mtk.manpages@gmail.com, linux-man@vger.kernel.org
Subject: [PATCH v5] flock.2: add CIFS details
Date: Mon, 22 Mar 2021 15:30:24 +0100	[thread overview]
Message-ID: <20210322143024.13930-1-aaptel@suse.com> (raw)
In-Reply-To: <CAKywueQkELXyRjihtD2G=vswVuaeoeyMjrDfqTQeVF_NoRVm6A@mail.gmail.com>

From: Aurelien Aptel <aaptel@suse.com>

CIFS flock() locks behave differently than the standard. Give overview
of those differences.

Here is the rendered text:

CIFS details
  In Linux kernels up to 5.4, flock() is not propagated over SMB.  A file
  with such locks will not appear locked for remote clients.

  Since Linux 5.5, flock() locks are emulated with SMB  byte-range  locks
  on  the  entire  file.   Similarly to NFS, this means that fcntl(2) and
  flock() locks interact with one another.  Another important side-effect
  is  that  the  locks  are not advisory anymore: any IO on a locked file
  will always fail with EACCES when done from a separate file descriptor.
  This  difference  originates from the design of locks in the SMB proto-
  col, which provides mandatory locking semantics.

  Remote and mandatory locking semantics  may  vary  with  SMB  protocol,
  mount options and server type.  See mount.cifs(8) for additional infor-
  mation.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
---
 man2/flock.2 | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/man2/flock.2 b/man2/flock.2
index 328377365..61822c9bc 100644
--- a/man2/flock.2
+++ b/man2/flock.2
@@ -239,6 +239,31 @@ see the discussion of the
 .I "local_lock"
 option in
 .BR nfs (5).
+.SS CIFS details
+In Linux kernels up to 5.4,
+.BR flock ()
+is not propagated over SMB.
+A file with such locks will not appear locked for remote clients.
+.PP
+Since Linux 5.5,
+.BR flock ()
+locks are emulated with SMB byte-range locks on the entire file.
+Similarly to NFS, this means that
+.BR fcntl (2)
+and
+.BR flock ()
+locks interact with one another.
+Another important side-effect is that the locks are not advisory anymore:
+any IO on a locked file will always fail with
+.BR EACCES
+when done from a separate file descriptor.
+This difference originates from the design of locks in the SMB protocol,
+which provides mandatory locking semantics.
+.PP
+Remote and mandatory locking semantics may vary with SMB protocol, mount options and server type.
+See
+.BR mount.cifs (8)
+for additional information.
 .SH SEE ALSO
 .BR flock (1),
 .BR close (2),
-- 
2.30.0


  reply	other threads:[~2021-03-22 14:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 15:48 [man-pages][PATCH v1] flock.2: add CIFS details Aurélien Aptel
2021-03-03 15:37 ` Tom Talpey
2021-03-03 16:28   ` Aurélien Aptel
2021-03-03 16:37     ` [PATCH v2] " Aurélien Aptel
2021-03-03 18:08       ` Tom Talpey
2021-03-03 19:03         ` [PATCH v3] " Aurélien Aptel
2021-03-03 20:23           ` Tom Talpey
2021-03-04  9:48             ` Aurélien Aptel
2021-03-04  9:50               ` [PATCH v4] " Aurélien Aptel
2021-03-10 19:07                 ` Alejandro Colomar (man-pages)
2021-03-11 10:11                   ` Aurélien Aptel
2021-03-11 16:21                     ` Tom Talpey
2021-03-11 17:13                       ` Aurélien Aptel
2021-03-11 17:29                         ` Tom Talpey
2021-03-11 17:45                           ` Aurélien Aptel
2021-03-11 20:42                             ` Tom Talpey
2021-03-11 22:39                               ` Aurélien Aptel
2021-03-15 18:05                                 ` Pavel Shilovsky
2021-03-16 10:42                                   ` Aurélien Aptel
2021-03-16 17:39                                     ` Pavel Shilovsky
2021-03-16 19:42                                       ` Tom Talpey
2021-03-16 23:04                                         ` Pavel Shilovsky
2021-03-22 14:30                                           ` Aurélien Aptel [this message]
2021-04-09 12:13                                             ` [PATCH v5] " Aurélien Aptel
2021-04-11 19:12                                               ` Alejandro Colomar (man-pages)
2021-03-11 18:01                 ` [PATCH v4] " Matthew Wilcox
2021-03-03 16:48     ` [man-pages][PATCH v1] " Tom Talpey
2021-03-03 16:57       ` Aurélien Aptel
2021-03-03 17:41         ` Tom Talpey

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=20210322143024.13930-1-aaptel@suse.com \
    --to=aaptel@suse.com \
    --cc=alx.manpages@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=piastryyy@gmail.com \
    --cc=smfrench@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).