[PATCH] flock() files even with a permissive share mode.

J. Bruce Fields bfields at fieldses.org
Fri Feb 8 15:23:06 UTC 2019


On Fri, Feb 08, 2019 at 08:20:06AM -0500, Jeff Layton wrote:
> On Fri, 2019-02-08 at 11:32 +0100, Volker Lendecke via samba-technical
> wrote:
> > Samba right now is designed to have a fd per client-requested open.
> > One reason is that we do the kernel access check every time the open
> > comes in. We don't share os-level fd's across different protocol-level
> > open-handles. To change this we'd need a call that changes a RDONLY fd
> > to a RDWR one on the fly as a start.
> 
> I could envision a new fcntl call that allowed that, but it would take
> significant vfs-layer work to get it into the kernel.

knfsd used to do that--it would take an existing read-only struct file
and call get_write_access(), mnt_want_write(), and modify f_mode.  That
seemed really dubious, so I moved to the current model with shared
opens:

	f9d7562fdb9dc "nfsd4: share file descriptors between stateid's"

That code's fussy and required a lot of bugfixing.  Sometimes I wonder
if I should have stuck with the open-upgrade approach and tried to move
that into the VFS and fix up any problems.....

--b.



More information about the samba-technical mailing list