Skip to contentSkip to conversation

xfs: reinstate the old i_version counter as STATX_CHANGE_COOKIE

PATCH In review Jeff Layton 3 participants 6 messages Sep 29, 2023 – Oct 12, 2023

Subsystems (4)
lore
Share & tools
lore

Jeff Layton

author maintainer
#0 lore raw

PATCH 1/1 xfs: reinstate the old i_version counter as STATX_CHANGE_COOKIE

The handling of STATX_CHANGE_COOKIE was moved into generic_fillattr in commit 0d72b92883c6 (fs: pass the request_mask to generic_fillattr), but we didn't account for the fact that xfs doesn't call generic_fillattr at all.

Make XFS report its i_version as the STATX_CHANGE_COOKIE.

Fixes 0d72b92883c6 (fs: pass the request_mask to generic_fillattr)

---
I had hoped to fix this in a better way with the multigrain patches, but it's taking longer than expected (if it even pans out at this point).

Until then, make sure we use XFS's i_version as the STATX_CHANGE_COOKIE, even if it's bumped due to atime updates. Too many invalidations is preferable to not enough.

---
 fs/xfs/xfs_iops.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/xfs/xfs_iops.c +5 -0
index 1c1e6171209d..2b3b05c28e9e 100644
@@ -584,6 +584,11 @@ xfs_vn_getattr(
 		}
 	}
 
