From patchwork Wed Jan 11 22:07:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9511553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 23B216075C for ; Wed, 11 Jan 2017 22:07:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F2E328660 for ; Wed, 11 Jan 2017 22:07:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03F9D286B2; Wed, 11 Jan 2017 22:07:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F943286AF for ; Wed, 11 Jan 2017 22:07:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751954AbdAKWHt (ORCPT ); Wed, 11 Jan 2017 17:07:49 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:33475 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752234AbdAKWHd (ORCPT ); Wed, 11 Jan 2017 17:07:33 -0500 Received: by mail-io0-f193.google.com with SMTP id 101so577273iom.0 for ; Wed, 11 Jan 2017 14:07:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=MmA4hhj2t6q6xUT0LhbnlxTEayRFYwiiXZiroD/nuCc=; b=mU0aN/DM4bUsT/xVk43pu595NdMTEmBKTL2bPucDku2Bb3wFDsf9S82W3wWW1r2JO6 yPqerp5c5+vcGGR0EjEF85aacR80FzCSgS83uEUYU23Zdu7ED25bOAG2GXY2M9F9PQUM aukraa4dsGiXLT91LCRS+Xg890qU3970EdI0Mowwf92NZpTVSXxCQv6lout5Gb/AUn3e ekptRJbL0FrcQNhY7hZd9ywuwGrgaHUKlk/wh2GB6YKYphTxY2MSazM19xGT0/hla0Wq Eo9cVwl8oIM0q4hOyAsYkBjP8ESW75IzrEzibTQiXO57zisdxEvgHoOeLuUfTys62sH3 GTrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=MmA4hhj2t6q6xUT0LhbnlxTEayRFYwiiXZiroD/nuCc=; b=Uag3L9eEX3zGzkyNP+G5kpLQrRNX2t2wW2A547GF0UpX3twbw4GXbajEo9tfsHCKvP T4J9P2xJ5/nPkDn8+08CpeUsGmbB4YfGUzJjWDldY6+hAGVy030EmoEweLSF6INJ7dzd Mx3nEsJL4MnntRlxSMZTSpj/U7mhl6g3RIZw6IxXGT7hv3G5S+aeLdCUuZsOmPTyqiUj TuIp6bJC7Ljr5qZGgQGKFuj45DZiI8MrFC+3CMXoAr2RL/vQvIdvqs+z8edC5oZ9pEHA 0npVcfVgaHG4PtfUZXLonc3Cs4OUMmRfWStQhv1gUEAM6mTjbDfaRIHeDflFQr7TxPnr 7Kig== X-Gm-Message-State: AIkVDXKOjUCm33wZ1OubOwpt329iWCkDN5jSHKGC7rMzC4TpQ0zy7NrdXJ0XmXH+jL+0Pg== X-Received: by 10.107.175.199 with SMTP id p68mr330891ioo.80.1484172433857; Wed, 11 Jan 2017 14:07:13 -0800 (PST) Received: from localhost.localdomain (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id w143sm34406itc.0.2017.01.11.14.07.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 14:07:12 -0800 (PST) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 2/3] NFSv4: Don't apply change_info4 twice on rename within a directory Date: Wed, 11 Jan 2017 17:07:08 -0500 Message-Id: <20170111220709.19405-2-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170111220709.19405-1-trond.myklebust@primarydata.com> References: <20170111220709.19405-1-trond.myklebust@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If a file is renamed, but stays in the same directory, we will still receive 2 change_info4 structures describing the change to that directory, but we only want to apply it once. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 176561a0fe0d..77e5263838d9 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -4160,8 +4160,11 @@ static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir, if (nfs4_async_handle_error(task, res->server, NULL, &data->timeout) == -EAGAIN) return 0; - update_changeattr(old_dir, &res->old_cinfo); - update_changeattr(new_dir, &res->new_cinfo); + if (task->tk_status == 0) { + update_changeattr(old_dir, &res->old_cinfo); + if (new_dir != old_dir) + update_changeattr(new_dir, &res->new_cinfo); + } return 1; }