From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6547C7EE24 for ; Wed, 31 May 2023 10:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235837AbjEaKMr (ORCPT ); Wed, 31 May 2023 06:12:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229748AbjEaKMq (ORCPT ); Wed, 31 May 2023 06:12:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 345DC113; Wed, 31 May 2023 03:12:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BBC2362C22; Wed, 31 May 2023 10:12:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B29D4C433D2; Wed, 31 May 2023 10:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685527964; bh=h9e+nfF/1mYstq8p3YQMnKuwbpqf8pMUVjhbs8r6/QE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=NDo4lgErINET9qRnnxeV6v+NDxXpXA5gZIFGJGCw6UHGHVSJ47sUFCFUgoJrbmshQ bPLJUo0k6wnGg0oHbW+MpG7HkGLTPuZ+7xJqEgVj2gHNQSV3u6QeX9az01YGE7x+L1 /1VVxSMPMbACVJXRZLv4NI5bgYhbN4VkSD8Ywi4P3pVEgoi9HftbBP1g9oN5cez/qR SvhVt2XG7YGJijgXoVGZssbgpQwTXhH0VN2e8Pl7zodj/i70NenGET20wwkCdzumFO q3PSVBTNUVysGyCEEtDj88I/oqFVPUhKzq0rsgW//A3zqjZhqhkkasLOhS45B2ToWX lDg8Ri53wXvfw== Message-ID: Subject: Re: [PATCH v3 2/2] NFSD: add counter for write delegation recall due to conflict with GETATTR From: Jeff Layton To: Dai Ngo , chuck.lever@oracle.com Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Date: Wed, 31 May 2023 06:12:42 -0400 In-Reply-To: <1685500507-23598-3-git-send-email-dai.ngo@oracle.com> References: <1685500507-23598-1-git-send-email-dai.ngo@oracle.com> <1685500507-23598-3-git-send-email-dai.ngo@oracle.com> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.2 (3.48.2-1.fc38) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Tue, 2023-05-30 at 19:35 -0700, Dai Ngo wrote: > Add counter to keep track of how many times write delegations are > recalled due to conflict with GETATTR. >=20 > Signed-off-by: Dai Ngo > --- > fs/nfsd/nfs4state.c | 1 + > fs/nfsd/stats.c | 2 ++ > fs/nfsd/stats.h | 7 +++++++ > 3 files changed, 10 insertions(+) >=20 > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > index 29ed2e72b665..cba27dfa39e8 100644 > --- a/fs/nfsd/nfs4state.c > +++ b/fs/nfsd/nfs4state.c > @@ -8402,6 +8402,7 @@ nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp= , struct inode *inode) > } > break_lease: > spin_unlock(&ctx->flc_lock); > + nfsd_stats_wdeleg_getattr_inc(); > status =3D nfserrno(nfsd_open_break_lease(inode, NFSD_MAY_READ)); > if (status !=3D nfserr_jukebox || > !nfsd_wait_for_delegreturn(rqstp, inode)) > diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c > index 777e24e5da33..63797635e1c3 100644 > --- a/fs/nfsd/stats.c > +++ b/fs/nfsd/stats.c > @@ -65,6 +65,8 @@ static int nfsd_show(struct seq_file *seq, void *v) > seq_printf(seq, " %lld", > percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_NFS4_OP(= i)])); > } > + seq_printf(seq, "\nwdeleg_getattr %lld", > + percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_WDELEG_GETAT= TR])); > =20 > seq_putc(seq, '\n'); > #endif > diff --git a/fs/nfsd/stats.h b/fs/nfsd/stats.h > index 9b43dc3d9991..cf5524e7ca06 100644 > --- a/fs/nfsd/stats.h > +++ b/fs/nfsd/stats.h > @@ -22,6 +22,7 @@ enum { > NFSD_STATS_FIRST_NFS4_OP, /* count of individual nfsv4 operations */ > NFSD_STATS_LAST_NFS4_OP =3D NFSD_STATS_FIRST_NFS4_OP + LAST_NFS4_OP, > #define NFSD_STATS_NFS4_OP(op) (NFSD_STATS_FIRST_NFS4_OP + (op)) > + NFSD_STATS_WDELEG_GETATTR, /* count of getattr conflict with wdeleg */ > #endif > NFSD_STATS_COUNTERS_NUM > }; > @@ -93,4 +94,10 @@ static inline void nfsd_stats_drc_mem_usage_sub(struct= nfsd_net *nn, s64 amount) > percpu_counter_sub(&nn->counter[NFSD_NET_DRC_MEM_USAGE], amount); > } > =20 > +#ifdef CONFIG_NFSD_V4 > +static inline void nfsd_stats_wdeleg_getattr_inc(void) > +{ > + percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_WDELEG_GETATTR]); > +} > +#endif > #endif /* _NFSD_STATS_H */ Personally, I think it would still be simpler to just do a CB_GETATTR. We are issuing a callback in either case, but recalling the delegation seems like a less optimal outcome. Still for an interim step, this is fine... Reviewed-by: Jeff Layton