Orangefs only handles STATX_BASIC_STATS in its getattr implementation, so
mask off all other flags. Not doing so results in statx(2) forcing a
refresh of cached attributes on any other requested flag (i.e. STATX_BTIME
currently) due to the following test in orangefs_inode_getattr():
(request_mask & orangefs_inode->getattr_mask) == request_mask
Also clean up gratuitous uses of STATX_ALL.
Signed-off-by: Miklos Szeredi <redacted>
Cc: Mike Marshall <hubcap@omnibond.com>
Cc: Martin Brandenburg <martin@omnibond.com>
---
fs/orangefs/inode.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
@@ -256,7 +256,8 @@ int orangefs_getattr(const struct path *path, struct kstat *stat,"orangefs_getattr: called on %pd\n",path->dentry);-ret=orangefs_inode_getattr(inode,0,0,request_mask);+ret=orangefs_inode_getattr(inode,0,0,+request_mask&STATX_BASIC_STATS);if(ret==0){generic_fillattr(inode,stat);
FUSE will want to know if stx_attributes is interesting or not, because
there's a non-zero cost of retreiving it.
This is more of a "want" flag, since stx_attributes_mask already indicates
whether we "got" stx_attributes or not. So for now we can just deal with
this flag in the generic code.
Signed-off-by: Miklos Szeredi <redacted>
Cc: David Howells <dhowells@redhat.com>
Cc: Michael Kerrisk <redacted>
---
fs/stat.c | 3 +++
include/uapi/linux/stat.h | 1 +
samples/statx/test-statx.c | 2 +-
tools/include/uapi/linux/stat.h | 1 +
4 files changed, 6 insertions(+), 1 deletion(-)
Constants of the *_ALL type can be actively harmful due to the fact that
developers will usually fail to consider the possible effects of future
changes to the definition.
Remove STATX_ALL from the uapi, while no damage has been done yet.
We could keep something like this around in the kernel, but there's
actually no point, since all filesystems should be explicitly checking
flags that they support and not rely on the VFS masking unknown ones out: a
flag could be known to the VFS, yet not known to the filesystem (see
orangefs bug fixed in the previous patch).
Signed-off-by: Miklos Szeredi <redacted>
Cc: David Howells <dhowells@redhat.com>
Cc: Michael Kerrisk <redacted>
---
fs/stat.c | 1 -
include/uapi/linux/stat.h | 2 +-
samples/statx/test-statx.c | 2 +-
tools/include/uapi/linux/stat.h | 2 +-
4 files changed, 3 insertions(+), 4 deletions(-)
From: Amir Goldstein <amir73il@gmail.com> Date: 2018-10-18 22:53:27
On Thu, Oct 18, 2018 at 4:11 PM Miklos Szeredi [off-list ref] wrote:
Constants of the *_ALL type can be actively harmful due to the fact that
developers will usually fail to consider the possible effects of future
changes to the definition.
Remove STATX_ALL from the uapi, while no damage has been done yet.
Look. When Linus says "let's see if somebody notices" and referring to ABI
it means sooner or later someone will upgrade to newer kernel and complain
if something breaks.
But what does it mean with UAPI change?
How often do people re-build existing programs?
I, for one, build master for my testing, but never install uapi
headers from master.
I just can't wrap my head around the backward compatibiltiy nightmare a change
like this could create.
How about just leave STATX_ALL in uapi header to rot forever
mark it with a "deprecated" comment and #undef it out in include/linux/stat.h,
so we can't use it in the kernel anymore.
No use experimenting with pain.
BTW, man page needs to be fixes as well, because man page promotes
STATX_ALL.
Thanks,
Amir.
From: David Howells <dhowells@redhat.com> Date: 2018-10-18 23:18:18
Miklos Szeredi [off-list ref] wrote:
Constants of the *_ALL type can be actively harmful due to the fact that
developers will usually fail to consider the possible effects of future
changes to the definition.
Remove STATX_ALL from the uapi, while no damage has been done yet.
You don't know that someone's not using it. It's been there a year and a
half, long enough. So, regretfully, I don't think we can remove it at this
point.
David
On Thu, Oct 18, 2018 at 03:11:23PM +0200, Miklos Szeredi wrote:
Orangefs only handles STATX_BASIC_STATS in its getattr implementation, so
mask off all other flags. Not doing so results in statx(2) forcing a
refresh of cached attributes on any other requested flag (i.e. STATX_BTIME
currently) due to the following test in orangefs_inode_getattr():
(request_mask & orangefs_inode->getattr_mask) == request_mask
Also clean up gratuitous uses of STATX_ALL.
Signed-off-by: Miklos Szeredi <redacted>
Cc: Mike Marshall <hubcap@omnibond.com>
Cc: Martin Brandenburg <martin@omnibond.com>
Reviewed-by: Martin Brandenburg <martin@omnibond.com>
@@ -256,7 +256,8 @@ int orangefs_getattr(const struct path *path, struct kstat *stat,"orangefs_getattr: called on %pd\n",path->dentry);-ret=orangefs_inode_getattr(inode,0,0,request_mask);+ret=orangefs_inode_getattr(inode,0,0,+request_mask&STATX_BASIC_STATS);if(ret==0){generic_fillattr(inode,stat);
From: Andreas Dilger <hidden> Date: 2018-10-19 09:52:46
On Oct 18, 2018, at 7:11 AM, Miklos Szeredi [off-list ref] wrote:
FUSE will want to know if stx_attributes is interesting or not, because
there's a non-zero cost of retreiving it.
This is more of a "want" flag, since stx_attributes_mask already indicates
whether we "got" stx_attributes or not. So for now we can just deal with
this flag in the generic code.
Signed-off-by: Miklos Szeredi <redacted>
Cc: David Howells <dhowells@redhat.com>
Cc: Michael Kerrisk <redacted>
From: Andreas Dilger <hidden> Date: 2018-10-19 10:30:00
On Oct 18, 2018, at 7:11 AM, Miklos Szeredi [off-list ref] wrote:
Constants of the *_ALL type can be actively harmful due to the fact that
developers will usually fail to consider the possible effects of future
changes to the definition.
Remove STATX_ALL from the uapi, while no damage has been done yet.
We could keep something like this around in the kernel, but there's
actually no point, since all filesystems should be explicitly checking
flags that they support and not rely on the VFS masking unknown ones out: a
flag could be known to the VFS, yet not known to the filesystem (see
orangefs bug fixed in the previous patch).
What is actually strange is that the vfs_getattr_nosec() code is setting
stat->result_mask = STATX_BASIC_STATS;
in the code before any of the filesystem ->getattr methods are called.
That means it is up to the filesystems to actively *clear* flags from
the result_mask as opposed to only *setting* flags for fields that it
is filling in. That seems a bit backward to me?
It looks like NFS is _probably_ doing the right thing, though it is still
using the userspace-supplied request_mask as a mask for the bits being
returned, but the saving grace is that result_mask is STATX_BASIC_STATS
set by vfs_getattr_nosec() AFAICS.
Looking at OCFS2, CIFS, GFS2, they are doing a full inode revalidation
and returning the basic stats without looking at flags, request_mask,
or result_mask at all, so I'd expect they could be more efficient
(i.e. not revalidating the inode and possibly doing an RPC at all if
only some minimal flags are requested, or if AT_STATX_FORCE_SYNC is
not set).
It looks like overlayfs, nfsd, and fuse at least (as statx callers)
are often requesting a small subset of flags (e.g. STATX_INO,
STATX_NLINK, STATX_ATIME | STATX_MTIME, etc.) so they could be more
efficient if the underlying filesystems did only what was asked.
Cheers, Andreas