flock possibly missing in SMB3 POSIX extensions?

Aurélien Aptel aaptel at suse.com
Fri Mar 5 17:20:11 UTC 2021

Thanks for taking a look Jeremy.

Jeremy Allison <jra at samba.org> writes:
>>Indeed, from man 2 flock:

Side node: I've sent a patch to the flock(2) man page to include current
behaviour of CIFS.

> So the plan would be once a file is opened with a POSIX
> context, emulate flock(2) by getting a byte-range lock
> on the whole file. For a POSIX context this is an
> advisory lock.

Ok. I will update the wiki.

> This matches what NFS does, and applications using
> flock are usually not also using fcntl locks.

Matching NFS is sounds good, less cases to think about for users.

> I'd rather not add "special" extra flags to the
> protocol that need extra logic to implement. The
> locking part is complex enough in SMB1/2/3, and
> as NFS shows it's possible to emulate using advisory
> byte-range locks anyway.


> Of course this doesn't help SMB2+ without UNIX
> extensions, but there are many POSIX things that
> won't work there anyway :-).

If we can make SMB2+UNIX work as well as NFS that will already be nice :)

Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)

More information about the samba-technical mailing list