Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp983981pxj; Wed, 2 Jun 2021 17:12:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNkVxtnO49iaW4gEqYMUj3PBPFGH/DSA3Pdfi5Xp/KbxbUDiNnI2n04ZXZYNlzxiJ5dff/ X-Received: by 2002:aa7:c7cd:: with SMTP id o13mr41753739eds.269.1622679149286; Wed, 02 Jun 2021 17:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622679149; cv=none; d=google.com; s=arc-20160816; b=AjMKbyiWV92sMulZ37l1mVfX7gOtcH8aoKzAcZ/zf+RepXgq6kz41cM8Ry3oQ3ae77 InoJkFQt21Truwu20scW1IsyFAy6tKMJSpx6RhstBDbpFL/Xljn5Iu0io+J842ZeUcyD E6/Pa+xgH73VsKvUSe14hEGzwf+0z7BNDqj5mIUTgL4D5QTyRGQHfFpg4atuySlfp7tq Ne/+I8jOHs3IeDvHns6y6sW4KSo450T3ZGQNZ11RLI6S0RdHQHgSTPLlQk4yJ/4eWFG5 hjbWjU9QFdiPjA3xSKIY7Ff6pDbqw85RDoougp3iDnStRbUeuiuHRlxuF1f6OXU1SBXN Aq3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=FhRRSvZn3mGTQIcHiye01pYLVN0k13spwwILJDOGoQc=; b=lNErNKW2GhVstUgrB9y+rqd1vXB8evNs9tLk/WvhtpEp3rWS0i5TSEVTP+OlXFMmQt QdQ2PSk16KZTAx2BMBHuLGEZSkR188Vd/cty82bZW2TRfmWic6c5ge0bC+JlGIFgWkLH UOW1944sIfJD8fKF25bdENtEMG1aM8n8h9A/odka+ua82cUT0mm0zd0VNRZ+FW3cp85R 7SdGV3dmexu59WguU4FBAcJ7Y8Rpe7d2YPKaGZei70U7jBdQ2MV5axY9OXVSlFsEd5pJ qNwQIl+MINf4YczBTOPu7SriVg/RGhqyFmrkLMFyRG45+oMiL5qK1ims3+guSaWMV4wY G3LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=cd70VPyl; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=cd70VPyl; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=nwnfVo44; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs11si959632ejc.609.2021.06.02.17.11.49; Wed, 02 Jun 2021 17:12:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=cd70VPyl; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=cd70VPyl; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=nwnfVo44; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbhFCAMb (ORCPT + 99 others); Wed, 2 Jun 2021 20:12:31 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:32778 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbhFCAMb (ORCPT ); Wed, 2 Jun 2021 20:12:31 -0400 Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6BE531FD30; Thu, 3 Jun 2021 00:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622679046; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FhRRSvZn3mGTQIcHiye01pYLVN0k13spwwILJDOGoQc=; b=cd70VPylyKZYi/X+klR5T0FuP2MK7im6ZeEduSxWj+KpC5sjMwtGlhIjlsLEQFxJbpYC1y 9kHa7+5m/Gl5Q0JhmdwGKNLaiZWfs7eW6/sru6g5+NApaA47/kXgRnL+X3Ur+R5c2C8ZEM mXBsqjdtoUTPi+9HpcSW6dD4JR1J5ZY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622679046; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FhRRSvZn3mGTQIcHiye01pYLVN0k13spwwILJDOGoQc=; b=nwnfVo44e8melLkYgSdvYpnJNOoV19Xx7xTc8u9zA7srFbcK6NYRc/eHqYP6GpVGP2MuoF ozHircsqKl+ax4Dw== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 6DCA0118DD; Thu, 3 Jun 2021 00:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622679046; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FhRRSvZn3mGTQIcHiye01pYLVN0k13spwwILJDOGoQc=; b=cd70VPylyKZYi/X+klR5T0FuP2MK7im6ZeEduSxWj+KpC5sjMwtGlhIjlsLEQFxJbpYC1y 9kHa7+5m/Gl5Q0JhmdwGKNLaiZWfs7eW6/sru6g5+NApaA47/kXgRnL+X3Ur+R5c2C8ZEM mXBsqjdtoUTPi+9HpcSW6dD4JR1J5ZY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622679046; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FhRRSvZn3mGTQIcHiye01pYLVN0k13spwwILJDOGoQc=; b=nwnfVo44e8melLkYgSdvYpnJNOoV19Xx7xTc8u9zA7srFbcK6NYRc/eHqYP6GpVGP2MuoF ozHircsqKl+ax4Dw== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id IGuACAUeuGAJdgAALh3uQQ (envelope-from ); Thu, 03 Jun 2021 00:10:45 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: "J. Bruce Fields" Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH] nfsd: move fsnotify on client creation outside spinlock In-reply-to: <20210602200639.GC6995@fieldses.org> References: <20210602200639.GC6995@fieldses.org> Date: Thu, 03 Jun 2021 10:10:39 +1000 Message-id: <162267903933.23712.6221073402758269956@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Thu, 03 Jun 2021, J. Bruce Fields wrote: > From: "J. Bruce Fields" > > This was causing a "sleeping function called from invalid context" > warning. > > I don't think we need the set_and_test_bit() here; clients move from > unconfirmed to confirmed only once, under the client_lock. > > The (conf == unconf) is a way to check whether we're in that confirming > case, hopefully that's not too obscure. It is a bit obscure, but I cannot see a cleaner way as it isn't too hard to work out what the test means by looking back at the code. So the only concern is that some later change might cause the test to subtly change meaning. Probably not a big concern. Anyway, thanks for fixing this up. NeilBrown > > Fixes: 472d155a0631 "nfsd: report client confirmation status in "info" file" > Signed-off-by: J. Bruce Fields > --- > fs/nfsd/nfs4state.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > index 99dfc668f605..c01ecb7b3fd3 100644 > --- a/fs/nfsd/nfs4state.c > +++ b/fs/nfsd/nfs4state.c > @@ -2824,11 +2824,8 @@ move_to_confirmed(struct nfs4_client *clp) > list_move(&clp->cl_idhash, &nn->conf_id_hashtbl[idhashval]); > rb_erase(&clp->cl_namenode, &nn->unconf_name_tree); > add_clp_to_name_tree(clp, &nn->conf_name_tree); > - if (!test_and_set_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags)) { > - trace_nfsd_clid_confirmed(&clp->cl_clientid); > - if (clp->cl_nfsd_dentry && clp->cl_nfsd_info_dentry) > - fsnotify_dentry(clp->cl_nfsd_info_dentry, FS_MODIFY); > - } > + set_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags); > + trace_nfsd_clid_confirmed(&clp->cl_clientid); > renew_client_locked(clp); > } > > @@ -3487,6 +3484,8 @@ nfsd4_create_session(struct svc_rqst *rqstp, > /* cache solo and embedded create sessions under the client_lock */ > nfsd4_cache_create_session(cr_ses, cs_slot, status); > spin_unlock(&nn->client_lock); > + if (conf == unconf) > + fsnotify_dentry(conf->cl_nfsd_info_dentry, FS_MODIFY); > /* init connection and backchannel */ > nfsd4_init_conn(rqstp, conn, new); > nfsd4_put_session(new); > @@ -4095,6 +4094,8 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, > } > get_client_locked(conf); > spin_unlock(&nn->client_lock); > + if (conf == unconf) > + fsnotify_dentry(conf->cl_nfsd_info_dentry, FS_MODIFY); > nfsd4_probe_callback(conf); > spin_lock(&nn->client_lock); > put_client_renew_locked(conf); > -- > 2.31.1 > >