From: Chuck Lever Date: Sun, 19 Apr 2026 18:53:04 +0000 (-0400) Subject: NFSD: Replace idr_for_each_entry_ul in find_one_sb_stid() X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=8fc274883530a9f2c9f69d96e0255df584b5ff61;p=thirdparty%2Fkernel%2Flinux.git NFSD: Replace idr_for_each_entry_ul in find_one_sb_stid() Replace idr_for_each_entry_ul() with a while loop over idr_get_next_ul() for consistency with find_one_export_stid(), added in a subsequent commit. No change in behavior. Reviewed-by: Jeff Layton Tested-by: Dai Ngo Signed-off-by: Chuck Lever --- diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 268aa1e5d19de..d96994627ba83 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1746,17 +1746,19 @@ static struct nfs4_stid *find_one_sb_stid(struct nfs4_client *clp, struct super_block *sb, unsigned int sc_types) { - unsigned long id, tmp; + unsigned long id = 0; struct nfs4_stid *stid; spin_lock(&clp->cl_lock); - idr_for_each_entry_ul(&clp->cl_stateids, stid, tmp, id) + while ((stid = idr_get_next_ul(&clp->cl_stateids, &id)) != NULL) { if ((stid->sc_type & sc_types) && stid->sc_status == 0 && stid->sc_file->fi_inode->i_sb == sb) { refcount_inc(&stid->sc_count); break; } + id++; + } spin_unlock(&clp->cl_lock); return stid; }