Can anyone explain how O_TRUNC is handled (open2)? When I try to open
an
existing file with this flag, the FSAL_O_TRUNC in openflags is not enabled in my
FSAL open2 fct.
While capturing with tcpdump, the NFS client actually sends a OPEN then
SETATTR with size = 0 but not ctime.
If the client is sending a separate SETATTR to set the size to 0, then open2 definitely
won't get the FSAL_O_TRUNC flag (we treat each NFS4 op in a compound separately).
By looking at an example in open_by_handle, if IIUC if the flag
O_TRUNC is
there, we refresh the attrs by calling getattrs to attrs_out, I do not understand
that, why it does that instead of calling setattrs ?
Hmm, MDCACHE should use attrs_out to refresh the attributes on open_by_handle if they are
valid.
I'm not quite sure about the reference to setattrs. It is assumed that the FSAL will
handle FSAL_O_TRUNC in the open2 call (even if IT needs to do a separate setattrs from its
open call).
Frank