diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index db79eba61bbf..1de6c6d757c3 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4251,12 +4251,18 @@ nfsd4_set_ex_flags(struct nfs4_client *new, struct nfsd4_exchange_id *clid) static bool client_has_openowners(struct nfs4_client *clp) { struct nfs4_openowner *oo; + bool found = false; + spin_lock(&clp->cl_lock); list_for_each_entry(oo, &clp->cl_openowners, oo_perclient) { - if (!list_empty(&oo->oo_owner.so_stateids)) - return true; + if (!list_empty(&oo->oo_owner.so_stateids)) { + found = true; + break; + } } - return false; + spin_unlock(&clp->cl_lock); + + return found; } static bool client_has_state(struct nfs4_client *clp)