Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:33856 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753444AbdJTRry (ORCPT ); Fri, 20 Oct 2017 13:47:54 -0400 Date: Fri, 20 Oct 2017 13:47:48 -0400 From: "J. Bruce Fields" To: Olga Kornievskaia Cc: Trond Myklebust , linux-nfs Subject: Re: [PATCH 1/2] nfsd4: fix cached replies to solo SEQUENCE compounds Message-ID: <20171020174747.GC31637@parsley.fieldses.org> References: <1508361919-30495-1-git-send-email-bfields@redhat.com> <20171019181718.GF16942@parsley.fieldses.org> <20171019202015.GG16942@parsley.fieldses.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: Sender: linux-nfs-owner@vger.kernel.org List-ID: On Thu, Oct 19, 2017 at 05:19:40PM -0400, Olga Kornievskaia wrote: > On Thu, Oct 19, 2017 at 5:04 PM, Olga Kornievskaia wrote: > > I got this crash upon receiving the SEQUENCE that reused the slot that > > was used by the ctrl-c-ed COPY. Yeah, I was being inconsistent about what "NFSD4_SLOT_CACHED" meant--in replay_matches_cache I'm assuming opcnt and cred are still stored, but I wasn't storing them in nfsd4_store_cache_entry. Not sure why that didn't triger in my tests. Does this help? --b. diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index ace89bf45a0b..4b2107d11d5e 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2296,14 +2296,15 @@ nfsd4_store_cache_entry(struct nfsd4_compoundres *resp) slot->sl_flags |= NFSD4_SLOT_INITIALIZED; free_svc_cred(&slot->sl_cred); + copy_cred(&slot->sl_cred, &resp->rqstp->rq_cred); + slot->sl_opcnt = resp->opcnt; + slot->sl_status = resp->cstate.status; + if (!nfsd4_cache_this(resp)) { slot->sl_flags &= ~NFSD4_SLOT_CACHED; return; } slot->sl_flags |= NFSD4_SLOT_CACHED; - copy_cred(&slot->sl_cred, &resp->rqstp->rq_cred); - slot->sl_opcnt = resp->opcnt; - slot->sl_status = resp->cstate.status; base = resp->cstate.data_offset; slot->sl_datalen = buf->len - base;