From: Sergey Shtylyov Date: Mon, 8 Dec 2025 20:15:03 +0000 (+0300) Subject: NFSv4: pass lease period in seconds to nfs4_set_lease_period() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d57c44e918012db1f901d50bc9195a8812ad602;p=thirdparty%2Fkernel%2Fstable.git NFSv4: pass lease period in seconds to nfs4_set_lease_period() There's no need to multiply the lease period by HZ at all the call sites of nfs4_set_lease_period() -- it makes more sense to do that only once, inside that function, by passing to it lease period as 32-bit # of seconds instead of 32/64-bit *unsigned long* # of jiffies... Signed-off-by: Sergey Shtylyov Signed-off-by: Anna Schumaker --- diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 783df6901b84..b48e5b87cb2a 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -477,8 +477,7 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *); extern void nfs4_schedule_state_renewal(struct nfs_client *); extern void nfs4_kill_renewd(struct nfs_client *); extern void nfs4_renew_state(struct work_struct *); -extern void nfs4_set_lease_period(struct nfs_client *clp, unsigned long lease); - +extern void nfs4_set_lease_period(struct nfs_client *clp, u32 period); /* nfs4state.c */ extern const nfs4_stateid current_stateid; diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 7c9cf0983366..9c2ffe72cf33 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -5487,7 +5487,7 @@ static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, str err = _nfs4_do_fsinfo(server, fhandle, fsinfo); trace_nfs4_fsinfo(server, fhandle, fsinfo->fattr, err); if (err == 0) { - nfs4_set_lease_period(server->nfs_client, fsinfo->lease_time * HZ); + nfs4_set_lease_period(server->nfs_client, fsinfo->lease_time); break; } err = nfs4_handle_exception(server, err, &exception); diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c index 18ae614e5a6c..043b2de8d416 100644 --- a/fs/nfs/nfs4renewd.c +++ b/fs/nfs/nfs4renewd.c @@ -137,11 +137,12 @@ nfs4_kill_renewd(struct nfs_client *clp) * nfs4_set_lease_period - Sets the lease period on a nfs_client * * @clp: pointer to nfs_client - * @lease: new value for lease period + * @period: new value for lease period (in seconds) */ -void nfs4_set_lease_period(struct nfs_client *clp, - unsigned long lease) +void nfs4_set_lease_period(struct nfs_client *clp, u32 period) { + unsigned long lease = period * HZ; + spin_lock(&clp->cl_lock); clp->cl_lease_time = lease; spin_unlock(&clp->cl_lock); diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 3de1fb242c15..963719f35467 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -104,7 +104,7 @@ static int nfs4_setup_state_renewal(struct nfs_client *clp) status = nfs4_proc_get_lease_time(clp, &fsinfo); if (status == 0) { - nfs4_set_lease_period(clp, fsinfo.lease_time * HZ); + nfs4_set_lease_period(clp, fsinfo.lease_time); nfs4_schedule_state_renewal(clp); }