Cleanly determining in a VFS function that it was called in the context of CREATE
jra at samba.org
Thu Feb 4 18:57:35 UTC 2016
On Tue, Feb 02, 2016 at 09:37:09AM -0800, Richard Sharpe wrote:
> Hi folks,
> For an on-line migration thing I am working on I need to cleanly
> determine in a VFS function like mywrapped_stat that I was called in
> the context of CREATE.
> This is because Samba calls SMB_VFS_STAT with gay abandon ...
> If I hook stat in the right place, there is no extra cost in the
> common case (the file being present) and all the cost goes into the
> error path and the uncommon case of the file needing to be migrated.
> Now, one way I can think to do this is to add a PRE_CREATE VFS call
> that is called before Samba calls filename_convert so that I can stash
> some info away.
> Is there another way that is clean?
Can't you add some temporary state on the connection
struct inside your VFS_CREATE handler that you then
look for inside VFS_STAT if you get an error case ?
Or do you need to know for the stat calls being made
on pathname validation before we go into the VFS_CREATE ?
More information about the samba-technical