linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* move noatime and automount flags setting into common code
@ 2019-01-21 15:23 Christoph Hellwig
  2019-01-21 15:23 ` [PATCH 1/2] orangefs: don't reinitialize result_mask in ->getattr Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christoph Hellwig @ 2019-01-21 15:23 UTC (permalink / raw)
  To: Al Viro
  Cc: David Howells, Mike Marshall, Martin Brandenburg, linux-fsdevel,
	linux-xfs, devel

Hi Al,

can you take a look at this series that fixes incorrect attributes
reported for filesystems like XFS that don't use generic_filattr?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] orangefs: don't reinitialize result_mask in ->getattr
  2019-01-21 15:23 move noatime and automount flags setting into common code Christoph Hellwig
@ 2019-01-21 15:23 ` Christoph Hellwig
  2019-02-03 14:44   ` Mike Marshall
  2019-01-21 15:23 ` [PATCH 2/2] fs: move generic stat response attr handling to vfs_getattr_nosec Christoph Hellwig
  2019-01-31  7:40 ` move noatime and automount flags setting into common code Christoph Hellwig
  2 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2019-01-21 15:23 UTC (permalink / raw)
  To: Al Viro
  Cc: David Howells, Mike Marshall, Martin Brandenburg, linux-fsdevel,
	linux-xfs, devel

The caller already initializes it to the basic stats.  Just
clear not supported default bits where needed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/orangefs/inode.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index f038235c64bd..c3334eca18c7 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -261,11 +261,8 @@ int orangefs_getattr(const struct path *path, struct kstat *stat,
 		generic_fillattr(inode, stat);
 
 		/* override block size reported to stat */
-		if (request_mask & STATX_SIZE)
-			stat->result_mask = STATX_BASIC_STATS;
-		else
-			stat->result_mask = STATX_BASIC_STATS &
-			    ~STATX_SIZE;
+		if (!(request_mask & STATX_SIZE))
+			stat->result_mask &= ~STATX_SIZE;
 
 		stat->attributes_mask = STATX_ATTR_IMMUTABLE |
 		    STATX_ATTR_APPEND;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] fs: move generic stat response attr handling to vfs_getattr_nosec
  2019-01-21 15:23 move noatime and automount flags setting into common code Christoph Hellwig
  2019-01-21 15:23 ` [PATCH 1/2] orangefs: don't reinitialize result_mask in ->getattr Christoph Hellwig
@ 2019-01-21 15:23 ` Christoph Hellwig
  2019-01-31  7:40 ` move noatime and automount flags setting into common code Christoph Hellwig
  2 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2019-01-21 15:23 UTC (permalink / raw)
  To: Al Viro
  Cc: David Howells, Mike Marshall, Martin Brandenburg, linux-fsdevel,
	linux-xfs, devel

generic_fillattr is an optional helper that isn't used by all file
systems, move handling purely based on inode flags to vfs_getattr_nosec,
which is common code.

This fixes setting this flag for file systems not using generic_fillattr
like xfs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/stat.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/stat.c b/fs/stat.c
index adbfcd86c81b..c38e4c2e1221 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -45,11 +45,6 @@ void generic_fillattr(struct inode *inode, struct kstat *stat)
 	stat->ctime = inode->i_ctime;
 	stat->blksize = i_blocksize(inode);
 	stat->blocks = inode->i_blocks;
-
-	if (IS_NOATIME(inode))
-		stat->result_mask &= ~STATX_ATIME;
-	if (IS_AUTOMOUNT(inode))
-		stat->attributes |= STATX_ATTR_AUTOMOUNT;
 }
 EXPORT_SYMBOL(generic_fillattr);
 
@@ -75,6 +70,13 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
 	stat->result_mask |= STATX_BASIC_STATS;
 	request_mask &= STATX_ALL;
 	query_flags &= KSTAT_QUERY_FLAGS;