+	if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) {
+		stat->change_cookie = inode_query_iversion(inode);
+		stat->result_mask |= STATX_CHANGE_COOKIE;
+	}
+
 	/*
 	 * Note: If you add another clause to set an attribute flag, please
 	 * update attributes_mask below.

---
base-commit: df964ce9ef9fea10cf131bf6bad8658fde7956f6
change-id: 20230929-xfs-iversion-819fa2c18591

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
author maintainer
#1 lore raw
Quoted 41 lines · Jeff Layton

The handling of STATX_CHANGE_COOKIE was moved into generic_fillattr in commit 0d72b92883c6 (fs: pass the request_mask to generic_fillattr), but we didn't account for the fact that xfs doesn't call generic_fillattr at all.

Make XFS report its i_version as the STATX_CHANGE_COOKIE.

Fixes 0d72b92883c6 (fs: pass the request_mask to generic_fillattr)

---
I had hoped to fix this in a better way with the multigrain patches, but it's taking longer than expected (if it even pans out at this point).

Until then, make sure we use XFS's i_version as the STATX_CHANGE_COOKIE, even if it's bumped due to atime updates. Too many invalidations is preferable to not enough.

---
 fs/xfs/xfs_iops.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/xfs/xfs_iops.c +5 -1
index 1c1e6171209d..2b3b05c28e9e 100644
@@ -584,6 +584,11 @@ xfs_vn_getattr(
 		}
 	}
 
+	if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) {
+		stat->change_cookie = inode_query_iversion(inode);
+		stat->result_mask |= STATX_CHANGE_COOKIE;
+	}
+
 	/*
 	 * Note: If you add another clause to set an attribute flag, please
 	 * update attributes_mask below.
 
---

base-commit: df964ce9ef9fea10cf131bf6bad8658fde7956f6
change-id: 20230929-xfs-iversion-819fa2c18591

Quoted 1 line

Best regards,

Ping?

This patch is needed in v6.6 to prevent a regression when serving XFS via NFSD. I'd prefer this go in via the xfs tree, but let me know if you need me to get this merged this via a different one.

Thanks,

Signature · 1 line
Jeff Layton <[email protected]>
Reviewed-by
#2 lore raw
Quoted 42 lines · Jeff Layton
Quoted 41 lines · Jeff Layton

The handling of STATX_CHANGE_COOKIE was moved into generic_fillattr in commit 0d72b92883c6 (fs: pass the request_mask to generic_fillattr), but we didn't account for the fact that xfs doesn't call generic_fillattr at all.

Make XFS report its i_version as the STATX_CHANGE_COOKIE.

Fixes 0d72b92883c6 (fs: pass the request_mask to generic_fillattr)

---
I had hoped to fix this in a better way with the multigrain patches, but it's taking longer than expected (if it even pans out at this point).

Until then, make sure we use XFS's i_version as the STATX_CHANGE_COOKIE, even if it's bumped due to atime updates. Too many invalidations is preferable to not enough.

---
 fs/xfs/xfs_iops.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/xfs/xfs_iops.c +5 -1
index 1c1e6171209d..2b3b05c28e9e 100644
@@ -584,6 +584,11 @@ xfs_vn_getattr(
 		}
 	}
 
+	if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) {
+		stat->change_cookie = inode_query_iversion(inode);
+		stat->result_mask |= STATX_CHANGE_COOKIE;
+	}
+
 	/*
 	 * Note: If you add another clause to set an attribute flag, please
 	 * update attributes_mask below.
 
---

base-commit: df964ce9ef9fea10cf131bf6bad8658fde7956f6
change-id: 20230929-xfs-iversion-819fa2c18591

Quoted 7 lines
Quoted 1 line

Best regards,

Ping?

This patch is needed in v6.6 to prevent a regression when serving XFS via NFSD. I'd prefer this go in via the xfs tree, but let me know if you need me to get this merged this via a different one.

Oh! Right, this is needed because the "hide a state in the high bit of
tv_nsec" stuff got reverted in -rc3, correct? So now nfsd needs some way to know that something changed in the file, and better to have too many client invalidations than not enough? And I guess bumping i_version will keep nfsd sane for now?

If the answers are [yes, yes, yes] then:

--D

Quoted 3 lines

Thanks,

Signature · 1 line
Jeff Layton <[email protected]>
author maintainer
#3 lore raw
Quoted 51 lines · Darrick J. Wong
Quoted 42 lines · Jeff Layton
Quoted 41 lines · Jeff Layton

The handling of STATX_CHANGE_COOKIE was moved into generic_fillattr in commit 0d72b92883c6 (fs: pass the request_mask to generic_fillattr), but we didn't account for the fact that xfs doesn't call generic_fillattr at all.

Make XFS report its i_version as the STATX_CHANGE_COOKIE.

Fixes 0d72b92883c6 (fs: pass the request_mask to generic_fillattr)

---
I had hoped to fix this in a better way with the multigrain patches, but it's taking longer than expected (if it even pans out at this point).

Until then, make sure we use XFS's i_version as the STATX_CHANGE_COOKIE, even if it's bumped due to atime updates. Too many invalidations is preferable to not enough.

---
 fs/xfs/xfs_iops.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/xfs/xfs_iops.c +5 -1
index 1c1e6171209d..2b3b05c28e9e 100644
@@ -584,6 +584,11 @@ xfs_vn_getattr(
 		}
 	}
 
+	if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) {
+		stat->change_cookie = inode_query_iversion(inode);
+		stat->result_mask |= STATX_CHANGE_COOKIE;
+	}
+
 	/*
 	 * Note: If you add another clause to set an attribute flag, please
 	 * update attributes_mask below.
 
---

base-commit: df964ce9ef9fea10cf131bf6bad8658fde7956f6
change-id: 20230929-xfs-iversion-819fa2c18591

Quoted 7 lines
Quoted 1 line

Best regards,

Ping?

This patch is needed in v6.6 to prevent a regression when serving XFS via NFSD. I'd prefer this go in via the xfs tree, but let me know if you need me to get this merged this via a different one.

Quoted 8 lines

Oh! Right, this is needed because the "hide a state in the high bit of
tv_nsec" stuff got reverted in -rc3, correct? So now nfsd needs some way to know that something changed in the file, and better to have too many client invalidations than not enough? And I guess bumping i_version will keep nfsd sane for now?

If the answers are [yes, yes, yes] then:

Yes, yes, and yes. Can you guys shepherd this into mainline?

Thanks for the R-b!

Signature · 1 line
Jeff Layton <[email protected]>
#4 lore raw
Quoted 58 lines · Jeff Layton
Quoted 57 lines · Darrick J. Wong
Quoted 42 lines · Jeff Layton
Quoted 41 lines · Jeff Layton

The handling of STATX_CHANGE_COOKIE was moved into generic_fillattr in commit 0d72b92883c6 (fs: pass the request_mask to generic_fillattr), but we didn't account for the fact that xfs doesn't call generic_fillattr at all.

Make XFS report its i_version as the STATX_CHANGE_COOKIE.

Fixes 0d72b92883c6 (fs: pass the request_mask to generic_fillattr)

---
I had hoped to fix this in a better way with the multigrain patches, but it's taking longer than expected (if it even pans out at this point).

Until then, make sure we use XFS's i_version as the STATX_CHANGE_COOKIE, even if it's bumped due to atime updates. Too many invalidations is preferable to not enough.

---
 fs/xfs/xfs_iops.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/xfs/xfs_iops.c +5 -1
index 1c1e6171209d..2b3b05c28e9e 100644
@@ -584,6 +584,11 @@ xfs_vn_getattr(
 		}
 	}
 
+	if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) {
+		stat->change_cookie = inode_query_iversion(inode);
+		stat->result_mask |= STATX_CHANGE_COOKIE;
+	}
+
 	/*
 	 * Note: If you add another clause to set an attribute flag, please
 	 * update attributes_mask below.
 
---

base-commit: df964ce9ef9fea10cf131bf6bad8658fde7956f6
change-id: 20230929-xfs-iversion-819fa2c18591

Quoted 7 lines
Quoted 1 line

Best regards,

Ping?

This patch is needed in v6.6 to prevent a regression when serving XFS via NFSD. I'd prefer this go in via the xfs tree, but let me know if you need me to get this merged this via a different one.

Oh! Right, this is needed because the "hide a state in the high bit of
tv_nsec" stuff got reverted in -rc3, correct? So now nfsd needs some way to know that something changed in the file, and better to have too many client invalidations than not enough? And I guess bumping i_version will keep nfsd sane for now?

Quoted 4 lines
Quoted 2 lines

If the answers are [yes, yes, yes] then:

Yes, yes, and yes. Can you guys shepherd this into mainline?

Chandan, can you queue this (and the other xfs fixes I sent) for -rc6?

--D

Quoted 4 lines

Thanks for the R-b!

Signature · 1 line
Jeff Layton <[email protected]>
#5 lore raw
Quoted 59 lines · Darrick J. Wong
Quoted 58 lines · Jeff Layton
Quoted 57 lines · Darrick J. Wong
Quoted 42 lines · Jeff Layton
Quoted 41 lines · Jeff Layton

The handling of STATX_CHANGE_COOKIE was moved into generic_fillattr in commit 0d72b92883c6 (fs: pass the request_mask to generic_fillattr), but we didn't account for the fact that xfs doesn't call generic_fillattr at all.

Make XFS report its i_version as the STATX_CHANGE_COOKIE.

Fixes 0d72b92883c6 (fs: pass the request_mask to generic_fillattr)

---
I had hoped to fix this in a better way with the multigrain patches, but it's taking longer than expected (if it even pans out at this point).

Until then, make sure we use XFS's i_version as the STATX_CHANGE_COOKIE, even if it's bumped due to atime updates. Too many invalidations is preferable to not enough.

---
 fs/xfs/xfs_iops.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/xfs/xfs_iops.c +5 -1
index 1c1e6171209d..2b3b05c28e9e 100644
@@ -584,6 +584,11 @@ xfs_vn_getattr(
 		}
 	}
 
+	if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) {
+		stat->change_cookie = inode_query_iversion(inode);
+		stat->result_mask |= STATX_CHANGE_COOKIE;
+	}
+
 	/*
 	 * Note: If you add another clause to set an attribute flag, please
 	 * update attributes_mask below.
 
---

base-commit: df964ce9ef9fea10cf131bf6bad8658fde7956f6
change-id: 20230929-xfs-iversion-819fa2c18591

Quoted 7 lines
Quoted 1 line

Best regards,

Ping?

This patch is needed in v6.6 to prevent a regression when serving XFS via NFSD. I'd prefer this go in via the xfs tree, but let me know if you need me to get this merged this via a different one.

Oh! Right, this is needed because the "hide a state in the high bit of
tv_nsec" stuff got reverted in -rc3, correct? So now nfsd needs some way to know that something changed in the file, and better to have too many client invalidations than not enough? And I guess bumping i_version will keep nfsd sane for now?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

If the answers are [yes, yes, yes] then:

Yes, yes, and yes. Can you guys shepherd this into mainline?

Chandan, can you queue this (and the other xfs fixes I sent) for -rc6?

I have pulled in your fixes and also the current patch. I will have to execute fstests for atleast one day before updating xfs-linux's for-next branch.

Signature · 1 line
Chandan