Linux kernel LOCK_MAND deprecation

Jeff Layton jlayton at
Mon Sep 13 14:02:01 UTC 2021

I recently proposed a patch to remove most of the support for
flock(..., LOCK_MAND...) from the Linux kernel. The code in question has
been broken for well over a decade, such that trying to use LOCK_MAND
flock locks is really just a no-op:

Samba references that symbol in kernel_flock(). I started to take a look
at removing the code from samba, but the work kind of snowballed with
all of the wrappers and indirection.

Would anyone who is actively working on samba want to take a stab at
removing kernel_flock()? It should be safe to just rip it out since it
hasn't worked in ages.

If it's not removed, then you may see kernel warnings on Linux when
samba tries to set a LOCK_MAND lock, a'la:

   pr_warn_once("Attempt to set a LOCK_MAND lock via flock(2). This support has been removed and the request ignored.\n");

Jeff Layton <jlayton at>

More information about the samba-technical mailing list