+
+	/* allow the fs to override these if it really wants to */
+	if (IS_NOATIME(inode))
+		stat->result_mask &= ~STATX_ATIME;
+	if (IS_AUTOMOUNT(inode))
+		stat->attributes |= STATX_ATTR_AUTOMOUNT;
+
 	if (inode->i_op->getattr)
 		return inode->i_op->getattr(path, stat, request_mask,
 					    query_flags);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: move noatime and automount flags setting into common code
  2019-01-21 15:23 move noatime and automount flags setting into common code Christoph Hellwig
  2019-01-21 15:23 ` [PATCH 1/2] orangefs: don't reinitialize result_mask in ->getattr Christoph Hellwig
  2019-01-21 15:23 ` [PATCH 2/2] fs: move generic stat response attr handling to vfs_getattr_nosec Christoph Hellwig
@ 2019-01-31  7:40 ` Christoph Hellwig
  2019-02-01  6:56   ` Al Viro
  2 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2019-01-31  7:40 UTC (permalink / raw)
  To: Al Viro
  Cc: David Howells, Mike Marshall, Martin Brandenburg, linux-fsdevel,
	linux-xfs, devel

On Mon, Jan 21, 2019 at 04:23:24PM +0100, Christoph Hellwig wrote:
> Hi Al,
> 
> can you take a look at this series that fixes incorrect attributes
> reported for filesystems like XFS that don't use generic_filattr?

Al,

can you pick this up?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: move noatime and automount flags setting into common code
  2019-01-31  7:40 ` move noatime and automount flags setting into common code Christoph Hellwig
@ 2019-02-01  6:56   ` Al Viro
  0 siblings, 0 replies; 6+ messages in thread
From: Al Viro @ 2019-02-01  6:56 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: David Howells, Mike Marshall, Martin Brandenburg, linux-fsdevel,
	linux-xfs, devel

On Thu, Jan 31, 2019 at 08:40:47AM +0100, Christoph Hellwig wrote:
> On Mon, Jan 21, 2019 at 04:23:24PM +0100, Christoph Hellwig wrote:
> > Hi Al,
> > 
> > can you take a look at this series that fixes incorrect attributes
> > reported for filesystems like XFS that don't use generic_filattr?
> 
> Al,
> 
> can you pick this up?

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] orangefs: don't reinitialize result_mask in ->getattr
  2019-01-21 15:23 ` [PATCH 1/2] orangefs: don't reinitialize result_mask in ->getattr Christoph Hellwig
@ 2019-02-03 14:44   ` Mike Marshall
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Marshall @ 2019-02-03 14:44 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Al Viro, David Howells, Martin Brandenburg, linux-fsdevel,
	linux-xfs, devel

It looks good to both Martin and I, and runs fine through xfstests...
you can add Signed-off-by: Mike Marshall <hubcap@omnibond.com>

-Mike "is there a finally-signed-off-by tag?"


On Mon, Jan 21, 2019 at 10:23 AM Christoph Hellwig <hch@lst.de> wrote:
>
> The caller already initializes it to the basic stats.  Just
> clear not supported default bits where needed.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/orangefs/inode.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
> index f038235c64bd..c3334eca18c7 100644
> --- a/fs/orangefs/inode.c
> +++ b/fs/orangefs/inode.c
> @@ -261,11 +261,8 @@ int orangefs_getattr(const struct path *path, struct kstat *stat,
>                 generic_fillattr(inode, stat);
>
>                 /* override block size reported to stat */
> -               if (request_mask & STATX_SIZE)
> -                       stat->result_mask = STATX_BASIC_STATS;
> -               else
> -                       stat->result_mask = STATX_BASIC_STATS &
> -                           ~STATX_SIZE;
> +               if (!(request_mask & STATX_SIZE))
> +                       stat->result_mask &= ~STATX_SIZE;
>
>                 stat->attributes_mask = STATX_ATTR_IMMUTABLE |
>                     STATX_ATTR_APPEND;
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-03 14:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21 15:23 move noatime and automount flags setting into common code Christoph Hellwig
2019-01-21 15:23 ` [PATCH 1/2] orangefs: don't reinitialize result_mask in ->getattr Christoph Hellwig
2019-02-03 14:44   ` Mike Marshall
2019-01-21 15:23 ` [PATCH 2/2] fs: move generic stat response attr handling to vfs_getattr_nosec Christoph Hellwig
2019-01-31  7:40 ` move noatime and automount flags setting into common code Christoph Hellwig
2019-02-01  6:56   ` Al Viro

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).