NFSv4.2: Fix detection of "Proxying of Times" server support
Subsystems (2)
PATCH v2 1/1 NFSv4.2: Fix detection of "Proxying of Times" server support
According to draft-ietf-nfsv4-delstid-07:
If a server informs the client via the fattr4_open_arguments attribute that it supports OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS and it returns a valid delegation stateid for an OPEN operation which sets the OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS flag, then it MUST query the client via a CB_GETATTR for the fattr4_time_deleg_access (see Section 5.2) attribute and fattr4_time_deleg_modify attribute (see Section 5.2).
Thus, we should look that the server supports proxying of times via OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS.
We want to be extra pedantic and continue to check that FATTR4_TIME_DELEG_ACCESS and FATTR4_TIME_DELEG_MODIFY are set. The server needs to expose both for the client to correctly detect "Proxying of Times" support.
---
Changes from v1:
- Moved delegtime feature detection to a helper
- Small change log fixes
fs/nfs/nfs4proc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +14 -2
@@ -3904,6 +3904,18 @@ static void nfs4_close_context(struct nfs_open_context *ctx, int is_sync)#define FATTR4_WORD2_NFS41_MASK (2*FATTR4_WORD2_SUPPATTR_EXCLCREAT - 1UL)#define FATTR4_WORD2_NFS42_MASK (2*FATTR4_WORD2_OPEN_ARGUMENTS - 1UL) +#define FATTR4_WORD2_NFS42_TIME_DELEG_MASK \ + (FATTR4_WORD2_TIME_DELEG_MODIFY|FATTR4_WORD2_TIME_DELEG_ACCESS) +static bool nfs4_server_delegtime_capable (struct nfs4_server_caps_res *res) +{ +u32 share_access_want = res->open_caps.oa_share_access_want[0 ]; +u32 attr_bitmask = res->attr_bitmask[2 ]; + +return (share_access_want &NFS4_SHARE_WANT_DELEG_TIMESTAMPS ) && + ((attr_bitmask &FATTR4_WORD2_NFS42_TIME_DELEG_MASK ) == +FATTR4_WORD2_NFS42_TIME_DELEG_MASK ); +} +static int _nfs4_server_capabilities (struct nfs_server *server,struct nfs_fh *fhandle) {u32 minorversion = server->nfs_client->cl_minorversion;
@@ -3982,8 +3994,6 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f#endif if (res.attr_bitmask[0 ] &FATTR4_WORD0_FS_LOCATIONS ) server->caps |=NFS_CAP_FS_LOCATIONS ; -if (res.attr_bitmask[2 ] &FATTR4_WORD2_TIME_DELEG_MODIFY ) - server->caps |=NFS_CAP_DELEGTIME ;if (!(res.attr_bitmask[0 ] &FATTR4_WORD0_FILEID )) server->fattr_valid &= ~NFS_ATTR_FATTR_FILEID ;if (!(res.attr_bitmask[1 ] &FATTR4_WORD1_MODE ))
@@ -4011,6 +4021,8 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fif (res.open_caps.oa_share_access_want[0 ] &NFS4_SHARE_WANT_OPEN_XOR_DELEGATION ) server->caps |=NFS_CAP_OPEN_XOR ; +if (nfs4_server_delegtime_capable (&res)) + server->caps |=NFS_CAP_DELEGTIME ;memcpy (server->cache_consistency_bitmask, res.attr_bitmask,sizeof (server->cache_consistency_bitmask)); server->cache_consistency_bitmask[0 ] &=FATTR4_WORD0_CHANGE |FATTR4_WORD0_SIZE ;
Signature · 1 line
2.43.0
Quoted 59 lines · Roi Azarzar
According to draft-ietf-nfsv4-delstid-07:
If a server informs the client via thefattr4_open_argumentsattribute that it supportsOPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPSand it returns a valid delegation stateid for an OPEN operation which sets theOPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPSflag, then it MUST query the client via aCB_GETATTRfor thefattr4_time_deleg_access(see Section 5.2) attribute andfattr4_time_deleg_modifyattribute (see Section 5.2).Thus, we should look that the server supports proxying of times via
OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS.We want to be extra pedantic and continue to check that
FATTR4_TIME_DELEG_ACCESSandFATTR4_TIME_DELEG_MODIFYare set. The server needs to expose both for the client to correctly detect "Proxying of Times" support.Signed-off-by Roi Azarzar <[email protected]>---
Changes from v1:
- Moved delegtime feature detection to a helper
- Small change log fixesfs/nfs/nfs4proc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)fs/nfs/nfs4proc.c +12
-2@@ -3904,6 +3904,18 @@ static void nfs4_close_context(struct nfs_open_context *ctx, int is_sync)#define FATTR4_WORD2_NFS41_MASK (2*FATTR4_WORD2_SUPPATTR_EXCLCREAT - 1UL)#define FATTR4_WORD2_NFS42_MASK (2*FATTR4_WORD2_OPEN_ARGUMENTS - 1UL) +#define FATTR4_WORD2_NFS42_TIME_DELEG_MASK \ + (FATTR4_WORD2_TIME_DELEG_MODIFY|FATTR4_WORD2_TIME_DELEG_ACCESS) +static bool nfs4_server_delegtime_capable (struct nfs4_server_caps_res *res) +{ +u32 share_access_want = res->open_caps.oa_share_access_want[0 ]; +u32 attr_bitmask = res->attr_bitmask[2 ]; + +return (share_access_want &NFS4_SHARE_WANT_DELEG_TIMESTAMPS ) && + ((attr_bitmask &FATTR4_WORD2_NFS42_TIME_DELEG_MASK ) == +FATTR4_WORD2_NFS42_TIME_DELEG_MASK ); +} +static int _nfs4_server_capabilities (struct nfs_server *server,struct nfs_fh *fhandle) {u32 minorversion = server->nfs_client->cl_minorversion;@@ -3982,8 +3994,6 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f#endif if (res.attr_bitmask[0 ] &FATTR4_WORD0_FS_LOCATIONS ) server->caps |=NFS_CAP_FS_LOCATIONS ; -if (res.attr_bitmask[2 ] &FATTR4_WORD2_TIME_DELEG_MODIFY ) - server->caps |=NFS_CAP_DELEGTIME ;if (!(res.attr_bitmask[0 ] &FATTR4_WORD0_FILEID )) server->fattr_valid &= ~NFS_ATTR_FATTR_FILEID ;if (!(res.attr_bitmask[1 ] &FATTR4_WORD1_MODE ))
fs/nfs/nfs4proc.c static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f · line 4028
Quoted 8 lines
fs/nfs/nfs4proc.c +2
-0@@ -4011,6 +4021,8 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fif (res.open_caps.oa_share_access_want[0 ] &NFS4_SHARE_WANT_OPEN_XOR_DELEGATION ) server->caps |=NFS_CAP_OPEN_XOR ; +if (nfs4_server_delegtime_capable (&res)) + server->caps |=NFS_CAP_DELEGTIME ;memcpy (server->cache_consistency_bitmask, res.attr_bitmask,sizeof (server->cache_consistency_bitmask)); server->cache_consistency_bitmask[0 ] &=FATTR4_WORD0_CHANGE |FATTR4_WORD0_SIZE ;