flock.2: add CIFS details

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>
Discussion: linux-man <https://lore.kernel.org/linux-man/20210302154831.17000-1-aaptel@suse.com/>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Aurelien Aptel 2021-05-09 22:19:34 +02:00 committed by Michael Kerrisk
parent dffa597887
commit 334ed9799d
1 changed files with 25 additions and 0 deletions

View File

@ -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),