nfs, nfsd: avoid 32-bit time_t
Subsystems (4)
cover nfs, nfsd: avoid 32-bit time_t
I have finally found the time to convert all of NFS away from using time_t derived data structures to (mostly) time64_t, unifying the behavior between 32-bit and 64-bit architectures and paving the way to removing the old time_t definition from the kernel.
Please review and test. This may be a little late for linux-5.5, but I hope to get it all into linux-5.6 once all review comments are addressed.
Arnd
Arnd Bergmann (19):
sunrpc: convert to time64_t for expiry
nfs: use time64_t internally
nfs: use timespec64 in nfs_fattr
nfs: callback: use timespec64 in cb_getattrres
nfs: fscache: use timespec64 in inode auxdata
nfs: remove timespec from xdr_encode_nfstime
nfs: encode nfsv4 timestamps as 64-bit
nfsd: use ktime_get_seconds() for timestamps
nfsd: print 64-bit timestamps in client_info_show
nfsd: handle nfs3 timestamps as unsigned
nfsd: use timespec64 in encode_time_delta
nfsd: make 'boot_time' 64-bit wide
nfsd: pass a 64-bit guardtime to nfsd_setattr()
nfsd: use time64_t in nfsd_proc_setattr() check
nfsd: fix delay timer on 32-bit architectures
nfsd: fix jiffies/time_t mixup in LRU list
nfsd: use boottime for lease expiry alculation
nfsd: use ktime_get_real_seconds() in nfs4_verifier
nfsd: remove nfs4_reset_lease() declarations
fs/nfs/callback.h | 4 +- fs/nfs/callback_proc.c | 4 +- fs/nfs/callback_xdr.c | 6 +-- fs/nfs/fscache-index.c | 6 ++- fs/nfs/fscache.c | 18 ++++--- fs/nfs/fscache.h | 8 ++-- fs/nfs/inode.c | 54 ++++++++++----------- fs/nfs/internal.h | 6 +-- fs/nfs/nfs2xdr.c | 33 ++++++------- fs/nfs/nfs3xdr.c | 14 ++---- fs/nfs/nfs4xdr.c | 35 +++++++------- fs/nfsd/netns.h | 6 +-- fs/nfsd/nfs3xdr.c | 20 ++++---- fs/nfsd/nfs4callback.c | 7 ++- fs/nfsd/nfs4layouts.c | 2 +- fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/nfs4recover.c | 8 ++-- fs/nfsd/nfs4state.c | 68 +++++++++++++-------------- fs/nfsd/nfs4xdr.c | 4 +- fs/nfsd/nfsctl.c | 6 +-- fs/nfsd/nfsd.h | 2 - fs/nfsd/nfsfh.h | 4 +- fs/nfsd/nfsproc.c | 6 +-- fs/nfsd/state.h | 10 ++-- fs/nfsd/vfs.c | 4 +- fs/nfsd/vfs.h | 2 +- fs/nfsd/xdr3.h | 2 +- include/linux/nfs_fs_sb.h | 2 +- include/linux/nfs_xdr.h | 14 +++--- include/linux/sunrpc/cache.h | 42 +++++++++-------- include/linux/sunrpc/gss_api.h | 4 +- include/linux/sunrpc/gss_krb5.h | 2 +- net/sunrpc/auth_gss/gss_krb5_mech.c | 12 +++-- net/sunrpc/auth_gss/gss_krb5_seal.c | 8 ++-- net/sunrpc/auth_gss/gss_krb5_unseal.c | 6 +-- net/sunrpc/auth_gss/gss_krb5_wrap.c | 16 +++---- net/sunrpc/auth_gss/gss_mech_switch.c | 2 +- net/sunrpc/auth_gss/svcauth_gss.c | 6 +-- net/sunrpc/cache.c | 18 +++---- net/sunrpc/svcauth_unix.c | 10 ++-- 40 files changed, 243 insertions(+), 240 deletions(-)
Signature · 1 line
2.20.0
PATCH 1/19 sunrpc: convert to time64_t for expiry
Using signed 32-bit types for UTC time leads to the y2038 overflow, which is what happens in the sunrpc code at the moment.
This changes the sunrpc code over to use time64_t where possible. The one exception is the gss_import_v{1,2}_context() function for kerberos5, which uses 32-bit timestamps in the protocol. Here, we can at least treat the numbers as 'unsigned', which extends the range from 2038 to 2106.
--- include/linux/sunrpc/gss_api.h | 4 ++-- include/linux/sunrpc/gss_krb5.h | 2 +- net/sunrpc/auth_gss/gss_krb5_mech.c | 12 +++++++++--- net/sunrpc/auth_gss/gss_krb5_seal.c | 8 ++++---- net/sunrpc/auth_gss/gss_krb5_unseal.c | 6 +++--- net/sunrpc/auth_gss/gss_krb5_wrap.c | 16 ++++++++-------- net/sunrpc/auth_gss/gss_mech_switch.c | 2 +- net/sunrpc/auth_gss/svcauth_gss.c | 4 ++-- 8 files changed, 30 insertions(+), 24 deletions(-)
include/linux/sunrpc/gss_api.h +2 -2
@@ -49,7 +49,7 @@ int gss_import_sec_context(size_t bufsize, struct gss_api_mech *mech, struct gss_ctx **ctx_id, - time_t *endtime, + time64_t *endtime, gfp_t gfp_mask); u32 gss_get_mic( struct gss_ctx *ctx_id,
@@ -109,7 +109,7 @@ struct gss_api_ops {const void *input_token, size_t bufsize, struct gss_ctx *ctx_id, - time_t *endtime, + time64_t *endtime, gfp_t gfp_mask); u32 (*gss_get_mic)( struct gss_ctx *ctx_id,
include/linux/sunrpc/gss_krb5.h +1 -1
@@ -106,9 +106,9 @@ struct krb5_ctx {struct crypto_sync_skcipher *initiator_enc_aux;u8 Ksess[GSS_KRB5_MAX_KEYLEN ];/* session key */ u8 cksum[GSS_KRB5_MAX_KEYLEN ]; -s32 endtime;atomic_t seq_send;atomic64_t seq_send64; +time64_t endtime;struct xdr_netobj mech_used;u8 initiator_sign[GSS_KRB5_MAX_KEYLEN ];u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN ];
net/sunrpc/auth_gss/gss_krb5_mech.c +9 -3
@@ -253,6 +253,7 @@ gss_import_v1_context(const void *p, const void *end, struct krb5_ctx *ctx) {u32 seq_send;int tmp; +u32 time32; p =simple_get_bytes (p, end, &ctx->initiate,sizeof (ctx->initiate));if (IS_ERR (p))
@@ -290,9 +291,11 @@ gss_import_v1_context(const void *p, const void *end, struct krb5_ctx *ctx) p =ERR_PTR (-ENOSYS ); goto out_err; } - p =simple_get_bytes (p, end, &ctx->endtime,sizeof (ctx->endtime)); + p =simple_get_bytes (p, end, &time32,sizeof (time32));if (IS_ERR (p)) goto out_err; +/* unsigned 32-bit time overflows in year 2106 */ + ctx->endtime = (time64_t )time32; p =simple_get_bytes (p, end, &seq_send,sizeof (seq_send));if (IS_ERR (p)) goto out_err;
@@ -587,15 +590,18 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx, {u64 seq_send64;int keylen; +u32 time32; p =simple_get_bytes (p, end, &ctx->flags,sizeof (ctx->flags));if (IS_ERR (p)) goto out_err; ctx->initiate = ctx->flags &KRB5_CTX_FLAG_INITIATOR ; - p =simple_get_bytes (p, end, &ctx->endtime,sizeof (ctx->endtime)); + p =simple_get_bytes (p, end, &time32,sizeof (time32));if (IS_ERR (p)) goto out_err; +/* unsigned 32-bit time overflows in year 2106 */ + ctx->endtime = (time64_t )time32; p =simple_get_bytes (p, end, &seq_send64,sizeof (seq_send64));if (IS_ERR (p)) goto out_err;
@@ -659,7 +665,7 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx,static int gss_import_sec_context_kerberos (const void *p,size_t len,struct gss_ctx *ctx_id, -time_t *endtime, +time64_t *endtime,gfp_t gfp_mask) {const void *end = (const void *)((const char *)p + len);
net/sunrpc/auth_gss/gss_krb5_seal.c +4 -4
@@ -131,14 +131,14 @@ gss_get_mic_v1(struct krb5_ctx *ctx, struct xdr_buf *text,struct xdr_netobj md5cksum = {.len =sizeof (cksumdata), .data = cksumdata};void *ptr; -s32 now; +time64_t now;u32 seq_send;u8 *cksumkey;dprintk ("RPC: %s\n" , __func__);BUG_ON (ctx ==NULL ); - now =get_seconds (); + now =ktime_get_real_seconds (); ptr =setup_token (ctx, token);
@@ -170,7 +170,7 @@ gss_get_mic_v2(struct krb5_ctx *ctx, struct xdr_buf *text,struct xdr_netobj cksumobj = { .len =sizeof (cksumdata), .data = cksumdata};void *krb5_hdr; -s32 now; +time64_t now;u8 *cksumkey;unsigned int cksum_usage;__be64 seq_send_be64;
@@ -198,7 +198,7 @@ gss_get_mic_v2(struct krb5_ctx *ctx, struct xdr_buf *text,memcpy (krb5_hdr +GSS_KRB5_TOK_HDR_LEN , cksumobj.data, cksumobj.len); - now =get_seconds (); + now =ktime_get_real_seconds ();return (ctx->endtime < now) ?GSS_S_CONTEXT_EXPIRED :GSS_S_COMPLETE ; }
net/sunrpc/auth_gss/gss_krb5_unseal.c +3 -3
@@ -124,7 +124,7 @@ gss_verify_mic_v1(struct krb5_ctx *ctx,/* it got through unscathed. Make sure the context is unexpired */ - now =get_seconds (); + now =ktime_get_real_seconds ();if (now > ctx->endtime)return GSS_S_CONTEXT_EXPIRED ;
@@ -149,7 +149,7 @@ gss_verify_mic_v2(struct krb5_ctx *ctx,char cksumdata[GSS_KRB5_MAX_CKSUM_LEN ];struct xdr_netobj cksumobj = {.len =sizeof (cksumdata), .data = cksumdata}; -s32 now; +time64_t now;u8 *ptr = read_token->data;u8 *cksumkey;u8 flags;
@@ -194,7 +194,7 @@ gss_verify_mic_v2(struct krb5_ctx *ctx,return GSS_S_BAD_SIG ;/* it got through unscathed. Make sure the context is unexpired */ - now =get_seconds (); + now =ktime_get_real_seconds ();if (now > ctx->endtime)return GSS_S_CONTEXT_EXPIRED ;
net/sunrpc/auth_gss/gss_krb5_wrap.c +8 -8
@@ -163,7 +163,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset, .data = cksumdata};int blocksize =0 , plainlen;unsigned char *ptr, *msg_start; -s32 now; +time64_t now;int headlen;struct page **tmp_pages;u32 seq_send;
@@ -172,7 +172,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset,dprintk ("RPC: %s\n" , __func__); - now =get_seconds (); + now =ktime_get_real_seconds (); blocksize =crypto_sync_skcipher_blocksize (kctx->enc);gss_krb5_add_padding (buf, offset, blocksize);
@@ -268,7 +268,7 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)char cksumdata[GSS_KRB5_MAX_CKSUM_LEN ];struct xdr_netobj md5cksum = {.len =sizeof (cksumdata), .data = cksumdata}; -s32 now; +time64_t now;int direction;s32 seqnum;unsigned char *ptr;
@@ -359,7 +359,7 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)/* it got through unscathed. Make sure the context is unexpired */ - now =get_seconds (); + now =ktime_get_real_seconds ();if (now > kctx->endtime)return GSS_S_CONTEXT_EXPIRED ;
@@ -439,7 +439,7 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf, struct page **pages) { u8 *ptr, *plainhdr; -s32 now; +time64_t now;u8 flags =0x00 ;__be16 *be16ptr;__be64 *be64ptr;
@@ -481,14 +481,14 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset,if (err)return err; - now =get_seconds (); + now =ktime_get_real_seconds ();return (kctx->endtime < now) ?GSS_S_CONTEXT_EXPIRED :GSS_S_COMPLETE ; }static u32 gss_unwrap_kerberos_v2 (struct krb5_ctx *kctx,int offset,struct xdr_buf *buf) { -s32 now; +time64_t now;u8 *ptr;u8 flags =0x00 ;u16 ec, rrc;
@@ -557,7 +557,7 @@ gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)/* do sequencing checks */ /* it got through unscathed. Make sure the context is unexpired */ - now =get_seconds (); + now =ktime_get_real_seconds ();if (now > kctx->endtime)return GSS_S_CONTEXT_EXPIRED ;
net/sunrpc/auth_gss/gss_mech_switch.c +1 -1
@@ -374,7 +374,7 @@ int gss_import_sec_context(const void *input_token, size_t bufsize, struct gss_api_mech *mech, struct gss_ctx **ctx_id, - time_t *endtime, + time64_t *endtime, gfp_t gfp_mask) { if (!(*ctx_id = kzalloc(sizeof(**ctx_id), gfp_mask)))
net/sunrpc/auth_gss/svcauth_gss.c +2 -2
@@ -433,7 +433,7 @@ static int rsc_parse(struct cache_detail *cd,int id;int len, rv;struct rsc rsci, *rscp =NULL ; -time_t expiry; +time64_t expiry;int status = -EINVAL ;struct gss_api_mech *gm =NULL ;
@@ -1184,7 +1184,7 @@ static int gss_proxy_save_rsc(struct cache_detail *cd,static atomic64_t ctxhctr;long long ctxh;struct gss_api_mech *gm =NULL ; -time_t expiry; +time64_t expiry;int status = -EINVAL ;memset (&rsci,0 ,sizeof (rsci));
Signature · 1 line
2.20.0
Re: [PATCH 01/19] sunrpc: convert to time64_t for expiry
Quoted 8 lines · Arnd Bergmann
Using signed 32-bit types for UTC time leads to the y2038 overflow, which is what happens in the sunrpc code at the moment.
This changes the sunrpc code over to use
time64_twhere possible. The one exception is the gss_import_v{1,2}_context() function for kerberos5, which uses 32-bit timestamps in the protocol. Here, we can at least treat the numbers as 'unsigned', which extends the range from 2038 to 2106.
Looking at nfs-utils.... looks like this number is opaque to nfs-utils code, generated by gss_inquire_context, which actually defines it as uint32_t, so this makes sense.
--b.
Quoted 286 lines
Signed-off-by Arnd Bergmann <[email protected]>--- include/linux/sunrpc/gss_api.h | 4 ++-- include/linux/sunrpc/gss_krb5.h | 2 +- net/sunrpc/auth_gss/gss_krb5_mech.c | 12 +++++++++--- net/sunrpc/auth_gss/gss_krb5_seal.c | 8 ++++---- net/sunrpc/auth_gss/gss_krb5_unseal.c | 6 +++--- net/sunrpc/auth_gss/gss_krb5_wrap.c | 16 ++++++++-------- net/sunrpc/auth_gss/gss_mech_switch.c | 2 +- net/sunrpc/auth_gss/svcauth_gss.c | 4 ++-- 8 files changed, 30 insertions(+), 24 deletions(-)include/linux/sunrpc/gss_api.h +2
-2@@ -49,7 +49,7 @@ int gss_import_sec_context(size_t bufsize, struct gss_api_mech *mech, struct gss_ctx **ctx_id, - time_t *endtime, + time64_t *endtime, gfp_t gfp_mask); u32 gss_get_mic( struct gss_ctx *ctx_id,@@ -109,7 +109,7 @@ struct gss_api_ops {const void *input_token, size_t bufsize, struct gss_ctx *ctx_id, - time_t *endtime, + time64_t *endtime, gfp_t gfp_mask); u32 (*gss_get_mic)( struct gss_ctx *ctx_id,include/linux/sunrpc/gss_krb5.h +1
-1@@ -106,9 +106,9 @@ struct krb5_ctx {struct crypto_sync_skcipher *initiator_enc_aux;u8 Ksess[GSS_KRB5_MAX_KEYLEN ];/* session key */ u8 cksum[GSS_KRB5_MAX_KEYLEN ]; -s32 endtime;atomic_t seq_send;atomic64_t seq_send64; +time64_t endtime;struct xdr_netobj mech_used;u8 initiator_sign[GSS_KRB5_MAX_KEYLEN ];u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN ];net/sunrpc/auth_gss/gss_krb5_mech.c +9
-3@@ -253,6 +253,7 @@ gss_import_v1_context(const void *p, const void *end, struct krb5_ctx *ctx) {u32 seq_send;int tmp; +u32 time32; p =simple_get_bytes (p, end, &ctx->initiate,sizeof (ctx->initiate));if (IS_ERR (p))@@ -290,9 +291,11 @@ gss_import_v1_context(const void *p, const void *end, struct krb5_ctx *ctx) p =ERR_PTR (-ENOSYS ); goto out_err; } - p =simple_get_bytes (p, end, &ctx->endtime,sizeof (ctx->endtime)); + p =simple_get_bytes (p, end, &time32,sizeof (time32));if (IS_ERR (p)) goto out_err; +/* unsigned 32-bit time overflows in year 2106 */ + ctx->endtime = (time64_t )time32; p =simple_get_bytes (p, end, &seq_send,sizeof (seq_send));if (IS_ERR (p)) goto out_err;@@ -587,15 +590,18 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx, {u64 seq_send64;int keylen; +u32 time32; p =simple_get_bytes (p, end, &ctx->flags,sizeof (ctx->flags));if (IS_ERR (p)) goto out_err; ctx->initiate = ctx->flags &KRB5_CTX_FLAG_INITIATOR ; - p =simple_get_bytes (p, end, &ctx->endtime,sizeof (ctx->endtime)); + p =simple_get_bytes (p, end, &time32,sizeof (time32));if (IS_ERR (p)) goto out_err; +/* unsigned 32-bit time overflows in year 2106 */ + ctx->endtime = (time64_t )time32; p =simple_get_bytes (p, end, &seq_send64,sizeof (seq_send64));if (IS_ERR (p)) goto out_err;@@ -659,7 +665,7 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx,static int gss_import_sec_context_kerberos (const void *p,size_t len,struct gss_ctx *ctx_id, -time_t *endtime, +time64_t *endtime,gfp_t gfp_mask) {const void *end = (const void *)((const char *)p + len);net/sunrpc/auth_gss/gss_krb5_seal.c +4
-4@@ -131,14 +131,14 @@ gss_get_mic_v1(struct krb5_ctx *ctx, struct xdr_buf *text,struct xdr_netobj md5cksum = {.len =sizeof (cksumdata), .data = cksumdata};void *ptr; -s32 now; +time64_t now;u32 seq_send;u8 *cksumkey;dprintk ("RPC: %s\n" , __func__);BUG_ON (ctx ==NULL ); - now =get_seconds (); + now =ktime_get_real_seconds (); ptr =setup_token (ctx, token);@@ -170,7 +170,7 @@ gss_get_mic_v2(struct krb5_ctx *ctx, struct xdr_buf *text,struct xdr_netobj cksumobj = { .len =sizeof (cksumdata), .data = cksumdata};void *krb5_hdr; -s32 now; +time64_t now;u8 *cksumkey;unsigned int cksum_usage;__be64 seq_send_be64;@@ -198,7 +198,7 @@ gss_get_mic_v2(struct krb5_ctx *ctx, struct xdr_buf *text,memcpy (krb5_hdr +GSS_KRB5_TOK_HDR_LEN , cksumobj.data, cksumobj.len); - now =get_seconds (); + now =ktime_get_real_seconds ();return (ctx->endtime < now) ?GSS_S_CONTEXT_EXPIRED :GSS_S_COMPLETE ; }net/sunrpc/auth_gss/gss_krb5_unseal.c +3
-3@@ -124,7 +124,7 @@ gss_verify_mic_v1(struct krb5_ctx *ctx,/* it got through unscathed. Make sure the context is unexpired */ - now =get_seconds (); + now =ktime_get_real_seconds ();if (now > ctx->endtime)return GSS_S_CONTEXT_EXPIRED ;@@ -149,7 +149,7 @@ gss_verify_mic_v2(struct krb5_ctx *ctx,char cksumdata[GSS_KRB5_MAX_CKSUM_LEN ];struct xdr_netobj cksumobj = {.len =sizeof (cksumdata), .data = cksumdata}; -s32 now; +time64_t now;u8 *ptr = read_token->data;u8 *cksumkey;u8 flags;@@ -194,7 +194,7 @@ gss_verify_mic_v2(struct krb5_ctx *ctx,return GSS_S_BAD_SIG ;/* it got through unscathed. Make sure the context is unexpired */ - now =get_seconds (); + now =ktime_get_real_seconds ();if (now > ctx->endtime)return GSS_S_CONTEXT_EXPIRED ;net/sunrpc/auth_gss/gss_krb5_wrap.c +8
-8@@ -163,7 +163,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset, .data = cksumdata};int blocksize =0 , plainlen;unsigned char *ptr, *msg_start; -s32 now; +time64_t now;int headlen;struct page **tmp_pages;u32 seq_send;@@ -172,7 +172,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset,dprintk ("RPC: %s\n" , __func__); - now =get_seconds (); + now =ktime_get_real_seconds (); blocksize =crypto_sync_skcipher_blocksize (kctx->enc);gss_krb5_add_padding (buf, offset, blocksize);@@ -268,7 +268,7 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)char cksumdata[GSS_KRB5_MAX_CKSUM_LEN ];struct xdr_netobj md5cksum = {.len =sizeof (cksumdata), .data = cksumdata}; -s32 now; +time64_t now;int direction;s32 seqnum;unsigned char *ptr;@@ -359,7 +359,7 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)/* it got through unscathed. Make sure the context is unexpired */ - now =get_seconds (); + now =ktime_get_real_seconds ();if (now > kctx->endtime)return GSS_S_CONTEXT_EXPIRED ;@@ -439,7 +439,7 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf, struct page **pages) { u8 *ptr, *plainhdr; -s32 now; +time64_t now;u8 flags =0x00 ;__be16 *be16ptr;__be64 *be64ptr;@@ -481,14 +481,14 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset,if (err)return err; - now =get_seconds (); + now =ktime_get_real_seconds ();return (kctx->endtime < now) ?GSS_S_CONTEXT_EXPIRED :GSS_S_COMPLETE ; }static u32 gss_unwrap_kerberos_v2 (struct krb5_ctx *kctx,int offset,struct xdr_buf *buf) { -s32 now; +time64_t now;u8 *ptr;u8 flags =0x00 ;u16 ec, rrc;@@ -557,7 +557,7 @@ gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)/* do sequencing checks */ /* it got through unscathed. Make sure the context is unexpired */ - now =get_seconds (); + now =ktime_get_real_seconds ();if (now > kctx->endtime)return GSS_S_CONTEXT_EXPIRED ;net/sunrpc/auth_gss/gss_mech_switch.c +1
-1@@ -374,7 +374,7 @@ int gss_import_sec_context(const void *input_token, size_t bufsize, struct gss_api_mech *mech, struct gss_ctx **ctx_id, - time_t *endtime, + time64_t *endtime, gfp_t gfp_mask) { if (!(*ctx_id = kzalloc(sizeof(**ctx_id), gfp_mask)))net/sunrpc/auth_gss/svcauth_gss.c +2
-2@@ -433,7 +433,7 @@ static int rsc_parse(struct cache_detail *cd,int id;int len, rv;struct rsc rsci, *rscp =NULL ; -time_t expiry; +time64_t expiry;int status = -EINVAL ;struct gss_api_mech *gm =NULL ;@@ -1184,7 +1184,7 @@ static int gss_proxy_save_rsc(struct cache_detail *cd,static atomic64_t ctxhctr;long long ctxh;struct gss_api_mech *gm =NULL ; -time_t expiry; +time64_t expiry;int status = -EINVAL ;memset (&rsci,0 ,sizeof (rsci));Signature · 1 line
2.20.0
PATCH 2/19 nfs: use time64_t internally
In reply to Arnd BergmannThe timestamps for the cache are all in boottime seconds, so they don't overflow 32-bit values, but the use of time_t is deprecated because it generally does overflow when used with wall-clock time.
There are multiple possible ways of avoiding it:
- leave time_t, which is safe here, but forces others to look into this code to determine that it is over and over.
- use a more generic type, like 'int' or 'long', which is known to be sufficient here but loses the documentation of referring to timestamps
- use ktime_t everywhere, and convert into seconds in the few places where we want realtime-seconds. The conversion is sometimes expensive, but not more so than the conversion we do today.
- use time64_t to clarify that this code is safe. Nothing would change for 64-bit architectures, but it is slightly less efficient on 32-bit architectures.
Without a clear winner of the three approaches above, this picks the last one, favouring readability over a small performance loss on 32-bit architectures.
--- include/linux/sunrpc/cache.h | 42 +++++++++++++++++-------------- net/sunrpc/auth_gss/svcauth_gss.c | 2 +- net/sunrpc/cache.c | 18 ++++++------- net/sunrpc/svcauth_unix.c | 10 ++++---- 4 files changed, 38 insertions(+), 34 deletions(-)
include/linux/sunrpc/cache.h +23 -19
@@ -45,8 +45,8 @@*/ struct cache_head {struct hlist_node cache_list; -time_t expiry_time;/* After time time, don't use the data */ -time_t last_refresh;/* If CACHE_PENDING, this is when upcall was +time64_t expiry_time;/* After time time, don't use the data */ +time64_t last_refresh;/* If CACHE_PENDING, this is when upcall was * sent, else this is when update was * received, though it is alway set to * be *after* ->flush_time.
@@ -95,22 +95,22 @@ struct cache_detail {/* fields below this comment are for internal use * and should not be touched by cache owners */ -time_t flush_time;/* flush all cache items with +time64_t flush_time;/* flush all cache items with * last_refresh at or earlier * than this. last_refresh * is never set at or earlier * than this. */ struct list_head others; -time_t nextcheck; +time64_t nextcheck;int entries;/* fields for communication over channel */ struct list_head queue;atomic_t writers;/* how many time is /channel open */ -time_t last_close;/* if no writers, when did last close */ -time_t last_warn;/* when we last warned about no writers */ +time64_t last_close;/* if no writers, when did last close */ +time64_t last_warn;/* when we last warned about no writers */ union {struct proc_dir_entry *procfs;
@@ -147,18 +147,22 @@ struct cache_deferred_req {* timestamps kept in the cache are expressed in seconds * since boot. This is the best for measuring differences in * real time. +* This reimplemnts ktime_get_boottime_seconds() in a slightly +* faster but less accurate way. When we end up converting +* back to wallclock (CLOCK_REALTIME), that error often +* cancels out during the reverse operation. */ -static inline time_t seconds_since_boot (void ) +static inline time64_t seconds_since_boot (void ) { -struct timespec boot; -getboottime (&boot); -return get_seconds () - boot.tv_sec; +struct timespec64 boot; +getboottime64 (&boot); +return ktime_get_seconds () - boot.tv_sec; } -static inline time_t convert_to_wallclock (time_t sinceboot) +static inline time64_t convert_to_wallclock (time64_t sinceboot) { -struct timespec boot; -getboottime (&boot); +struct timespec64 boot; +getboottime64 (&boot);return boot.tv_sec + sinceboot; }
@@ -273,7 +277,7 @@ static inline int get_uint(char **bpp, unsigned int *anint)return 0 ; } -static inline int get_time (char **bpp,time_t *time) +static inline int get_time (char **bpp,time64_t *time) {char buf[50 ];long long ll;
@@ -287,20 +291,20 @@ static inline int get_time(char **bpp, time_t *time)if (kstrtoll (buf,0 , &ll))return -EINVAL ; - *time = (time_t )ll; + *time = ll;return 0 ; } -static inline time_t get_expiry (char **bpp) +static inline time64_t get_expiry (char **bpp) { -time_t rv; -struct timespec boot; +time64_t rv; +struct timespec64 boot;if (get_time (bpp, &rv))return 0 ;if (rv <0 )return 0 ; -getboottime (&boot); +getboottime64 (&boot);return rv - boot.tv_sec; }
net/sunrpc/auth_gss/svcauth_gss.c +1 -1
@@ -200,7 +200,7 @@ static int rsi_parse(struct cache_detail *cd,char *ep;int len;struct rsi rsii, *rsip =NULL ; -time_t expiry; +time64_t expiry;int status = -EINVAL ;memset (&rsii,0 ,sizeof (rsii));
net/sunrpc/cache.c +9 -9
@@ -42,7 +42,7 @@ static bool cache_listeners_exist(struct cache_detail *detail);static void cache_init (struct cache_head *h,struct cache_detail *detail) { -time_t now =seconds_since_boot (); +time64_t now =seconds_since_boot ();INIT_HLIST_NODE (&h->cache_list); h->flags =0 ;kref_init (&h->ref);
@@ -54,7 +54,7 @@ static void cache_init(struct cache_head *h, struct cache_detail *detail) }static inline int cache_is_valid (struct cache_head *h); -static void cache_fresh_locked (struct cache_head *head,time_t expiry, +static void cache_fresh_locked (struct cache_head *head,time64_t expiry,struct cache_detail *detail);static void cache_fresh_unlocked (struct cache_head *head,struct cache_detail *detail);
@@ -145,10 +145,10 @@ EXPORT_SYMBOL_GPL(sunrpc_cache_lookup_rcu);static void cache_dequeue (struct cache_detail *detail,struct cache_head *ch); -static void cache_fresh_locked (struct cache_head *head,time_t expiry, +static void cache_fresh_locked (struct cache_head *head,time64_t expiry,struct cache_detail *detail) { -time_t now =seconds_since_boot (); +time64_t now =seconds_since_boot ();if (now <= detail->flush_time)/* ensure it isn't immediately treated as expired */ now = detail->flush_time +1 ;
@@ -280,7 +280,7 @@ int cache_check(struct cache_detail *detail, struct cache_head *h, struct cache_req *rqstp) { int rv; -long refresh_age, age; +time64_t refresh_age, age;/* First decide return status as best we can */ rv =cache_is_valid (h);
@@ -294,7 +294,7 @@ int cache_check(struct cache_detail *detail, rv = -ENOENT ; }else if (rv == -EAGAIN || (h->expiry_time !=0 && age > refresh_age/2 )) { -dprintk ("RPC: Want update, refage=%ld, age=%ld\n" , +dprintk ("RPC: Want update, refage=%lld, age=%lld\n" , refresh_age, age);if (!test_and_set_bit (CACHE_PENDING , &h->flags)) {switch (cache_make_upcall (detail, h)) {
@@ -1410,7 +1410,7 @@ static int c_show(struct seq_file *m, void *p)return cd->cache_show (m, cd,NULL ); ifdebug(CACHE) - seq_printf(m, "# expiry=%ld refcnt=%d flags=%lx\n", + seq_printf(m, "# expiry=%lld refcnt=%d flags=%lx\n",convert_to_wallclock (cp->expiry_time), kref_read(&cp->ref), cp->flags);cache_get (cp);
@@ -1483,7 +1483,7 @@ static ssize_t read_flush(struct file *file, char __user *buf,char tbuf[22 ];size_t len; - len =snprintf (tbuf,sizeof (tbuf),"%lu\n" , + len =snprintf (tbuf,sizeof (tbuf),"%llu\n" ,convert_to_wallclock (cd->flush_time));return simple_read_from_buffer (buf, count, ppos, tbuf, len); }
@@ -1494,7 +1494,7 @@ static ssize_t write_flush(struct file *file, const char __user *buf, {char tbuf[20 ];char *ep; -time_t now; +time64_t now;if (*ppos || count >sizeof (tbuf)-1 )return -EINVAL ;
net/sunrpc/svcauth_unix.c +5 -5
@@ -166,7 +166,7 @@ static void ip_map_request(struct cache_detail *cd, }static struct ip_map *__ip_map_lookup (struct cache_detail *cd,char *class,struct in6_addr *addr); -static int __ip_map_update (struct cache_detail *cd,struct ip_map *ipm,struct unix_domain *udom,time_t expiry); +static int __ip_map_update (struct cache_detail *cd,struct ip_map *ipm,struct unix_domain *udom,time64_t expiry);static int ip_map_parse (struct cache_detail *cd,char *mesg,int mlen)
@@ -187,7 +187,7 @@ static int ip_map_parse(struct cache_detail *cd,struct ip_map *ipmp;struct auth_domain *dom; -time_t expiry; +time64_t expiry;if (mesg[mlen-1 ] !='\n' )return -EINVAL ;
@@ -308,7 +308,7 @@ static inline struct ip_map *ip_map_lookup(struct net *net, char *class, }static int __ip_map_update (struct cache_detail *cd,struct ip_map *ipm, -struct unix_domain *udom,time_t expiry) +struct unix_domain *udom,time64_t expiry) {struct ip_map ip;struct cache_head *ch;
@@ -328,7 +328,7 @@ static int __ip_map_update(struct cache_detail *cd, struct ip_map *ipm, }static inline int ip_map_update (struct net *net,struct ip_map *ipm, -struct unix_domain *udom,time_t expiry) +struct unix_domain *udom,time64_t expiry) {struct sunrpc_net *sn;
@@ -491,7 +491,7 @@ static int unix_gid_parse(struct cache_detail *cd,int rv;int i;int err; -time_t expiry; +time64_t expiry;struct unix_gid ug, *ugp;if (mesg[mlen -1 ] !='\n' )
Signature · 1 line
2.20.0
PATCH 3/19 nfs: use timespec64 in nfs_fattr
In reply to Arnd BergmannPush down the use of timespec64 into NFS nfs_fattr, to avoid needless conversions, and get closer to having 64-bit time_t support on 32-bit NFSv4 and removing some old interfaces from the kernel.
--- fs/nfs/inode.c | 54 +++++++++++++++++++-------------------- fs/nfs/internal.h | 6 ++--- fs/nfs/nfs2xdr.c | 2 +- fs/nfs/nfs3xdr.c | 2 +- fs/nfs/nfs4xdr.c | 24 ++++++++--------- include/linux/nfs_fs_sb.h | 2 +- include/linux/nfs_xdr.h | 12 ++++----- 7 files changed, 51 insertions(+), 51 deletions(-)
fs/nfs/inode.c +27 -27
@@ -504,15 +504,15 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st nfsi->read_cache_jiffies = fattr->time_start; nfsi->attr_gencount = fattr->gencount;if (fattr->valid &NFS_ATTR_FATTR_ATIME ) - inode->i_atime =timespec_to_timespec64 (fattr->atime); + inode->i_atime = fattr->atime;else if (nfs_server_capable (inode,NFS_CAP_ATIME ))nfs_set_cache_invalid (inode,NFS_INO_INVALID_ATIME );if (fattr->valid &NFS_ATTR_FATTR_MTIME ) - inode->i_mtime =timespec_to_timespec64 (fattr->mtime); + inode->i_mtime = fattr->mtime;else if (nfs_server_capable (inode,NFS_CAP_MTIME ))nfs_set_cache_invalid (inode,NFS_INO_INVALID_MTIME );if (fattr->valid &NFS_ATTR_FATTR_CTIME ) - inode->i_ctime =timespec_to_timespec64 (fattr->ctime); + inode->i_ctime = fattr->ctime;else if (nfs_server_capable (inode,NFS_CAP_CTIME ))nfs_set_cache_invalid (inode,NFS_INO_INVALID_CTIME );if (fattr->valid &NFS_ATTR_FATTR_CHANGE )
@@ -698,7 +698,7 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr,if ((attr->ia_valid &ATTR_GID ) !=0 ) inode->i_gid = attr->ia_gid;if (fattr->valid &NFS_ATTR_FATTR_CTIME ) - inode->i_ctime =timespec_to_timespec64 (fattr->ctime); + inode->i_ctime = fattr->ctime;else nfs_set_cache_invalid (inode,NFS_INO_INVALID_CHANGE |NFS_INO_INVALID_CTIME );
@@ -709,14 +709,14 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr,NFS_I (inode)->cache_validity &= ~(NFS_INO_INVALID_ATIME |NFS_INO_INVALID_CTIME );if (fattr->valid &NFS_ATTR_FATTR_ATIME ) - inode->i_atime =timespec_to_timespec64 (fattr->atime); + inode->i_atime = fattr->atime;else if (attr->ia_valid &ATTR_ATIME_SET ) inode->i_atime = attr->ia_atime;else nfs_set_cache_invalid (inode,NFS_INO_INVALID_ATIME );if (fattr->valid &NFS_ATTR_FATTR_CTIME ) - inode->i_ctime =timespec_to_timespec64 (fattr->ctime); + inode->i_ctime = fattr->ctime;else nfs_set_cache_invalid (inode,NFS_INO_INVALID_CHANGE |NFS_INO_INVALID_CTIME );
@@ -725,14 +725,14 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr,NFS_I (inode)->cache_validity &= ~(NFS_INO_INVALID_MTIME |NFS_INO_INVALID_CTIME );if (fattr->valid &NFS_ATTR_FATTR_MTIME ) - inode->i_mtime =timespec_to_timespec64 (fattr->mtime); + inode->i_mtime = fattr->mtime;else if (attr->ia_valid &ATTR_MTIME_SET ) inode->i_mtime = attr->ia_mtime;else nfs_set_cache_invalid (inode,NFS_INO_INVALID_MTIME );if (fattr->valid &NFS_ATTR_FATTR_CTIME ) - inode->i_ctime =timespec_to_timespec64 (fattr->ctime); + inode->i_ctime = fattr->ctime;else nfs_set_cache_invalid (inode,NFS_INO_INVALID_CHANGE |NFS_INO_INVALID_CTIME );
@@ -1351,7 +1351,7 @@ static bool nfs_file_has_buffered_writers(struct nfs_inode *nfsi)static void nfs_wcc_update_inode (struct inode *inode,struct nfs_fattr *fattr) { -struct timespec ts; +struct timespec64 ts;if ((fattr->valid &NFS_ATTR_FATTR_PRECHANGE ) && (fattr->valid & NFS_ATTR_FATTR_CHANGE)
@@ -1361,18 +1361,18 @@ static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)nfs_set_cache_invalid (inode,NFS_INO_INVALID_DATA ); }/* If we have atomic WCC data, we may update some attributes */ - ts =timespec64_to_timespec (inode->i_ctime); + ts = inode->i_ctime;if ((fattr->valid &NFS_ATTR_FATTR_PRECTIME ) && (fattr->valid &NFS_ATTR_FATTR_CTIME ) - &×pec_equal (&ts, &fattr->pre_ctime)) { - inode->i_ctime =timespec_to_timespec64 (fattr->ctime); + &×pec64_equal (&ts, &fattr->pre_ctime)) { + inode->i_ctime = fattr->ctime; } - ts =timespec64_to_timespec (inode->i_mtime); + ts = inode->i_mtime;if ((fattr->valid &NFS_ATTR_FATTR_PREMTIME ) && (fattr->valid &NFS_ATTR_FATTR_MTIME ) - &×pec_equal (&ts, &fattr->pre_mtime)) { - inode->i_mtime =timespec_to_timespec64 (fattr->mtime); + &×pec64_equal (&ts, &fattr->pre_mtime)) { + inode->i_mtime = fattr->mtime;if (S_ISDIR (inode->i_mode))nfs_set_cache_invalid (inode,NFS_INO_INVALID_DATA ); }
@@ -1398,7 +1398,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fatstruct nfs_inode *nfsi =NFS_I (inode);loff_t cur_size, new_isize;unsigned long invalid =0 ; -struct timespec ts; +struct timespec64 ts;if (NFS_PROTO (inode)->have_delegation (inode,FMODE_READ ))return 0 ;
@@ -1425,12 +1425,12 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat invalid |=NFS_INO_INVALID_CHANGE |NFS_INO_REVAL_PAGECACHE ; - ts =timespec64_to_timespec (inode->i_mtime); -if ((fattr->valid &NFS_ATTR_FATTR_MTIME ) && !timespec_equal (&ts, &fattr->mtime)) + ts = inode->i_mtime; +if ((fattr->valid &NFS_ATTR_FATTR_MTIME ) && !timespec64_equal (&ts, &fattr->mtime)) invalid |=NFS_INO_INVALID_MTIME ; - ts =timespec64_to_timespec (inode->i_ctime); -if ((fattr->valid &NFS_ATTR_FATTR_CTIME ) && !timespec_equal (&ts, &fattr->ctime)) + ts = inode->i_ctime; +if ((fattr->valid &NFS_ATTR_FATTR_CTIME ) && !timespec64_equal (&ts, &fattr->ctime)) invalid |=NFS_INO_INVALID_CTIME ;if (fattr->valid &NFS_ATTR_FATTR_SIZE ) {
@@ -1460,8 +1460,8 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fatif ((fattr->valid &NFS_ATTR_FATTR_NLINK ) && inode->i_nlink != fattr->nlink) invalid |=NFS_INO_INVALID_OTHER ; - ts =timespec64_to_timespec (inode->i_atime); -if ((fattr->valid &NFS_ATTR_FATTR_ATIME ) && !timespec_equal (&ts, &fattr->atime)) + ts = inode->i_atime; +if ((fattr->valid &NFS_ATTR_FATTR_ATIME ) && !timespec64_equal (&ts, &fattr->atime)) invalid |=NFS_INO_INVALID_ATIME ;if (invalid !=0 )
@@ -1733,12 +1733,12 @@ int nfs_post_op_update_inode_force_wcc_locked(struct inode *inode, struct nfs_fa }if ((fattr->valid &NFS_ATTR_FATTR_CTIME ) !=0 && (fattr->valid &NFS_ATTR_FATTR_PRECTIME ) ==0 ) { - fattr->pre_ctime =timespec64_to_timespec (inode->i_ctime); + fattr->pre_ctime = inode->i_ctime; fattr->valid |=NFS_ATTR_FATTR_PRECTIME ; }if ((fattr->valid &NFS_ATTR_FATTR_MTIME ) !=0 && (fattr->valid &NFS_ATTR_FATTR_PREMTIME ) ==0 ) { - fattr->pre_mtime =timespec64_to_timespec (inode->i_mtime); + fattr->pre_mtime = inode->i_mtime; fattr->valid |=NFS_ATTR_FATTR_PREMTIME ; } if ((fattr->valid & NFS_ATTR_FATTR_SIZE) != 0 &&
@@ -1899,7 +1899,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) }if (fattr->valid &NFS_ATTR_FATTR_MTIME ) { - inode->i_mtime =timespec_to_timespec64 (fattr->mtime); + inode->i_mtime = fattr->mtime; }else if (server->caps &NFS_CAP_MTIME ) { nfsi->cache_validity |= save_cache_validity & (NFS_INO_INVALID_MTIME
@@ -1908,7 +1908,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) }if (fattr->valid &NFS_ATTR_FATTR_CTIME ) { - inode->i_ctime =timespec_to_timespec64 (fattr->ctime); + inode->i_ctime = fattr->ctime; }else if (server->caps &NFS_CAP_CTIME ) { nfsi->cache_validity |= save_cache_validity & (NFS_INO_INVALID_CTIME
@@ -1946,7 +1946,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)if (fattr->valid &NFS_ATTR_FATTR_ATIME ) - inode->i_atime =timespec_to_timespec64 (fattr->atime); + inode->i_atime = fattr->atime;else if (server->caps &NFS_CAP_ATIME ) { nfsi->cache_validity |= save_cache_validity & (NFS_INO_INVALID_ATIME
fs/nfs/internal.h +3 -3
@@ -706,14 +706,14 @@ unsigned int nfs_page_array_len(unsigned int base, size_t len) }/* -* Convert a struct timespec into a 64-bit change attribute +* Convert a struct timespec64 into a 64-bit change attribute * -* This does approximately the same thing as timespec_to_ns(), +* This does approximately the same thing as timespec64_to_ns(), * but for calculation efficiency, we multiply the seconds by * 1024*1024*1024. */ static inline -u64 nfs_timespec_to_change_attr (const struct timespec *ts) +u64 nfs_timespec_to_change_attr (const struct timespec64 *ts) {return ((u64 )ts->tv_sec <<30 ) + ts->tv_nsec; }
fs/nfs/nfs2xdr.c +1 -1
@@ -234,7 +234,7 @@ static __be32 *xdr_encode_current_server_time(__be32 *p,return p; } -static __be32 *xdr_decode_time (__be32 *p,struct timespec *timep) +static __be32 *xdr_decode_time (__be32 *p,struct timespec64 *timep) { timep->tv_sec =be32_to_cpup (p++); timep->tv_nsec =be32_to_cpup (p++) *NSEC_PER_USEC ;
fs/nfs/nfs3xdr.c +1 -1
@@ -463,7 +463,7 @@ static __be32 *xdr_encode_nfstime3(__be32 *p, const struct timespec *timep)return p; } -static __be32 *xdr_decode_nfstime3 (__be32 *p,struct timespec *timep) +static __be32 *xdr_decode_nfstime3 (__be32 *p,struct timespec64 *timep) { timep->tv_sec =be32_to_cpup (p++); timep->tv_nsec =be32_to_cpup (p++);
fs/nfs/nfs4xdr.c +12 -12
@@ -4065,17 +4065,17 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint }static __be32 * -xdr_decode_nfstime4 (__be32 *p,struct timespec *t) +xdr_decode_nfstime4 (__be32 *p,struct timespec64 *t) {__u64 sec; p =xdr_decode_hyper (p, &sec); - t-> tv_sec = (time_t )sec; + t-> tv_sec = sec; t->tv_nsec =be32_to_cpup (p++);return p; } -static int decode_attr_time (struct xdr_stream *xdr,struct timespec *time) +static int decode_attr_time (struct xdr_stream *xdr,struct timespec64 *time) {__be32 *p;
@@ -4086,7 +4086,7 @@ static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time)return 0 ; } -static int decode_attr_time_access (struct xdr_stream *xdr,uint32_t *bitmap,struct timespec *time) +static int decode_attr_time_access (struct xdr_stream *xdr,uint32_t *bitmap,struct timespec64 *time) {int status =0 ;
@@ -4100,11 +4100,11 @@ static int decode_attr_time_access(struct xdr_stream *xdr, uint32_t *bitmap, str status =NFS_ATTR_FATTR_ATIME ; bitmap[1 ] &= ~FATTR4_WORD1_TIME_ACCESS ; } -dprintk ("%s: atime=%ld\n" , __func__, (long )time->tv_sec); +dprintk ("%s: atime=%lld\n" , __func__, time->tv_sec);return status; } -static int decode_attr_time_metadata (struct xdr_stream *xdr,uint32_t *bitmap,struct timespec *time) +static int decode_attr_time_metadata (struct xdr_stream *xdr,uint32_t *bitmap,struct timespec64 *time) {int status =0 ;
@@ -4118,12 +4118,12 @@ static int decode_attr_time_metadata(struct xdr_stream *xdr, uint32_t *bitmap, s status =NFS_ATTR_FATTR_CTIME ; bitmap[1 ] &= ~FATTR4_WORD1_TIME_METADATA ; } -dprintk ("%s: ctime=%ld\n" , __func__, (long )time->tv_sec); +dprintk ("%s: ctime=%lld\n" , __func__, time->tv_sec);return status; }static int decode_attr_time_delta (struct xdr_stream *xdr,uint32_t *bitmap, -struct timespec *time) +struct timespec64 *time) {int status =0 ;
@@ -4135,8 +4135,8 @@ static int decode_attr_time_delta(struct xdr_stream *xdr, uint32_t *bitmap, status =decode_attr_time (xdr, time); bitmap[1 ] &= ~FATTR4_WORD1_TIME_DELTA ; } -dprintk ("%s: time_delta=%ld %ld\n" , __func__, (long )time->tv_sec, - (long )time->tv_nsec); +dprintk ("%s: time_delta=%lld %ld\n" , __func__, time->tv_sec, + time->tv_nsec);return status; }
@@ -4186,7 +4186,7 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap,return status; } -static int decode_attr_time_modify (struct xdr_stream *xdr,uint32_t *bitmap,struct timespec *time) +static int decode_attr_time_modify (struct xdr_stream *xdr,uint32_t *bitmap,struct timespec64 *time) {int status =0 ;
@@ -4200,7 +4200,7 @@ static int decode_attr_time_modify(struct xdr_stream *xdr, uint32_t *bitmap, str status =NFS_ATTR_FATTR_MTIME ; bitmap[1 ] &= ~FATTR4_WORD1_TIME_MODIFY ; } -dprintk ("%s: mtime=%ld\n" , __func__, (long )time->tv_sec); +dprintk ("%s: mtime=%lld\n" , __func__, time->tv_sec);return status; }
include/linux/nfs_fs_sb.h +1 -1
@@ -171,7 +171,7 @@ struct nfs_server {struct nfs_fsid fsid;__u64 maxfilesize;/* maximum file size */ -struct timespec time_delta;/* smallest time granularity */ +struct timespec64 time_delta;/* smallest time granularity */ unsigned long mount_time;/* when this fs was mounted */ struct super_block *super;/* VFS super block */ dev_t s_dev;/* superblock dev numbers */
include/linux/nfs_xdr.h +6 -6
@@ -62,14 +62,14 @@ struct nfs_fattr {struct nfs_fsid fsid;__u64 fileid;__u64 mounted_on_fileid; -struct timespec atime; -struct timespec mtime; -struct timespec ctime; +struct timespec64 atime; +struct timespec64 mtime; +struct timespec64 ctime;__u64 change_attr;/* NFSv4 change attribute */ __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ __u64 pre_size;/* pre_op_attr.size */ -struct timespec pre_mtime;/* pre_op_attr.mtime */ -struct timespec pre_ctime;/* pre_op_attr.ctime */ +struct timespec64 pre_mtime;/* pre_op_attr.mtime */ +struct timespec64 pre_ctime;/* pre_op_attr.ctime */ unsigned long time_start;unsigned long gencount;struct nfs4_string *owner_name;
@@ -143,7 +143,7 @@ struct nfs_fsinfo {__u32 wtmult;/* writes should be multiple of this */ __u32 dtpref;/* pref. readdir transfer size */ __u64 maxfilesize; -struct timespec time_delta;/* server time granularity */ +struct timespec64 time_delta;/* server time granularity */ __u32 lease_time;/* in seconds */ __u32 nlayouttypes;/* number of layouttypes */ __u32 layouttype[NFS_MAX_LAYOUT_TYPES ];/* supported pnfs layout driver */
Signature · 1 line
2.20.0
PATCH 4/19 nfs: callback: use timespec64 in cb_getattrres
In reply to Arnd BergmannMake this use 64-bit timestamps to not lose information on 32-bit architectures. As both the input and the ouput are 64-bit wide, this is the obvious step.
--- fs/nfs/callback.h | 4 ++-- fs/nfs/callback_proc.c | 4 ++-- fs/nfs/callback_xdr.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-)
fs/nfs/callback.h +2 -2
@@ -72,8 +72,8 @@ struct cb_getattrres {uint32_t bitmap[2 ];uint64_t size;uint64_t change_attr; -struct timespec ctime; -struct timespec mtime; +struct timespec64 ctime; +struct timespec64 mtime; };struct cb_recallargs {
fs/nfs/callback_proc.c +2 -2
@@ -56,8 +56,8 @@ __be32 nfs4_callback_getattr(void *argp, void *resp, res->change_attr = delegation->change_attr;if (nfs_have_writebacks (inode)) res->change_attr++; - res->ctime =timespec64_to_timespec (inode->i_ctime); - res->mtime =timespec64_to_timespec (inode->i_mtime); + res->ctime = inode->i_ctime; + res->mtime = inode->i_mtime; res->bitmap[0 ] = (FATTR4_WORD0_CHANGE |FATTR4_WORD0_SIZE ) & args->bitmap[0 ]; res->bitmap[1] = (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY) &
fs/nfs/callback_xdr.c +3 -3
@@ -627,7 +627,7 @@ static __be32 encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, ureturn 0 ; } -static __be32 encode_attr_time (struct xdr_stream *xdr,const struct timespec *time) +static __be32 encode_attr_time (struct xdr_stream *xdr,const struct timespec64 *time) {__be32 *p;
@@ -639,14 +639,14 @@ static __be32 encode_attr_time(struct xdr_stream *xdr, const struct timespec *tireturn 0 ; } -static __be32 encode_attr_ctime (struct xdr_stream *xdr,const uint32_t *bitmap,const struct timespec *time) +static __be32 encode_attr_ctime (struct xdr_stream *xdr,const uint32_t *bitmap,const struct timespec64 *time) {if (!(bitmap[1 ] &FATTR4_WORD1_TIME_METADATA ))return 0 ;return encode_attr_time (xdr,time); } -static __be32 encode_attr_mtime (struct xdr_stream *xdr,const uint32_t *bitmap,const struct timespec *time) +static __be32 encode_attr_mtime (struct xdr_stream *xdr,const uint32_t *bitmap,const struct timespec64 *time) {if (!(bitmap[1 ] &FATTR4_WORD1_TIME_MODIFY ))return 0 ;
Signature · 1 line
2.20.0
PATCH 5/19 nfs: fscache: use timespec64 in inode auxdata
In reply to Arnd Bergmannnfs currently behaves differently on 32-bit and 64-bit kernels regarding the on-disk format of nfs_fscache_inode_auxdata.
That format should really be the same on any kernel, and we should avoid the 'timespec' type in order to remove that from the kernel later on.
Using plain 'timespec64' would not be good here, since that includes implied padding and would possibly leak kernel stack data to the on-disk format on 32-bit architectures.
struct __kernel_timespec would work as a replacement, but open-coding the two struct members in nfs_fscache_inode_auxdata makes it more obvious what's going on here, and keeps the current format for 64-bit architectures.
--- fs/nfs/fscache-index.c | 6 ++++-- fs/nfs/fscache.c | 18 ++++++++++++------ fs/nfs/fscache.h | 8 +++++--- 3 files changed, 21 insertions(+), 11 deletions(-)
fs/nfs/fscache-index.c +4 -2
@@ -84,8 +84,10 @@ enum fscache_checkaux nfs_fscache_inode_check_aux(void *cookie_netfs_data,return FSCACHE_CHECKAUX_OBSOLETE ;memset (&auxdata,0 ,sizeof (auxdata)); - auxdata.mtime =timespec64_to_timespec (nfsi->vfs_inode.i_mtime); - auxdata.ctime =timespec64_to_timespec (nfsi->vfs_inode.i_ctime); + auxdata.mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec; + auxdata.mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec; + auxdata.ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec; + auxdata.ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec;if (NFS_SERVER (&nfsi->vfs_inode)->nfs_client->rpc_ops->version ==4 ) auxdata.change_attr =inode_peek_iversion_raw (&nfsi->vfs_inode);
fs/nfs/fscache.c +12 -6
@@ -238,8 +238,10 @@ void nfs_fscache_init_inode(struct inode *inode)return ;memset (&auxdata,0 ,sizeof (auxdata)); - auxdata.mtime =timespec64_to_timespec (nfsi->vfs_inode.i_mtime); - auxdata.ctime =timespec64_to_timespec (nfsi->vfs_inode.i_ctime); + auxdata.mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec; + auxdata.mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec; + auxdata.ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec; + auxdata.ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec;if (NFS_SERVER (&nfsi->vfs_inode)->nfs_client->rpc_ops->version ==4 ) auxdata.change_attr =inode_peek_iversion_raw (&nfsi->vfs_inode);
@@ -263,8 +265,10 @@ void nfs_fscache_clear_inode(struct inode *inode)dfprintk (FSCACHE ,"NFS: clear cookie (0x%p/0x%p)\n" , nfsi, cookie);memset (&auxdata,0 ,sizeof (auxdata)); - auxdata.mtime =timespec64_to_timespec (nfsi->vfs_inode.i_mtime); - auxdata.ctime =timespec64_to_timespec (nfsi->vfs_inode.i_ctime); + auxdata.mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec; + auxdata.mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec; + auxdata.ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec; + auxdata.ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec;fscache_relinquish_cookie (cookie, &auxdata, false); nfsi->fscache =NULL ; }
@@ -305,8 +309,10 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp)return ;memset (&auxdata,0 ,sizeof (auxdata)); - auxdata.mtime =timespec64_to_timespec (nfsi->vfs_inode.i_mtime); - auxdata.ctime =timespec64_to_timespec (nfsi->vfs_inode.i_ctime); + auxdata.mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec; + auxdata.mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec; + auxdata.ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec; + auxdata.ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec;if (inode_is_open_for_write (inode)) {dfprintk (FSCACHE ,"NFS: nfsi 0x%p disabling cache\n" , nfsi);
fs/nfs/fscache.h +5 -3
@@ -62,9 +62,11 @@ struct nfs_fscache_key {* cache object. */ struct nfs_fscache_inode_auxdata { -struct timespec mtime; -struct timespec ctime; -u64 change_attr; +s64 mtime_sec; +s64 mtime_nsec; +s64 ctime_sec; +s64 ctime_nsec; +u64 change_attr; };/*
Signature · 1 line
2.20.0
PATCH 6/19 nfs: remove timespec from xdr_encode_nfstime
In reply to Arnd BergmannFor NFSv2 and NFSv3, timestamps are stored using 32-bit entities and overflow in y2038. For historic reasons we truncate the 64-bit timestamps by converting from a timespec64 to a timespec first.
Remove this unnecessary conversion step and do the truncation in the final functions that take a timestamp.
This is transparent to users, but avoids one of the last uses of 'timespec' and lets us remove it later.
--- fs/nfs/nfs2xdr.c | 31 +++++++++++++------------------ fs/nfs/nfs3xdr.c | 12 ++++-------- include/linux/nfs_xdr.h | 2 +- 3 files changed, 18 insertions(+), 27 deletions(-)
fs/nfs/nfs2xdr.c +13 -18
@@ -209,9 +209,9 @@ static int decode_fhandle(struct xdr_stream *xdr, struct nfs_fh *fh)* unsigned int useconds; * }; */ -static __be32 *xdr_encode_time (__be32 *p,const struct timespec *timep) +static __be32 *xdr_encode_time (__be32 *p,const struct timespec64 *timep) { - *p++ =cpu_to_be32 (timep->tv_sec); + *p++ =cpu_to_be32 ((u32 )timep->tv_sec);if (timep->tv_nsec !=0 ) *p++ =cpu_to_be32 (timep->tv_nsec /NSEC_PER_USEC );else
@@ -227,7 +227,7 @@ static __be32 *xdr_encode_time(__be32 *p, const struct timespec *timep)* Illustrated" by Brent Callaghan, Addison-Wesley, ISBN 0-201-32750-5. */ static __be32 *xdr_encode_current_server_time (__be32 *p, -const struct timespec *timep) +const struct timespec64 *timep) { *p++ =cpu_to_be32 (timep->tv_sec); *p++ =cpu_to_be32 (1000000 );
@@ -339,7 +339,6 @@ static __be32 *xdr_time_not_set(__be32 *p)static void encode_sattr (struct xdr_stream *xdr,const struct iattr *attr,struct user_namespace *userns) { -struct timespec ts;__be32 *p; p =xdr_reserve_space (xdr, NFS_sattr_sz <<2 );
@@ -361,21 +360,17 @@ static void encode_sattr(struct xdr_stream *xdr, const struct iattr *attr,else *p++ =cpu_to_be32 (NFS2_SATTR_NOT_SET ); -if (attr->ia_valid &ATTR_ATIME_SET ) { - ts =timespec64_to_timespec (attr->ia_atime); - p =xdr_encode_time (p, &ts); - }else if (attr->ia_valid &ATTR_ATIME ) { - ts =timespec64_to_timespec (attr->ia_atime); - p =xdr_encode_current_server_time (p, &ts); - }else +if (attr->ia_valid &ATTR_ATIME_SET ) + p =xdr_encode_time (p, &attr->ia_atime); +else if (attr->ia_valid &ATTR_ATIME ) + p =xdr_encode_current_server_time (p, &attr->ia_atime); +else p =xdr_time_not_set (p); -if (attr->ia_valid &ATTR_MTIME_SET ) { - ts =timespec64_to_timespec (attr->ia_atime); -xdr_encode_time (p, &ts); - }else if (attr->ia_valid &ATTR_MTIME ) { - ts =timespec64_to_timespec (attr->ia_mtime); -xdr_encode_current_server_time (p, &ts); - }else +if (attr->ia_valid &ATTR_MTIME_SET ) +xdr_encode_time (p, &attr->ia_atime); +else if (attr->ia_valid &ATTR_MTIME ) +xdr_encode_current_server_time (p, &attr->ia_mtime); +else xdr_time_not_set (p); }
fs/nfs/nfs3xdr.c +4 -8
@@ -456,9 +456,9 @@ static void zero_nfs_fh3(struct nfs_fh *fh)* uint32 nseconds; * }; */ -static __be32 *xdr_encode_nfstime3 (__be32 *p,const struct timespec *timep) +static __be32 *xdr_encode_nfstime3 (__be32 *p,const struct timespec64 *timep) { - *p++ =cpu_to_be32 (timep->tv_sec); + *p++ =cpu_to_be32 ((u32 )timep->tv_sec); *p++ =cpu_to_be32 (timep->tv_nsec);return p; }
@@ -533,7 +533,6 @@ static __be32 *xdr_decode_nfstime3(__be32 *p, struct timespec64 *timep)static void encode_sattr3 (struct xdr_stream *xdr,const struct iattr *attr,struct user_namespace *userns) { -struct timespec ts;u32 nbytes;__be32 *p;
@@ -583,10 +582,8 @@ static void encode_sattr3(struct xdr_stream *xdr, const struct iattr *attr, *p++ = xdr_zero;if (attr->ia_valid &ATTR_ATIME_SET ) { -struct timespec ts; *p++ = xdr_two; - ts =timespec64_to_timespec (attr->ia_atime); - p =xdr_encode_nfstime3 (p, &ts); + p =xdr_encode_nfstime3 (p, &attr->ia_atime); }else if (attr->ia_valid &ATTR_ATIME ) { *p++ = xdr_one; }else
@@ -594,8 +591,7 @@ static void encode_sattr3(struct xdr_stream *xdr, const struct iattr *attr,if (attr->ia_valid &ATTR_MTIME_SET ) { *p++ = xdr_two; - ts =timespec64_to_timespec (attr->ia_mtime); -xdr_encode_nfstime3 (p, &ts); +xdr_encode_nfstime3 (p, &attr->ia_mtime); }else if (attr->ia_valid &ATTR_MTIME ) { *p = xdr_one; }else
include/linux/nfs_xdr.h +1 -1
@@ -869,7 +869,7 @@ struct nfs3_sattrargs {struct nfs_fh * fh;struct iattr * sattr;unsigned int guard; -struct timespec guardtime; +struct timespec64 guardtime; };struct nfs3_diropargs {
Signature · 1 line
2.20.0
PATCH 7/19 nfs: encode nfsv4 timestamps as 64-bit
In reply to Arnd BergmannOn 32-bit architectures, xdr_encode_nfstime4() needlessly truncates timestamps to a 32-bit value in the range between year 1902 and 2038.
Change it to use 'struct timespec64' to allow the entire range of values supported by the server.
--- fs/nfs/nfs4xdr.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
fs/nfs/nfs4xdr.c +4 -7
@@ -1059,9 +1059,9 @@ static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *ve }static __be32 * -xdr_encode_nfstime4 (__be32 *p,const struct timespec *t) +xdr_encode_nfstime4 (__be32 *p,const struct timespec64 *t) { - p =xdr_encode_hyper (p, (__s64 )t->tv_sec); + p =xdr_encode_hyper (p, t->tv_sec); *p++ =cpu_to_be32 (t->tv_nsec);return p; }
@@ -1072,7 +1072,6 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,const struct nfs_server *server, const uint32_t attrmask[]) { - struct timespec ts; char owner_name[IDMAP_NAMESZ];char owner_group[IDMAP_NAMESZ ];int owner_namelen =0 ;
@@ -1161,16 +1160,14 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,if (bmval[1 ] &FATTR4_WORD1_TIME_ACCESS_SET ) {if (iap->ia_valid &ATTR_ATIME_SET ) { *p++ =cpu_to_be32 (NFS4_SET_TO_CLIENT_TIME ); - ts =timespec64_to_timespec (iap->ia_atime); - p =xdr_encode_nfstime4 (p, &ts); + p =xdr_encode_nfstime4 (p, &iap->ia_atime); }else *p++ =cpu_to_be32 (NFS4_SET_TO_SERVER_TIME ); }if (bmval[1 ] &FATTR4_WORD1_TIME_MODIFY_SET ) {if (iap->ia_valid &ATTR_MTIME_SET ) { *p++ =cpu_to_be32 (NFS4_SET_TO_CLIENT_TIME ); - ts =timespec64_to_timespec (iap->ia_mtime); - p =xdr_encode_nfstime4 (p, &ts); + p =xdr_encode_nfstime4 (p, &iap->ia_mtime); }else *p++ =cpu_to_be32 (NFS4_SET_TO_SERVER_TIME ); }
Signature · 1 line
2.20.0
PATCH 8/19 nfsd: use ktime_get_seconds() for timestamps
In reply to Arnd BergmannThe delegation logic in nfsd uses the somewhat inefficient seconds_since_boot() function to record time intervals.
--- fs/nfsd/nfs4state.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/nfsd/nfs4state.c +5 -5
@@ -806,7 +806,7 @@ static void nfs4_free_deleg(struct nfs4_stid *stid)static DEFINE_SPINLOCK (blocked_delegations_lock);static struct bloom_pair {int entries, old_entries; -time_t swap_time; +time64_t swap_time;int new;/* index into 'set' */ DECLARE_BITMAP(set[2], 256); } blocked_delegations;
@@ -818,15 +818,15 @@ static int delegation_blocked(struct knfsd_fh *fh)if (bd->entries ==0 )return 0 ; -if (seconds_since_boot () - bd->swap_time >30 ) { +if (ktime_get_seconds () - bd->swap_time >30 ) {spin_lock (&blocked_delegations_lock); -if (seconds_since_boot () - bd->swap_time >30 ) { +if (ktime_get_seconds () - bd->swap_time >30 ) { bd->entries -= bd->old_entries; bd->old_entries = bd->entries;memset (bd->set[bd->new],0 ,sizeof (bd->set[0 ])); bd->new =1 -bd->new; - bd->swap_time =seconds_since_boot (); + bd->swap_time =ktime_get_seconds (); }spin_unlock (&blocked_delegations_lock); }
@@ -856,7 +856,7 @@ static void block_delegations(struct knfsd_fh *fh)__set_bit ((hash>>8 )&255 , bd->set[bd->new]);__set_bit ((hash>>16 )&255 , bd->set[bd->new]);if (bd->entries ==0 ) - bd->swap_time =seconds_since_boot (); + bd->swap_time =ktime_get_seconds (); bd->entries +=1 ;spin_unlock (&blocked_delegations_lock); }
Signature · 1 line
2.20.0
PATCH 9/19 nfsd: print 64-bit timestamps in client_info_show
In reply to Arnd BergmannThe nii_time field gets truncated to 'time_t' on 32-bit architectures before printing.
Remove the use of 'struct timespec' to product the correct output beyond 2038.
--- fs/nfsd/nfs4state.c | 5 ++--- fs/nfsd/state.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-)
fs/nfsd/nfs4state.c +2 -3
@@ -2292,7 +2292,7 @@ static int client_info_show(struct seq_file *m, void *v) clp->cl_nii_domain.len);seq_printf (m,"\nImplementation name: " );seq_quote_mem (m, clp->cl_nii_name.data, clp->cl_nii_name.len); -seq_printf (m,"\nImplementation time: [%ld, %ld]\n" , +seq_printf (m,"\nImplementation time: [%lld, %ld]\n" , clp->cl_nii_time.tv_sec, clp->cl_nii_time.tv_nsec); }drop_client (clp);
@@ -2946,8 +2946,7 @@ static __be32 copy_impl_id(struct nfs4_client *clp,xdr_netobj_dup (&clp->cl_nii_name, &exid->nii_name,GFP_KERNEL );if (!clp->cl_nii_name.data)return nfserr_jukebox; - clp->cl_nii_time.tv_sec = exid->nii_time.tv_sec; - clp->cl_nii_time.tv_nsec = exid->nii_time.tv_nsec; + clp->cl_nii_time = exid->nii_time;return 0 ; }
fs/nfsd/state.h +1 -1
@@ -320,7 +320,7 @@ struct nfs4_client {/* NFSv4.1 client implementation id: */ struct xdr_netobj cl_nii_domain;struct xdr_netobj cl_nii_name; -struct timespec cl_nii_time; +struct timespec64 cl_nii_time;/* for v4.0 and v4.1 callbacks: */ struct nfs4_cb_conn cl_cb_conn;
Signature · 1 line
2.20.0
PATCH 10/19 nfsd: handle nfs3 timestamps as unsigned
In reply to Arnd BergmannThe decode_time3 function behaves differently on 32-bit and 64-bit architectures: on the former, a 32-bit timestamp gets converted into an signed number and then into a timestamp between 1902 and 2038, while on the latter it is interpreted as unsigned in the range 1970-2106.
Change all the remaining 'timespec' in nfsd to 'timespec64' to make the behavior the same, and use the current interpretation of the dominant 64-bit architectures.
--- fs/nfsd/nfs3xdr.c | 20 ++++++++------------ fs/nfsd/nfsfh.h | 4 ++-- 2 files changed, 10 insertions(+), 14 deletions(-)
fs/nfsd/nfs3xdr.c +8 -12
@@ -32,14 +32,14 @@ static u32 nfs3_ftypes[] = {* XDR functions for basic NFS types */ static __be32 * -encode_time3 (__be32 *p,struct timespec *time) +encode_time3 (__be32 *p,struct timespec64 *time) { *p++ =htonl ((u32 ) time->tv_sec); *p++ =htonl (time->tv_nsec);return p; }static __be32 * -decode_time3 (__be32 *p,struct timespec *time) +decode_time3 (__be32 *p,struct timespec64 *time) { time->tv_sec =ntohl (*p++); time->tv_nsec =ntohl (*p++);
@@ -167,7 +167,6 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat) {struct user_namespace *userns =nfsd_user_namespace (rqstp); -struct timespec ts; *p++ =htonl (nfs3_ftypes[(stat->mode &S_IFMT ) >>12 ]); *p++ =htonl ((u32) (stat->mode &S_IALLUGO )); *p++ =htonl ((u32 ) stat->nlink);
@@ -183,12 +182,9 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, *p++ =htonl ((u32 )MINOR (stat->rdev)); p =encode_fsid (p, fhp); p =xdr_encode_hyper (p, stat->ino); - ts =timespec64_to_timespec (stat->atime); - p =encode_time3 (p, &ts); - ts =timespec64_to_timespec (stat->mtime); - p =encode_time3 (p, &ts); - ts =timespec64_to_timespec (stat->ctime); - p =encode_time3 (p, &ts); + p =encode_time3 (p, &stat->atime); + p =encode_time3 (p, &stat->mtime); + p =encode_time3 (p, &stat->ctime);return p; }
@@ -277,8 +273,8 @@ void fill_pre_wcc(struct svc_fh *fhp) stat.size = inode->i_size; } - fhp->fh_pre_mtime =timespec64_to_timespec (stat.mtime); - fhp->fh_pre_ctime =timespec64_to_timespec (stat.ctime); + fhp->fh_pre_mtime = stat.mtime; + fhp->fh_pre_ctime = stat.ctime; fhp->fh_pre_size = stat.size; fhp->fh_pre_change =nfsd4_change_attribute (&stat, inode); fhp->fh_pre_saved = true;
@@ -330,7 +326,7 @@ nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p) p =decode_sattr3 (p, &args->attrs,nfsd_user_namespace (rqstp));if ((args->check_guard =ntohl (*p++)) !=0 ) { -struct timespec time; +struct timespec64 time; p =decode_time3 (p, &time); args->guardtime = time.tv_sec; }
fs/nfsd/nfsfh.h +2 -2
@@ -42,8 +42,8 @@ typedef struct svc_fh {/* Pre-op attributes saved during fh_lock */ __u64 fh_pre_size;/* size before operation */ -struct timespec fh_pre_mtime;/* mtime before oper */ -struct timespec fh_pre_ctime;/* ctime before oper */ +struct timespec64 fh_pre_mtime;/* mtime before oper */ +struct timespec64 fh_pre_ctime;/* ctime before oper */ /* * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode) * to find out if it is valid.
Signature · 1 line
2.20.0
PATCH 11/19 nfsd: use timespec64 in encode_time_delta
In reply to Arnd BergmannThe values in encode_time_delta are always small and don't overflow the range of 'struct timespec', so changing it has no effect.
Change it to timespec64 as a prerequisite for removing the timespec definition later.
--- fs/nfsd/nfs4xdr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4xdr.c +2 -2
@@ -2024,11 +2024,11 @@ static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode,*/ static __be32 *encode_time_delta (__be32 *p,struct inode *inode) { -struct timespec ts; +struct timespec64 ts;u32 ns; ns =max_t (u32,NSEC_PER_SEC /HZ , inode->i_sb->s_time_gran); - ts =ns_to_timespec (ns); + ts =ns_to_timespec64 (ns); p =xdr_encode_hyper (p, ts.tv_sec); *p++ =cpu_to_be32 (ts.tv_nsec);
Signature · 1 line
2.20.0
PATCH 12/19 nfsd: make 'boot_time' 64-bit wide
In reply to Arnd BergmannThe local boot time variable gets truncated to time_t at the moment, which can lead to slightly odd behavior on 32-bit architectures.
Use ktime_get_real_seconds() instead of get_seconds() to always get a 64-bit result, and keep it that way wherever possible.
It still gets truncated in a few places:
- When assigning to cl_clientid.cl_boot, this is already documented and is only used as a unique identifier.
- In clients_still_reclaiming(), the truncation is to 'unsigned long' in order to use the 'time_before() helper.
--- fs/nfsd/netns.h | 2 +- fs/nfsd/nfs4recover.c | 8 ++++---- fs/nfsd/nfs4state.c | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-)
fs/nfsd/netns.h +1 -1
@@ -40,7 +40,7 @@ struct nfsd_net {struct lock_manager nfsd4_manager;bool grace_ended; -time_t boot_time; +time64_t boot_time;/* internal mount of the "nfsd" pseudofilesystem: */ struct vfsmount *nfsd_mnt;
fs/nfsd/nfs4recover.c +4 -4
@@ -1445,7 +1445,7 @@ nfsd4_cld_grace_done_v0(struct nfsd_net *nn) } cup->cu_u.cu_msg.cm_cmd = Cld_GraceDone; - cup->cu_u.cu_msg.cm_u.cm_gracetime = (int64_t )nn->boot_time; + cup->cu_u.cu_msg.cm_u.cm_gracetime = nn->boot_time; ret =cld_pipe_upcall (cn->cn_pipe, &cup->cu_u.cu_msg);if (!ret) ret = cup->cu_u.cu_msg.cm_status;
@@ -1780,7 +1780,7 @@ nfsd4_cltrack_client_has_session(struct nfs4_client *clp) }static char * -nfsd4_cltrack_grace_start (time_t grace_start) +nfsd4_cltrack_grace_start (time64_t grace_start) {int copied;size_t len;
@@ -1793,7 +1793,7 @@ nfsd4_cltrack_grace_start(time_t grace_start)if (!result)return result; - copied =snprintf (result, len,GRACE_START_ENV_PREFIX "%ld" , + copied =snprintf (result, len,GRACE_START_ENV_PREFIX "%lld" , grace_start);if (copied >= len) {/* just return nothing if output was truncated */
@@ -2007,7 +2007,7 @@ nfsd4_umh_cltrack_grace_done(struct nfsd_net *nn)char *legacy;char timestr[22 ];/* FIXME: better way to determine max size? */ -sprintf (timestr,"%ld" , nn->boot_time); +sprintf (timestr,"%lld" , nn->boot_time); legacy =nfsd4_cltrack_legacy_topdir ();nfsd4_umh_cltrack_upcall ("gracedone" , timestr, legacy,NULL );kfree (legacy);
fs/nfsd/nfs4state.c +7 -7
@@ -753,7 +753,7 @@ int nfs4_init_cp_state(struct nfsd_net *nn, struct nfsd4_copy *copy)if (new_id <0 )return 0 ; copy->cp_stateid.si_opaque.so_id = new_id; - copy->cp_stateid.si_opaque.so_clid.cl_boot = nn->boot_time; + copy->cp_stateid.si_opaque.so_clid.cl_boot = (u32 )nn->boot_time; copy->cp_stateid.si_opaque.so_clid.cl_id = nn->s2s_cp_cl_id;return 1 ; }
@@ -1862,7 +1862,7 @@ STALE_CLIENTID(clientid_t *clid, struct nfsd_net *nn)*/ if (clid->cl_boot == (u32 )nn->boot_time)return 0 ; -dprintk ("NFSD stale clientid (%08x/%08x) boot_time %08lx\n" , +dprintk ("NFSD stale clientid (%08x/%08x) boot_time %08llx\n" , clid->cl_boot, clid->cl_id, nn->boot_time);return 1 ; }
@@ -2222,7 +2222,7 @@ static void gen_confirm(struct nfs4_client *clp, struct nfsd_net *nn)static void gen_clid (struct nfs4_client *clp,struct nfsd_net *nn) { - clp->cl_clientid.cl_boot = nn->boot_time; + clp->cl_clientid.cl_boot = (u32 )nn->boot_time; clp->cl_clientid.cl_id = nn->clientid_counter++;gen_confirm (clp, nn); }
@@ -5178,9 +5178,9 @@ nfsd4_end_grace(struct nfsd_net *nn)*/ static bool clients_still_reclaiming(struct nfsd_net *nn) { - unsigned long now = get_seconds(); - unsigned long double_grace_period_end = nn->boot_time + - 2 * nn->nfsd4_lease; + unsigned long now = (unsigned long) ktime_get_real_seconds(); + unsigned long double_grace_period_end = (unsigned long)nn->boot_time + + 2 * (unsigned long)nn->nfsd4_lease; if (nn->track_reclaim_completes && atomic_read(&nn->nr_reclaim_complete) ==
@@ -7635,7 +7635,7 @@ static int nfs4_state_create_net(struct net *net)INIT_LIST_HEAD (&nn->sessionid_hashtbl[i]); nn->conf_name_tree =RB_ROOT ; nn->unconf_name_tree =RB_ROOT ; - nn->boot_time =get_seconds (); + nn->boot_time =ktime_get_real_seconds (); nn->grace_ended = false; nn->nfsd4_manager.block_opens = true;INIT_LIST_HEAD (&nn->nfsd4_manager.list);
Signature · 1 line
2.20.0
PATCH 13/19 nfsd: pass a 64-bit guardtime to nfsd_setattr()
In reply to Arnd BergmannGuardtime handling in nfs3 differs between 32-bit and 64-bit architectures, and uses the deprecated time_t type.
Change it to using time64_t, which behaves the same way on 64-bit and 32-bit architectures, treating the number as an unsigned 32-bit entity with a range of year 1970 to 2106 consistently, and avoiding the y2038 overflow.
--- fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/nfs4state.c | 2 +- fs/nfsd/nfsproc.c | 4 ++-- fs/nfsd/vfs.c | 4 ++-- fs/nfsd/vfs.h | 2 +- fs/nfsd/xdr3.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-)
fs/nfsd/nfs4proc.c +1 -1
@@ -975,7 +975,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,if (status) goto out; status =nfsd_setattr (rqstp, &cstate->current_fh, &setattr->sa_iattr, -0 , (time_t )0 ); +0 , (time64_t )0 ); out:fh_drop_write (&cstate->current_fh);return status;
fs/nfsd/nfs4state.c +1 -1
@@ -4666,7 +4666,7 @@ nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh,return 0 ;if (!(open->op_share_access &NFS4_SHARE_ACCESS_WRITE ))return nfserr_inval; -return nfsd_setattr (rqstp, fh, &iattr,0 , (time_t )0 ); +return nfsd_setattr (rqstp, fh, &iattr,0 , (time64_t )0 ); } static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, struct nfs4_file *fp,
fs/nfsd/nfsproc.c +2 -2
@@ -113,7 +113,7 @@ nfsd_proc_setattr(struct svc_rqst *rqstp) } } - nfserr =nfsd_setattr (rqstp, fhp, iap,0 , (time_t )0 ); + nfserr =nfsd_setattr (rqstp, fhp, iap,0 , (time64_t )0 ); done:return nfsd_return_attrs (nfserr, resp); }
@@ -380,7 +380,7 @@ nfsd_proc_create(struct svc_rqst *rqstp)*/ attr->ia_valid &=ATTR_SIZE ;if (attr->ia_valid) - nfserr =nfsd_setattr (rqstp, newfhp, attr,0 , (time_t )0 ); + nfserr =nfsd_setattr (rqstp, newfhp, attr,0 , (time64_t )0 ); } out_unlock:
fs/nfsd/vfs.c +2 -2
@@ -358,7 +358,7 @@ nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp,*/ __be32 nfsd_setattr (struct svc_rqst *rqstp,struct svc_fh *fhp,struct iattr *iap, -int check_guard,time_t guardtime) +int check_guard,time64_t guardtime) {struct dentry *dentry;struct inode *inode;
@@ -1117,7 +1117,7 @@ nfsd_create_setattr(struct svc_rqst *rqstp, struct svc_fh *resfhp,if (!uid_eq (current_fsuid (),GLOBAL_ROOT_UID )) iap->ia_valid &= ~(ATTR_UID |ATTR_GID );if (iap->ia_valid) -return nfsd_setattr (rqstp, resfhp, iap,0 , (time_t )0 ); +return nfsd_setattr (rqstp, resfhp, iap,0 , (time64_t )0 );/* Callers expect file metadata to be committed here */ return nfserrno (commit_metadata (resfhp)); }
fs/nfsd/vfs.h +1 -1
@@ -48,7 +48,7 @@ __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, const char *, unsigned int, struct svc_export **, struct dentry **);__be32 nfsd_setattr (struct svc_rqst *,struct svc_fh *, -struct iattr *,int ,time_t ); +struct iattr *,int ,time64_t );int nfsd_mountpoint (struct dentry *,struct svc_export *);#ifdef CONFIG_NFSD_V4 __be32 nfsd4_set_nfs4_label(struct svc_rqst *, struct svc_fh *,
fs/nfsd/xdr3.h +1 -1
@@ -14,7 +14,7 @@ struct nfsd3_sattrargs {struct svc_fh fh;struct iattr attrs;int check_guard; -time_t guardtime; +time64_t guardtime; };struct nfsd3_diropargs {
Signature · 1 line
2.20.0
PATCH 14/19 nfsd: use time64_t in nfsd_proc_setattr() check
In reply to Arnd BergmannChange to time64_t and ktime_get_real_seconds() to make the logic work correctly on 32-bit architectures beyond 2038.
--- fs/nfsd/nfsproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfsproc.c +1 -1
@@ -94,7 +94,7 @@ nfsd_proc_setattr(struct svc_rqst *rqstp)* Solaris, at least, doesn't seem to care what the time * request is. We require it be within 30 minutes of now. */ -time_t delta = iap->ia_atime.tv_sec -get_seconds (); +time64_t delta = iap->ia_atime.tv_sec -ktime_get_real_seconds (); nfserr =fh_verify (rqstp, fhp,0 ,NFSD_MAY_NOP );if (nfserr)
Signature · 1 line
2.20.0
PATCH 15/19 nfsd: fix delay timer on 32-bit architectures
In reply to Arnd BergmannThe nfsd4_cb_layout_done() function takes a 'time_t' value, multiplied by NSEC_PER_SEC*2 to get a nanosecond value.
This works fine on 64-bit architectures, but on 32-bit, any value over 1 second results in a signed integer overflow with unexpected results.
Cast one input to a 64-bit type in order to produce the same result that we have on 64-bit architectures, regarless of the type of nfsd4_lease.
--- fs/nfsd/nfs4layouts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4layouts.c +1 -1
@@ -675,7 +675,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task)/* Client gets 2 lease periods to return it */ cutoff =ktime_add_ns (task->tk_start, - nn->nfsd4_lease *NSEC_PER_SEC *2 ); + (u64 )nn->nfsd4_lease *NSEC_PER_SEC *2 );if (ktime_before (now, cutoff)) {rpc_delay (task,HZ /100 );/* 10 mili-seconds */
Signature · 1 line
2.20.0
PATCH 16/19 nfsd: fix jiffies/time_t mixup in LRU list
In reply to Arnd BergmannThe nfsd4_blocked_lock->nbl_time timestamp is recorded in jiffies, but then compared to a CLOCK_REALTIME timestamp later on, which makes no sense.
For consistency with the other timestamps, change this to use a time_t.
This is a change in behavior, which may cause regressions, but the current code is not sensible. On a system with CONFIG_HZ=1000, the 'time_after((unsigned long)nbl->nbl_time, (unsigned long)cutoff))' check is false for roughly the first 18 days of uptime and then true for the next 49 days.
--- fs/nfsd/nfs4state.c | 2 +- fs/nfsd/state.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4state.c +1 -1
@@ -6544,7 +6544,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, }if (fl_flags &FL_SLEEP ) { - nbl->nbl_time = jiffies; + nbl->nbl_time =get_seconds ();spin_lock (&nn->blocked_locks_lock);list_add_tail (&nbl->nbl_list, &lock_sop->lo_blocked);list_add_tail (&nbl->nbl_lru, &nn->blocked_locks_lru);
fs/nfsd/state.h +1 -1
@@ -605,7 +605,7 @@ static inline bool nfsd4_stateid_generation_after(stateid_t *a, stateid_t *b)struct nfsd4_blocked_lock {struct list_head nbl_list;struct list_head nbl_lru; -unsigned long nbl_time; +time_t nbl_time;struct file_lock nbl_lock;struct knfsd_fh nbl_fh;struct nfsd4_callback nbl_cb;
Signature · 1 line
2.20.0
PATCH 17/19 nfsd: use boottime for lease expiry alculation
In reply to Arnd BergmannA couple of time_t variables are only used to track the state of the lease time and its expiration. The code correctly uses the 'time_after()' macro to make this work on 32-bit architectures even beyond year 2038, but the get_seconds() function and the time_t type itself are deprecated as they behave inconsistently between 32-bit and 64-bit architectures and often lead to code that is not y2038 safe.
As a minor issue, using get_seconds() leads to problems with concurrent settimeofday() or clock_settime() calls, in the worst case timeout never triggering after the time has been set backwards.
Change nfsd to use time64_t and ktime_get_boottime_seconds() here. This is clearly excessive, as boottime by itself means we never go beyond 32 bits, but it does mean we handle this correctly and consistently without having to worry about corner cases and should be no more expensive than the previous implementation on 64-bit architectures.
The max_cb_time() function gets changed in order to avoid an expensive 64-bit division operation, but as the lease time is at most one hour, there is no change in behavior.
--- fs/nfsd/netns.h | 4 ++-- fs/nfsd/nfs4callback.c | 7 ++++++- fs/nfsd/nfs4state.c | 41 +++++++++++++++++++---------------------- fs/nfsd/nfsctl.c | 6 +++--- fs/nfsd/state.h | 8 ++++---- 5 files changed, 34 insertions(+), 32 deletions(-)
fs/nfsd/netns.h +2 -2
@@ -92,8 +92,8 @@ struct nfsd_net {bool in_grace;const struct nfsd4_client_tracking_ops *client_tracking_ops; -time_t nfsd4_lease; -time_t nfsd4_grace; +time64_t nfsd4_lease; +time64_t nfsd4_grace;bool somebody_reclaimed;bool track_reclaim_completes;
fs/nfsd/nfs4callback.c +6 -1
@@ -823,7 +823,12 @@ static const struct rpc_program cb_program = {static int max_cb_time (struct net *net) {struct nfsd_net *nn =net_generic (net, nfsd_net_id); -return max (nn->nfsd4_lease/10 , (time_t )1 ) *HZ ; + +/* nfsd4_lease is set to at most one hour */ +if (WARN_ON_ONCE (nn->nfsd4_lease >3600 )) +return 360 *HZ ; + +return max (((u32 )nn->nfsd4_lease)/10 ,1u ) *HZ ; }static const struct cred *get_backchannel_cred (struct nfs4_client *clp,struct rpc_clnt *client,struct nfsd4_session *ses)
fs/nfsd/nfs4state.c +19 -22
140 lines not on this page · raw message
fs/nfsd/nfsctl.c +3 -3
@@ -956,7 +956,7 @@ static ssize_t write_maxconn(struct file *file, char *buf, size_t size)#ifdef CONFIG_NFSD_V4 static ssize_t __nfsd4_write_time (struct file *file,char *buf,size_t size, -time_t *time,struct nfsd_net *nn) +time64_t *time,struct nfsd_net *nn) {char *mesg = buf;int rv, i;
@@ -984,11 +984,11 @@ static ssize_t __nfsd4_write_time(struct file *file, char *buf, size_t size, *time = i; } -return scnprintf (buf,SIMPLE_TRANSACTION_LIMIT ,"%ld\n" , *time); +return scnprintf (buf,SIMPLE_TRANSACTION_LIMIT ,"%lld\n" , *time); }static ssize_t nfsd4_write_time (struct file *file,char *buf,size_t size, -time_t *time,struct nfsd_net *nn) +time64_t *time,struct nfsd_net *nn) {ssize_t rv;
fs/nfsd/state.h +4 -4
@@ -132,7 +132,7 @@ struct nfs4_delegation {struct list_head dl_recall_lru;/* delegation recalled */ struct nfs4_clnt_odstate *dl_clnt_odstate;u32 dl_type; -time_t dl_time; +time64_t dl_time;/* For recall: */ int dl_retries;struct nfsd4_callback dl_recall;
@@ -310,7 +310,7 @@ struct nfs4_client {#endif struct xdr_netobj cl_name;/* id generated by client */ nfs4_verifier cl_verifier;/* generated by client */ -time_t cl_time;/* time of last lease renewal */ +time64_t cl_time;/* time of last lease renewal */ struct sockaddr_storage cl_addr;/* client ipaddress */ bool cl_mach_cred;/* SP4_MACH_CRED in force */ struct svc_cred cl_cred;/* setclientid principal */
@@ -448,7 +448,7 @@ struct nfs4_openowner {*/ struct list_head oo_close_lru;struct nfs4_ol_stateid *oo_last_closed_stid; -time_t oo_time;/* time of placement on so_close_lru */ +time64_t oo_time;/* time of placement on so_close_lru */ #define NFS4_OO_CONFIRMED 1unsigned char oo_flags; };
@@ -605,7 +605,7 @@ static inline bool nfsd4_stateid_generation_after(stateid_t *a, stateid_t *b)struct nfsd4_blocked_lock {struct list_head nbl_list;struct list_head nbl_lru; -time_t nbl_time; +time64_t nbl_time;struct file_lock nbl_lock;struct knfsd_fh nbl_fh;struct nfsd4_callback nbl_cb;
Signature · 1 line
2.20.0
PATCH 18/19 nfsd: use ktime_get_real_seconds() in nfs4_verifier
In reply to Arnd Bergmanngen_confirm() generates a unique identifier based on the current time. This overflows in year 2038, but that is harmless since it generally does not lead to duplicates, as long as the time has been initialized by a real-time clock or NTP.
Using ktime_get_boottime_seconds() or ktime_get_seconds() would avoid the overflow, but it would be more likely to result in non-unique numbers.
--- fs/nfsd/nfs4state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4state.c +1 -1
@@ -2215,7 +2215,7 @@ static void gen_confirm(struct nfs4_client *clp, struct nfsd_net *nn)* This is opaque to client, so no need to byte-swap. Use * __force to keep sparse happy */ - verf[0 ] = (__force __be32 )get_seconds (); + verf[0 ] = (__force __be32 )(u32 )ktime_get_real_seconds (); verf[1 ] = (__force __be32 )nn->clverifier_counter++;memcpy (clp->cl_confirm.data, verf,sizeof (clp->cl_confirm.data)); }
Signature · 1 line
2.20.0
PATCH 19/19 nfsd: remove nfs4_reset_lease() declarations
In reply to Arnd BergmannThe function was removed a long time ago, but the declaration and a dummy implementation are still there, referencing the deprecated time_t type.
Remove both.
--- fs/nfsd/nfsd.h | 2 -- 1 file changed, 2 deletions(-)
fs/nfsd/nfsd.h +0 -2
@@ -142,7 +142,6 @@ int nfs4_state_start(void);int nfs4_state_start_net (struct net *net);void nfs4_state_shutdown (void );void nfs4_state_shutdown_net (struct net *net); -void nfs4_reset_lease (time_t leasetime);int nfs4_reset_recoverydir (char *recdir);char *nfs4_recoverydir (void );bool nfsd4_spo_must_allow (struct svc_rqst *rqstp);
@@ -153,7 +152,6 @@ static inline int nfs4_state_start(void) { return 0; }static inline int nfs4_state_start_net (struct net *net) {return 0 ; }static inline void nfs4_state_shutdown (void ) { }static inline void nfs4_state_shutdown_net (struct net *net) { } -static inline void nfs4_reset_lease (time_t leasetime) { }static inline int nfs4_reset_recoverydir (char *recdir) {return 0 ; }static inline char *nfs4_recoverydir (void ) {return NULL ; }static inline bool nfsd4_spo_must_allow (struct svc_rqst *rqstp)
Signature · 1 line
2.20.0