Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9790789rwp; Thu, 20 Jul 2023 09:41:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlHKy32xGw5yvqcDJybzN+4b7d/vGeUCGgIJlHBuzMXhO7Ky8uo8pvJUk1Oz1su+cBNGSlv2 X-Received: by 2002:a17:906:31d2:b0:994:4f08:2bad with SMTP id f18-20020a17090631d200b009944f082badmr5530756ejf.69.1689871319373; Thu, 20 Jul 2023 09:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689871319; cv=none; d=google.com; s=arc-20160816; b=InkqS3s0uqq0851wRYd0B2VODT9eaVrlWcO+QECEXZSWk5BJCpy+7xRPjMyBQV1ulo K2k9jLqtAqYXm7liGuxPwl48lf/nw9nF0gmby1tOgE07VDcPrE45mwxL9ublmH6bIAXZ nfgew+rJNq/0NGJKiNFRx+Rr2o5UeN9MNIoiNLtG9DI+X/UxLwdqeAlICScUZpUA4DAJ eez9mUvP0N0+JVJH26Jalpp7lVgCk8bfaxnZpZxNqMPIXvuENTZGn5eIIM3TTlUvHMzX n3K9451TgiGD5e0+s6bR7NtBa5A58ZYBqIK4w3+eGutJudkhUbVb1PsD62gOpDolWrBz PHeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=2gME/jlBfFp+8xl95AKBlT8xPNpXAgidZPMiIKzm32Y=; fh=cXcoA9oenQqNB1wydQ15lWWezAzGHUkmpaY9P8IaBOw=; b=uYhcr93TeXTs+KnHa4/X6V8KCPyiGau8HOQ1H5+Kv62uJUr+JTxgoAuyjisrLHXOva u4C80EelxJywE7gfXXnaFL+S+wCe09BcjxIvMQzeDWhJADgmfnr4pS7qgpPwwYuNzQ9Y kxWYexZuF6k3na78gCblrpui6ZtkVtR+7tcWDdLU40GfQYJ8ZZekn+ZKhVmb7kYj3HAK E68/fmMixJ5wXwZB4PykBRuJZNM69cslbPkp/pgLCGrQgda6VZnefDX68t2PLoWwMIhk 0mC/vWqlATSGAbpTqzlV99hHobRPnoUNIH46KNES2+OvrmvgzSj+nRhlODGhZviREv3u bLgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Fb92fS5a; 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 a2-20020a1709064a4200b00997e8b6eaa7si867730ejv.510.2023.07.20.09.40.39; Thu, 20 Jul 2023 09:41:59 -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=Fb92fS5a; 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 S229781AbjGTQjv (ORCPT + 99 others); Thu, 20 Jul 2023 12:39:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbjGTQjp (ORCPT ); Thu, 20 Jul 2023 12:39:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4315A2736; Thu, 20 Jul 2023 09:39:25 -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 C224F61B8D; Thu, 20 Jul 2023 16:38:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 643A1C433C9; Thu, 20 Jul 2023 16:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689871138; bh=2gME/jlBfFp+8xl95AKBlT8xPNpXAgidZPMiIKzm32Y=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Fb92fS5asKJzq6Mu5j24cHQoFdOXPSZ/ZUap5QSJsjG/1bou29cK0J4edyVTnPCor aeW5PgvI/lVZiKEjyyd61uEIE/4fTiPifu2VETw7hYh3nVKL2eQtWRBmAlOi8VFVgp D+xZsb6fSDIMZWWP5k8fGFpxmizV0gv2IDeyl9htBBwxgqthhs8RO6bppbtUJmZDtp qkX1lLXiUiubi0nrCNH5m0hc7Fll3eGvF1wfLold/C/oTAyUz33c4+firN16khUIdr 5+0yP3WYRZGqgiVxPtki+TXwyZyN4lMUiRzh3t5tnO/0yTW1QLrsJA70N02hM8ctfM L7xdZBds0Lhtw== Message-ID: <016b04630ce7e168cbaacb1a27bd95b966b8c64e.camel@kernel.org> Subject: Re: [PATCH] nfsd: remove unsafe BUG_ON from set_change_info From: Jeff Layton To: Chuck Lever III Cc: Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Linux NFS Mailing List , "linux-kernel@vger.kernel.org" , Boyang Xue Date: Thu, 20 Jul 2023 12:38:56 -0400 In-Reply-To: References: <20230720-bz2223560-v1-1-edb4900043b8@kernel.org> <4B067A0F-93E3-435A-A32B-B17BC07D4606@oracle.com> <061f2b988de3da1dac32ecb3d8ac76319065b51d.camel@kernel.org> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 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 On Thu, 2023-07-20 at 15:37 +0000, Chuck Lever III wrote: >=20 > > On Jul 20, 2023, at 11:33 AM, Jeff Layton wrote: > >=20 > > On Thu, 2023-07-20 at 15:15 +0000, Chuck Lever III wrote: > > >=20 > > > > On Jul 20, 2023, at 10:59 AM, Jeff Layton wrot= e: > > > >=20 > > > > At one time, nfsd would scrape inode information directly out of st= ruct > > > > inode in order to populate the change_info4. At that time, the BUG_= ON in > > > > set_change_info made some sense, since having it unset meant a codi= ng > > > > error. > > > >=20 > > > > More recently, it calls vfs_getattr to get this information, which = can > > > > fail. If that fails, fh_pre_saved can end up not being set. While t= his > > > > situation is unfortunate, we don't need to crash the box. > > >=20 > > > I'm always happy to get rid of a BUG_ON(). But I'm not sure even > > > a warning is necessary in this case. It's not likely that it's > > > a software bug or something that the server administrator can > > > do something about. > > >=20 > > > Can you elaborate on why the vfs_getattr() might fail? Eg, how > > > was it failing in 2223560 ? > > >=20 > >=20 > > I'm fine with dropping the WARN_ON. You are correct that there is > > probably little the admin can do about it. > >=20 > > vfs_getattr can fail for all sorts of reasons. It really depends on the > > underlying filesystem. In 2223560, I don't know for sure, but just prio= r > > to the oops, there were these messages in the log: > >=20 > > [51935.482019] XFS (vda3): Filesystem has been shut down due to log err= or (0x2).=20 > > [51935.482020] XFS (vda3): Please unmount the filesystem and rectify th= e problem(s).=20 > > [51935.482550] vda3: writeback error on inode 25320400, offset 2097152,= sector 58684120=20 > >=20 > > My assumption was that the fs being shut down caused some VFS operation= s > > to start returning errors (including getattr) and that is why > > fh_pre_saved ultimately didn't get set. >=20 > I'm wondering if the operation should just fail in this case > rather than return a cobbled-up changeinfo4. Maybe for another > day. >=20 Actually, this doesn't look too hard to do. We should be able to just unwind and return an error in all cases if collecting pre_op_attrs fails. The trickier bit is what to do if collecting post_op_attrs fails after collecting pre-op attrs and the operation itself succeeded. What should go into the after_change value? 0? Should we just copy the before_change value? --=20 Jeff Layton