NFS: fix nfs_fetch_iversion()
Subsystems (2)
[email protected]
maintainerPATCH 1/1 NFS: fix nfs_fetch_iversion()
From: Trond Myklebust <[email protected]>
The change attribute is always set by all NFS client versions so get rid of the open-coded version.
--- fs/nfs/export.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
fs/nfs/export.c +4 -11
@@ -171,17 +171,10 @@ static u64 nfs_fetch_iversion(struct inode *inode) {struct nfs_server *server =NFS_SERVER (inode); -/* Is this the right call?: */ -nfs_revalidate_inode (server, inode); -/* -* Also, note we're ignoring any returned error. That seems to be -* the practice for cache consistency information elsewhere in -* the server, but I'm not sure why. -*/ -if (server->nfs_client->rpc_ops->version >=4 ) -return inode_peek_iversion_raw (inode); -else -return time_to_chattr (&inode->i_ctime); +if (nfs_check_cache_invalid (inode,NFS_INO_INVALID_CHANGE | +NFS_INO_REVAL_PAGECACHE )) +__nfs_revalidate_inode (server, inode); +return inode_peek_iversion_raw (inode); }const struct export_operations nfs_export_ops = {
Signature · 1 line
2.30.2
Quoted 4 lines · On Wed, Mar 24, 2021 at 03:53:53PM -0400, [email protected] wrote:
From: Trond Myklebust <[email protected]>
The change attribute is always set by all NFS client versions so get rid of the open-coded version.
Thanks!
I'm unclear whether there's a user-visible bug here or whether it's mainly cleanup?
--b.
Quoted 35 lines
Fixes 3cc55f4434b4 ("nfs: use change attribute for NFS re-exports")Signed-off-by Trond Myklebust <[email protected]>--- fs/nfs/export.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)fs/nfs/export.c +4
-11@@ -171,17 +171,10 @@ static u64 nfs_fetch_iversion(struct inode *inode) {struct nfs_server *server =NFS_SERVER (inode); -/* Is this the right call?: */ -nfs_revalidate_inode (server, inode); -/* -* Also, note we're ignoring any returned error. That seems to be -* the practice for cache consistency information elsewhere in -* the server, but I'm not sure why. -*/ -if (server->nfs_client->rpc_ops->version >=4 ) -return inode_peek_iversion_raw (inode); -else -return time_to_chattr (&inode->i_ctime); +if (nfs_check_cache_invalid (inode,NFS_INO_INVALID_CHANGE | +NFS_INO_REVAL_PAGECACHE )) +__nfs_revalidate_inode (server, inode); +return inode_peek_iversion_raw (inode); }const struct export_operations nfs_export_ops = {Signature · 1 line
2.30.2
Quoted 12 lines · J. Bruce Fields
Quoted 5 lines · On Wed, Mar 24, 2021 at 03:53:53PM -0400, [email protected] wrote:
From: Trond Myklebust <[email protected]>
The change attribute is always set by all NFS client versions so get rid
of the open-coded version.Thanks!
I'm unclear whether there's a user-visible bug here or whether it's mainly cleanup?
It is mainly about ensuring that revalidation is done correctly. It is a performance issue, but is also about ensuring that we all feed into the same validity checking code.
Quoted 43 lines
--b.
Quoted 40 lines
Fixes 3cc55f4434b4 ("nfs: use change attribute for NFS re-exports")
Signed-off-by Trond Myklebust <[email protected]>---
fs/nfs/export.c | 15 ++++-----------1 file changed, 4 insertions(+), 11 deletions(-)fs/nfs/export.c +0
-0@@ -171,17 +171,10 @@ static u64 nfs_fetch_iversion(struct inode *inode) { struct nfs_server *server = NFS_SERVER(inode);
- /* Is this the right call?: */
- nfs_revalidate_inode(server, inode);
- /*
- * Also, note we're ignoring any returned error. That seems to be
- * the practice for cache consistency information elsewhere in
- * the server, but I'm not sure why.
- */
- if (server->nfs_client->rpc_ops->version>= 4)
- returninode_peek_iversion_raw(inode);
- else
- returntime_to_chattr(&inode->i_ctime); + if (nfs_check_cache_invalid(inode,NFS_INO_INVALID_CHANGE| +NFS_INO_REVAL_PAGECACHE))
+ __nfs_revalidate_inode(server, inode);
+ returninode_peek_iversion_raw(inode);
}
const structexport_operationsnfs_export_ops= {Signature · 1 line
2.30.2
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, Hammerspace [email protected]