Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available
From: Andreas Dilger
Date: Fri Nov 18 2016 - 04:24:29 EST
On Nov 18, 2016, at 1:59 AM, David Howells <dhowells@xxxxxxxxxx> wrote:
>
> Andreas Dilger <adilger@xxxxxxxxx> wrote:
>
>>>> If neither AT_STATX_*_SYNC flag is set, the behaviour is the default for
>>>> stat() on that filesystem.
>>>
>>> We also need to specify here what happens if both bits are set. Should
>>> that be -EINVAL?
>>
>> If that is the case, then it doesn't make sense to have two contradictory
>> flags.
>
> Yes it does. There are actually *three* cases, not two. Maybe, rather
> than a pair of flags, I should stake out a 2-bit field with three possible
> values.
That would probably be better in this case.
>> Pick a default behaviour (i.e. return what is known on the client),
>
> The default behaviour has to be what stat() does now for any particular
> filesystem. statx() is likely to get used to emulate stat() so that stat()
> can be made to return safe timestamps. If we make it so that statx() cannot
> do this, it's very likely that we'll see yet another stat() variant syscall
> being added.
>
>> and if this is 100% accurate (e.g. local filesystem or filesystem with
>> strong coherency)
>
> In a netfs, it was 100% accurate at the point the server started
> transmitting its reply. This may no longer be true - even with something
> like AFS that has change notifications.
Sure, that is always true, even when running with a local filesystem.
My distinction here is "whether the client currently has a lock that
ensures its copy of the size is correct" vs. "the client has some size
that was correct at one point but may be totally incorrect now".
>> then it can optionally set the SYNC flag in the returned
>> flags.
>
> So you suggest putting the SYNC flag(s) in the request mask rather than
> sharing the AT_* flag space?
Sorry, I was conflating flags.
>> If the application needs 100% accurate size info, then it can set the SYNC
>> flag in the request and the filesystem may need to do extra work to fetch
>> accurate data from the server.
>
> Note that one of the things that people asked for was a
> DONT_GO_TO_THE_SERVER_AT_ALL flag. I take it this is your suggested default?
Isn't that what NFS does today?
In any case, I'm not trying to rewrite NFS semantics here. The main fix
would be to have the three-valued two-bit flag so that there aren't two
flags that mean opposite things. That would also allow expansion to have
a fourth state in the future, if there was a need.
Cheers, Andreas
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail