Skip to contentSkip to conversation

move noatime and automount flags setting into common code

PATCH In review Christoph Hellwig 3 participants 6 messages Jan 21, 2019 – Feb 3, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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?

#1 lore raw

PATCH 1/2 orangefs: don't reinitialize result_mask in ->getattr

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

---
 fs/orangefs/inode.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
fs/orangefs/inode.c +2 -5
index f038235c64bd..c3334eca18c7 100644
@@ -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;
Signature · 1 line
2.20.1
maintainer
#2 lore raw

Re: [PATCH 1/2] orangefs: don't reinitialize result_mask in ->getattr

It looks good to both Martin and I, and runs fine through xfstests... you can add Signed-off-by: Mike Marshall <[email protected]>

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

Quoted 30 lines · Christoph Hellwig

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

---
 fs/orangefs/inode.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
fs/orangefs/inode.c +2 -6
index f038235c64bd..c3334eca18c7 100644
@@ -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

#3 lore raw

PATCH 2/2 fs: move generic stat response attr handling to vfs_getattr_nosec

In reply to Christoph Hellwig

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.

---
 fs/stat.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
fs/stat.c +7 -5
index adbfcd86c81b..c38e4c2e1221 100644
@@ -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);
Signature · 1 line
2.20.1
#4 lore raw
In reply to Christoph Hellwig
Quoted 4 lines · Christoph Hellwig

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?

maintainer Applied
#5 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Christoph Hellwig

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.