Message ID | 20240912074130.4861-1-roi.azarzar@vastdata.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | NFSv4.2: Fix detection of "Proxying of Times" server support | expand |
On Thu, 2024-09-12 at 07:41 +0000, Roi Azarzar wrote: > Set time delegation capability according to relevant supported attrs > > 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). > > We want to be extra pedantic and continue to check that FATTR4_TIME_DELEG_ACCESS > and FATTR4_TIME_DELEG_MODIFY are set > > the server should inform the client that it supports > OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS via FATTR4_OPEN_ARGUMENTS attribute > using GETATTR call, which the client should determine the server capability accordingly. > In addition, the server should support TIME_DELEG_MODIFY and TIME_DELEG_ACCESS as well. > > Signed-off-by: Roi Azarzar <roi.azarzar@vastdata.com> > --- > fs/nfs/nfs4proc.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c > index b8ffbe52ba15..ba20197d0226 100644 > --- a/fs/nfs/nfs4proc.c > +++ b/fs/nfs/nfs4proc.c > @@ -3982,8 +3982,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 +4009,11 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f > if (res.open_caps.oa_share_access_want[0] & > NFS4_SHARE_WANT_OPEN_XOR_DELEGATION) > server->caps |= NFS_CAP_OPEN_XOR; > + if ((res.open_caps.oa_share_access_want[0] & > + NFS4_SHARE_WANT_DELEG_TIMESTAMPS) && > + (res.attr_bitmask[2] & FATTR4_WORD2_TIME_DELEG_MODIFY) && > + (res.attr_bitmask[2] & FATTR4_WORD2_TIME_DELEG_ACCESS)) > + server->caps |= NFS_CAP_DELEGTIME; > > It's more efficient to just do the & once: res.attr_bitmask[2] & (FATTR4_WORD2_TIME_DELEG_MODIFY|FATTR4_WORD2_TIME_DELEG_ACCESS) == (FATTR4_WORD2_TIME_DELEG_MODIFY|FATTR4_WORD2_TIME_DELEG_ACCESS) That's all getting a bit hard to read though, so it might be nice to make a little static helper to check these. > > memcpy(server->cache_consistency_bitmask, res.attr_bitmask, sizeof(server->cache_consistency_bitmask)); > server->cache_consistency_bitmask[0] &= FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b8ffbe52ba15..ba20197d0226 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3982,8 +3982,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 +4009,11 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f if (res.open_caps.oa_share_access_want[0] & NFS4_SHARE_WANT_OPEN_XOR_DELEGATION) server->caps |= NFS_CAP_OPEN_XOR; + if ((res.open_caps.oa_share_access_want[0] & + NFS4_SHARE_WANT_DELEG_TIMESTAMPS) && + (res.attr_bitmask[2] & FATTR4_WORD2_TIME_DELEG_MODIFY) && + (res.attr_bitmask[2] & FATTR4_WORD2_TIME_DELEG_ACCESS)) + 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;
Set time delegation capability according to relevant supported attrs 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). We want to be extra pedantic and continue to check that FATTR4_TIME_DELEG_ACCESS and FATTR4_TIME_DELEG_MODIFY are set the server should inform the client that it supports OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS via FATTR4_OPEN_ARGUMENTS attribute using GETATTR call, which the client should determine the server capability accordingly. In addition, the server should support TIME_DELEG_MODIFY and TIME_DELEG_ACCESS as well. Signed-off-by: Roi Azarzar <roi.azarzar@vastdata.com> --- fs/nfs/nfs4proc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)