Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10129528rwp; Thu, 20 Jul 2023 15:18:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlHZ93qVxkt4ooDv1c2xOPLW+iuOzklEzQkPjSlEdIy4+2b94pnSXgJ9bkoxF5EQoToChlVp X-Received: by 2002:a17:902:ec84:b0:1b8:7d0d:5ac5 with SMTP id x4-20020a170902ec8400b001b87d0d5ac5mr264362plg.50.1689891509323; Thu, 20 Jul 2023 15:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689891509; cv=none; d=google.com; s=arc-20160816; b=l1QtzQl+1kDxpnCm+QLnc/rl6goC0uN5Ii3vSwI8X3tkYcapbYS4rUeJRW+zPt8JfN ycWn7hKvRGU3Dq8iPcI1NY0Qog7ZNA9eX6n40QeezSpd99Uxu65FVncvFbufYNxjRshY sBDQSJX5EuCF/MO2aCTI7Tbz1SA5IpI4zXWL1EnKCTAXBlcUdL+FPzHTI/J3vAVtS6pV laVajiRcvsQyVHr2t93UJM96kta1NZI5VElmr/OVqpoLL6QuB0qNvL8dP8YcUypb3ZOI 0Ycj7+ilmX3w+P/7HV3svard8nYlRxK8/H2fLe70rJBKVLYaojxiB+qga1t8z/0ewTM4 HS5g== 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; bh=81OuUzF4A6RcuJi9Es3ThWlGwUbRgc9p9AMlF5AV7zM=; fh=WP/PqjgwptMgtCIJkkHECUZSQPiqzhJXeTUQ6a4YZww=; b=KFp+Sh6thbX98m4uRBWTiQTLfSiVKVUR3W5aiUds4FFmcDGkha5M6x6QvZ7dCOaK3v j/1SghwWZsUQaC6bax94wo3Snky2/CtUApmG8mmpLBqdQNLZpVleq3+6VfotC+qCSSqj jDoCPcQrMaX1oeMrZzSc8SVI4o5Nk8dUgzIBfycPwO7FjWk/5DiEa1TdC45icUQdYxYS LxPPguK6xQUeFgQ81uRLP1NiSd8gHv1GIwAJ2IWdxheD7HtGQc5L3ci2veMGmpnEP1cw /axtBVWCEVJeEDrnyKVLHC9yzfFFWDlo2/0Vmt3AkACFK6PeHrKGcqMHixvOtCMHIYdA /fIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SueN0P8j; dkim=neutral (no key) header.i=@suse.de header.b=MG3AE6zy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a170902684e00b001b02e044c87si1623414pln.320.2023.07.20.15.18.17; Thu, 20 Jul 2023 15:18:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SueN0P8j; dkim=neutral (no key) header.i=@suse.de header.b=MG3AE6zy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbjGTVm7 (ORCPT + 99 others); Thu, 20 Jul 2023 17:42:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230269AbjGTVmz (ORCPT ); Thu, 20 Jul 2023 17:42:55 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F3E11719; Thu, 20 Jul 2023 14:42:54 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1AE86224B7; Thu, 20 Jul 2023 21:42:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689889373; 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=81OuUzF4A6RcuJi9Es3ThWlGwUbRgc9p9AMlF5AV7zM=; b=SueN0P8jaFKXg0XTgTNJmT4EP5Wl+CzUOsYsOVVmAvGzGPlSrlyuCMmObbURyNtJxH/xC7 hvziDGLFYFSkFOost4PFKQrFlY0Z0WUTHnFDNMzhpGcWg7tnmVEmX9PbXE0pFfHrI6c7Ax h4xQf+xCLdRvjKNIr3FRfUn4WoXXveU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689889373; 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=81OuUzF4A6RcuJi9Es3ThWlGwUbRgc9p9AMlF5AV7zM=; b=MG3AE6zyegseBYJLaRSnXlNLblPfAeiAaNmiy6yjWOJfD+Y9bgLbv6rrS3SgTwiVtxe29x lpFnvF0kx9iAzaCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5029E138EC; Thu, 20 Jul 2023 21:42:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id RGVgAVqquWSBPwAAMHmgww (envelope-from ); Thu, 20 Jul 2023 21:42:50 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Jeff Layton" Cc: "Chuck Lever" , "Olga Kornievskaia" , "Dai Ngo" , "Tom Talpey" , "Boyang Xue" , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, "Jeff Layton" Subject: Re: [PATCH v2 0/2] nfsd: sanely handle inabilty to fetch pre/post attributes In-reply-to: <20230720-bz2223560-v2-0-070aaf2660b7@kernel.org> References: <20230720-bz2223560-v2-0-070aaf2660b7@kernel.org> Date: Fri, 21 Jul 2023 07:42:47 +1000 Message-id: <168988936713.11078.5407820394334916284@noble.neil.brown.name> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Jul 2023, Jeff Layton wrote: > Boyang reported tripping the BUG_ON in set_change_info. While we > couldn't confirm it, one way this could happen would be for nfsd_lookup > to succeed and then for fh_fill_both_attrs to fail. >=20 > This patchset attempts to (sanely) fix this, usually by aborting the > operation if fetching the pre attributes fails. Post-op attribute fetch > handling is more difficult to deal with however since we've already done > the operation, so this has it just fudge the change_info4 if that > occurs. I think both v3 and v4 allow a reply that says "the operation was a success but there are no post-op attrs". With v4 you can say "there is no change-attr, but here are some other attrs". I think. Our xdr-encoding doesn't make that easy, but it is just a "simple matter of coding". If you think it is worth it. NeilBrown >=20 > Signed-off-by: Jeff Layton > --- > Changes in v2: > - make fh_fill_*_attrs return an error and have the callers handle it > - rework of set_change_info, to better handle missing pre/post attrs >=20 > --- > Jeff Layton (2): > nfsd: handle failure to collect pre/post-op attrs more sanely > nfsd: remove unsafe BUG_ON from set_change_info >=20 > fs/nfsd/nfs3proc.c | 4 +++- > fs/nfsd/nfs4proc.c | 45 +++++++++++++++++++++++++++++++++------ > fs/nfsd/nfsfh.c | 26 ++++++++++++++--------- > fs/nfsd/nfsfh.h | 6 +++--- > fs/nfsd/vfs.c | 62 ++++++++++++++++++++++++++++++++++----------------= ---- > fs/nfsd/xdr4.h | 11 ---------- > 6 files changed, 100 insertions(+), 54 deletions(-) > --- > base-commit: 070f391ca4d48e1750ee6108eb44f751a9e9448e > change-id: 20230720-bz2223560-9c4690a8217b >=20 > Best regards, > --=20 > Jeff Layton >=20 >=20