Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp35602rwn; Wed, 7 Sep 2022 19:26:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR71gp5nYbrchWPQd2fwnA6Pw6URmTuibbTkHBSUaKEJj2SdZt8Mnld3drKAYR+GFbsRw39N X-Received: by 2002:a05:6402:1e8d:b0:441:58db:b6a2 with SMTP id f13-20020a0564021e8d00b0044158dbb6a2mr5134372edf.277.1662603988991; Wed, 07 Sep 2022 19:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662603988; cv=none; d=google.com; s=arc-20160816; b=QTWhGfoGGNsAnTKVFqwU3pakRg1HU19uQVZrXl+0BD4xXbbJDAwzRU8aMlrw5KAyAe ULyDg9ZzIHGhSZs+FpMFELp38AvJKTgDlJsKAwcBqZBtB3GEMENfdis3EPlwxUhKaPts PH0yHHNEu2XOkVfTCYShsX5v0YwUvTryjmyILP4CZzWiPjQvScxPc6fAD3grgMZbdiaN U3CGZ+o+S4XP6noYYGSCu189cEfvv+dvgYfuowMiLmbtC0fSc2izCRp7cTs4Y808G9wG 4R4fiSHP+amn53uEcHFMEEKS2Jl531aEUX2iEgKtipnmKCH9g0O7yj0FqiRkNPcwmQQQ mdKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:mime-version :content-transfer-encoding:dkim-signature:dkim-signature; bh=bPLfOOe68eh88pjc1oFRBPnbrAFgPR4isLz78u+TjN0=; b=FSrwYeUv+JhIpbHaiMACO+R5/JfmVD7J1zL7RAzVuWbCKMyuzVwN2gAoeUmULxe9vv GmfGorzD/uSWAC5IxMfL7S63Mno/A8oXToEmRrTDRV7JyRZVkq4dkSH38sehNOIk6/SC wKh2bcnIYK3rN8ZFHQkGK3+l4QIFFW2vyhp9yBR86L9KFbrEpFmxQeqjuzUvUZG8ejF+ B/5v9fOsP/l6PMoahE7dWTjY+2I3ON+eyjoPx+r2aO6xsnz2rxzngNhAqnavNY/1D8Y6 uYKp1C/E9M/kMYwa8ARRpWVvmUkcz+qFkDOeig70HQVS7Rq9B1h4cmflC3R9Yh0qaxi1 xPgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="B/94qbZE"; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf28-20020a1709077f1c00b007269ef1872esi970251ejc.897.2022.09.07.19.25.48; Wed, 07 Sep 2022 19:26:28 -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=@suse.de header.s=susede2_rsa header.b="B/94qbZE"; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229579AbiIHCIt (ORCPT + 99 others); Wed, 7 Sep 2022 22:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbiIHCIr (ORCPT ); Wed, 7 Sep 2022 22:08:47 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E0679A6B4 for ; Wed, 7 Sep 2022 19:08:46 -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 3D71834360; Thu, 8 Sep 2022 02:08:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1662602925; 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; bh=bPLfOOe68eh88pjc1oFRBPnbrAFgPR4isLz78u+TjN0=; b=B/94qbZEsvkTIl1hleNVoLfiYUgNQtlZQLHnv/BMM9VcUHV2x2DGT6kxukP93BafxEA0JG g3D+48sa8O4Hp/coGz1k5oRnF95L4qdhfcZlLGO8ByeHoVtsk7cNGlxWDOm5MXiMbLgpdI 5qEoBssGJncfjgdWY3ullVhl1UQnzxA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1662602925; 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; bh=bPLfOOe68eh88pjc1oFRBPnbrAFgPR4isLz78u+TjN0=; b=5zDvarY3zBAZPRy21y17dGxSgGY3h0AhU8Bnarj8cyHv0+4+eVcgCsTKuWgPey83XLNZG2 nx1kMSb200jkFYCA== 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 02B431322C; Thu, 8 Sep 2022 02:08:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id O3gVKqtOGWP2RQAAMHmgww (envelope-from ); Thu, 08 Sep 2022 02:08:43 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: Chuck Lever III , Bruce Fields Cc: Linux NFS Mailing List Subject: [PATCH] NFSD: fix regression with setting ACLs. Date: Thu, 08 Sep 2022 12:08:40 +1000 Message-id: <166260292002.30452.4279820246560338475@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-nfs@vger.kernel.org A recent patch moved ACL setting into nfsd_setattr(). Unfortunately it didn't work as nfsd_setattr() aborts early if iap->ia_valid is 0. Remove this test, and instead avoid calling notify_change() when ia_valid is 0. This means that nfsd_setattr() will now *always* lock the inode. Previously it didn't if only a ATTR_MODE change was requested on a symlink (see Commit 15b7a1b86d66 ("[PATCH] knfsd: fix setattr-on-symlink error return")). I don't think this change really matters. Fixes: c0cbe70742f4 ("NFSD: add posix ACLs to struct nfsd_attrs") Signed-off-by: NeilBrown --- fs/nfsd/vfs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 9f486b788ed0..bffb31540df8 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -353,7 +353,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, int accmode = NFSD_MAY_SATTR; umode_t ftype = 0; __be32 err; - int host_err; + int host_err = 0; bool get_write_count; bool size_change = (iap->ia_valid & ATTR_SIZE); @@ -395,9 +395,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, if (S_ISLNK(inode->i_mode)) iap->ia_valid &= ~ATTR_MODE; - if (!iap->ia_valid) - return 0; - nfsd_sanitize_attrs(inode, iap); if (check_guard && guardtime != inode->i_ctime.tv_sec) @@ -448,8 +445,10 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, goto out_unlock; } - iap->ia_valid |= ATTR_CTIME; - host_err = notify_change(&init_user_ns, dentry, iap, NULL); + if (iap->ia_valid) { + iap->ia_valid |= ATTR_CTIME; + host_err = notify_change(&init_user_ns, dentry, iap, NULL); + } out_unlock: if (attr->na_seclabel && attr->na_seclabel->len) -- 2.37.1