Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9905552rwp; Thu, 20 Jul 2023 11:25:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlEu7LsOZfQTbbqLO+cF+Xjo1fiB4Kvbbvd9JB+mWbJkT/shR2XbSeYdX+sL8ecbLODYYAvv X-Received: by 2002:a19:5e1e:0:b0:4fb:c885:425 with SMTP id s30-20020a195e1e000000b004fbc8850425mr2591132lfb.9.1689877519278; Thu, 20 Jul 2023 11:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689877519; cv=none; d=google.com; s=arc-20160816; b=0R8e14IlhsEvevUsOTeDGzm88mNZxUYJFSN6iFx0OtwCpJv6M1lCeVlVnYp9UQCNRM F7zz3IOUXCl6T4H2ifpOZsZACY8rKBzpMlc4Yq10oiFUFiFIGm5nbOvONOjtVeKUz+aK 2y4rPxCQSzRtV7D7J0UNfnzbdsgybgk0C4zMzAWLmR5C/4oUbKnfzjuHcJmQsXEjqEa4 l/CjQhSN35hHNQvK6F0n/sJjswgBs1GERQZJ2Zg7TiruDZTFGM3y0PCedGJMLxx+n4Df KjlOdN6HcachA6JNdc+zKTH72DVxIhMGCmP8rwOWLmo87gjUfWx1UbC55un+gKaq66jG VSIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:dkim-signature; bh=TjoG3NTxpbWldSjOrDr+5yKdXOqd/6Bip8+IYLSPMyI=; fh=wryJ67aNNAfxHYcVRSABdXO3UEdEnufTHCKdLnm/ZR8=; b=lY3PwTr8V+lfwM2Wvfs6vBTE18gf9f8K8KmNmJc25hOhvOyKo+guBwK4jZfQUnUf3q eYz5ayvvv21CqnJCpPsQpVkJ++fjwp/+xzEEDjcVektOo0ZTVB/q2+yG0PPdi/WHblJ3 MazuF32HbzgHuhekRJvOeVRFqr0CIcq1LEb1fKwqKREPIqXoQpRAbV74MkdwNKIlwtDI jGqiWk5fMyzsZC8fmy0oV0SpAYWLWUq7epwcbCWNy2v63cu99BfZESKrhFwbZ34zL5VO AKK2olES+RQUTBvlcgmG+gPse2mMCdiRvEwi15cSOOG/DN2Nh71xILjPXdYk0+b+cDQ2 84yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f38kPZxP; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h18-20020a50ed92000000b0051d9db1a578si1164592edr.671.2023.07.20.11.24.23; Thu, 20 Jul 2023 11:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@kernel.org header.s=k20201202 header.b=f38kPZxP; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231276AbjGTSXf (ORCPT + 99 others); Thu, 20 Jul 2023 14:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbjGTSXe (ORCPT ); Thu, 20 Jul 2023 14:23:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E5292736; Thu, 20 Jul 2023 11:23:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CAD3461B9C; Thu, 20 Jul 2023 18:23:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CEE3C433C8; Thu, 20 Jul 2023 18:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689877411; bh=2xQwZH56W7CMb6ymICRaHKSgS+Np/hOlMyBTfdiGGG4=; h=From:Subject:Date:To:Cc:From; b=f38kPZxPdfuJ4Mhdkt+6Sl4gikjZUs4ZSxBNVWO40uyf87zMy2n9ifOfZXCYjZjL3 0u8hJpPK3WV3dG/kq+QR5L3Z0xLIX3QC2Q4KGO2WUKErZA4ldVn2TJT0GW23wbdKeA E0+vnMDc+ie4vMU6TavItIff2YUVxx9qQtGPi+gHELZyYCxhY3wsLWxdPeJaCgFEr+ HiC+9ylon4nlt+pnzgXnZf1pW1mg04GbGSt1rRKwzR/lBgyQIouIl8u6zuu9GehUQ5 CWGZ4BFONm5WeUfG9GPlI/2oI18jv0e/V+xWsK89SPxHuQWc9CGV7OHs398y1c5bOP uv3StBl0lKVvQ== From: Jeff Layton Subject: [PATCH v2 0/2] nfsd: sanely handle inabilty to fetch pre/post attributes Date: Thu, 20 Jul 2023 14:23:19 -0400 Message-Id: <20230720-bz2223560-v2-0-070aaf2660b7@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAJd7uWQC/23MQQ6CMBCF4auQWVsznVagrryHYUFhhEZDSWsal fTuVtYu/5eXb4PIwXGEc7VB4OSi80sJOlQwzP0ysXBjaSAkhQ2hsB8iUqcahRl0bbBvSTYWyn8 NfHOv3bp2pWcXnz68dzrJ3/pPSVJIwaPVBhG1su3lzmHhx9GHCbqc8xc0Bu2KowAAAA== To: Chuck Lever , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: Boyang Xue , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1363; i=jlayton@kernel.org; h=from:subject:message-id; bh=2xQwZH56W7CMb6ymICRaHKSgS+Np/hOlMyBTfdiGGG4=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBkuXuhrbJwqrdIEIAj6HTAlOivtz/AmSVwvewhy 4uthc+WAxeJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLl7oQAKCRAADmhBGVaC FdoGD/9q7MYxED2VFsn7NXxf/hSNhtb7cY2GUKJtFHubyn5SeMoxvlSI85evdDrQ/WjvyytqkNc W0e7tAeid5mY4VFMv3EHG7wXyr3DOYiOtBfqAaa1YBdsTWkFG+D0vCwJknWD87QcqI3d7bHgDMM y8xYgrxPhGENnGAHxJqwdWf1FukDpVY70eAw1zpD7ybjElhj5LfN5JCCdlL7lUpKcioQ/oSSxZD bXrnT+BYzSyzVeiBeiVsAnpvVsDZZ1m8FdpLV26ZI+EQQKpnx/fB4vAht0o2dWdzK8SBWq7JlSI EqnvhL1gMyCqutl7L6sFk6igBAqmcIaOkYlOzr+oA116SvG/vsLwzfiSbqVON9af+ksUdY/7q9+ MdAo6TGIGF/0qysfTxOSbU4FB0RkJpUYx9AW1dKSFxVJ9OywBOiU7tYIcTiTRGvk9iy7lPc1U+N 8ZiQuiEzEsyqPWy9mAPcwvB+QTqqfnxrcRl7GWlliYccZsMgMLVBYU0ErqqISzyuQR5EVpmTCWY Hv20SmEqltWCUxU0oGvJ0IRN52URdm+Yx8/iHg/QRvcrF0bVNVo/95yMCdQZWCzXKOckOVIYvmd 9w+Y7CFVU/63Zqkh2Rox9bmitmD0/qtdt2arWrUHDXvXIRJrYDPe3U05r7hLxmB0LsR3P1Iew5g 7fyT+Fx9rEzhnuA== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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-nfs@vger.kernel.org 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. 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. 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 --- Jeff Layton (2): nfsd: handle failure to collect pre/post-op attrs more sanely nfsd: remove unsafe BUG_ON from set_change_info 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 Best regards, -- Jeff Layton