linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: Andreas Dilger <adilger@dilger.ca>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>,
	David Howells <dhowells@redhat.com>,
	Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux API <linux-api@vger.kernel.org>
Subject: Re: statx(2) API and documentation
Date: Wed, 17 Oct 2018 21:04:37 +0200	[thread overview]
Message-ID: <CAJfpeguvJZbP83mSULc74Yhpp_CPMBW1XvcgbvCbLnF7QCncUA@mail.gmail.com> (raw)
In-Reply-To: <006890C4-64D4-4DE2-A1F0-335FFFD585BB@dilger.ca>

On Wed, Oct 17, 2018 at 8:45 PM, Andreas Dilger <adilger@dilger.ca> wrote:
> On Oct 17, 2018, at 12:24 PM, Miklos Szeredi <miklos@szeredi.hu> wrote:
>>
>> I'm trying to implement statx for fuse and ran into the following issues:
>>
>> - Need a STATX_ATTRIBUTES bit, so that userspace can explicitly ask
>> for stx_attribute; otherwise if querying has non-zero cost, then
>> filesystem cannot do it without regressing performance.
>
> Seems reasonable.
>
>> - STATX_ALL definition is unclear, can this change, or is it fixed?
>> If it's the former, than that's a backward compatibility nightmare.
>> If it's the latter, then what's the point?
>
> The value can change over time.  It is intended to reflect the current
> state of affairs at the time the userspace program and kernel are compiled.
> The value sent from userspace lets the kernel know what fields are in
> the userspace struct, so it doesn't try to set fields that aren't there.

What's the point of a userspace program specifying STATX_ALL?  Without
a way to programmatically query the interface definition it's useless:
there's no way to guess which mask bit corresponds to which field, and
what that field represents.

And there will be programs out there which specify STATX_ALL without
considering that in the future it may become slower as it is now due
to a recompile.

So what's the point exactly?

> The value in the kernel allows masking off new fields from userspace that
> it doesn't understand.

Okay, but that has nothing to do with the UAPI.  Even as an internal
flag we should be careful, as it might grow uses which can have
similar issues as the userspace one above.

>
>> - STATX_ATIME is cleared from stx_mask on SB_RDONLY, and on NFS it is
>> also cleared on MNT_NOATIME, but not on MNT_RDONLY.  We need some sort
>> of guideline in the documentation about what constitutes
>> "unsupported": does atime become unsupported because filesystem is
>> remounted r/o?  If so, why isn't this case handled consistently in the
>> VFS and filesystems?
>
> Strange.  I'd think that if userspace is requesting atime, it should
> get an atime value.  The fact that the kernel is not updating atime
> due to mount options just means that atime might be old.  That doesn't
> mean (IMHO) that atime doesn't exist.

Right, OTOH I sort of see the value in  NFS: no roundtrip to server if
atime value is useless anyway.

>> - What about fields that are not cached when statx() is called with
>> AT_STATX_DONT_SYNC?  E.g. stx_btime is supported by the filesystem,
>> but getting it requires a roundtrip to the server.  Requesting
>> STATX_BTIME in the mask and adding  AT_STATX_DONT_SYNC to the flags
>> means the filesystem has to decide which it will honor.   My feeling
>> is that it should honor AT_STATX_DONT_SYNC and clear STATX_BTIME in
>> stx_mask.   Documentation has no word about this case.
>
> The btime value shouldn't change over the lifetime of a file, so
> DONT_SYNC shouldn't have any effect on its validity?

Not validity, but presence in the cache.  Network filesystem or fuse
may or may not have it available in the cache at the time the inode is
first initialized on loookup.  So when statx(..., AT_STATX_DONT_SYNC,
STATX_BTIME) comes along, it may need a roundtrip to the server.  What
should it do?

Thanks,
Miklos

  reply	other threads:[~2018-10-17 19:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 18:24 statx(2) API and documentation Miklos Szeredi
2018-10-17 18:45 ` Andreas Dilger
2018-10-17 19:04   ` Miklos Szeredi [this message]
2018-10-17 20:22     ` Andreas Dilger
2018-10-17 22:22       ` Florian Weimer
2018-10-18  7:37         ` Miklos Szeredi
2018-10-18  7:39           ` Florian Weimer
2018-10-18  7:42             ` Miklos Szeredi
2018-10-18  7:23       ` Miklos Szeredi
2018-10-17 22:15     ` Amir Goldstein
2018-10-18  7:41       ` Jan Kara
2018-10-18  7:49         ` Florian Weimer
2018-10-18 16:04 ` David Howells
2018-10-18 20:21   ` Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJfpeguvJZbP83mSULc74Yhpp_CPMBW1XvcgbvCbLnF7QCncUA@mail.gmail.com \
    --to=miklos@szeredi.hu \
    --cc=adilger@dilger.ca \
    --cc=dhowells@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).