Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp825828pxb; Tue, 3 Nov 2020 13:37:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhVEJFhsgIVvlIiLnKoN0b50ejr1RE/IqL714oqnuXIkYmTsgtMgSa/6ZElizWZG0ulHFL X-Received: by 2002:a50:f0d4:: with SMTP id a20mr24195582edm.303.1604439477539; Tue, 03 Nov 2020 13:37:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604439477; cv=none; d=google.com; s=arc-20160816; b=nuB+LA2WJmUq7x2a23nTvC2QCtqQYNFVMYsy8fUVHbj3JBvIAYIIHcfJ/R0fhdJZJK twJge3CMXFITZ/OvBQHRxnwfHdmPIjTlEEH031YfNZXI4f8lyZ0bpMVVB/sh3c2cO04y RmFYiefeGaogiRH1QjgT2TgKFzfvMA3YHT72g9mmfD2jOyA0nMrTmpna9crKwtTDkytM 6NLF+Mz1ehODbKIwdvKKk3xgI8lD2oyuNcI0vU+lMdaBOtWEwF1tiagOgtfE1EOUaYK6 KA4/iSr2dnYTBby6AEOQv19Rl/yuYkZ/gkRa4LtIZ+NIpJjrMjPqchzSbYz25EHBCZ+s CMHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pGb+NoefdLBboeMAUCTaGhL1F2XNLrpHndwY0JapSXo=; b=uBhrg16aSdOPllf/ZUKGYYg1EA8QAilPgyYhjuK8+urFIkcn0f7tWABqhTwTPquNh/ Zt9UEVGlrV4CMccp987XiwML040tsCuL4FAc04SUlanCqDlhMhOODmjm8uGAaN/l7VFY QQ96ClEA7++Zi64+yN4L4WywejVV4fbopwVj1yDTi+TqMVGCYTYCp60GYhaTFWUJOgjk MO69GMUCKjprB1Eu6q0n8ZB4sp88uszjE96OETiYBY/iq1JHsCNduk4EwseZI/YQD45u 0KxnBJj6PW9PZUDakd57wRLGeiphVKQPSr875L2A3R2Y538SEvLUalO2wg/3wO6dZJLu sUbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gVWPVVi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d19si13519812edp.276.2020.11.03.13.37.35; Tue, 03 Nov 2020 13:37:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gVWPVVi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732993AbgKCVd1 (ORCPT + 99 others); Tue, 3 Nov 2020 16:33:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:59032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731190AbgKCU44 (ORCPT ); Tue, 3 Nov 2020 15:56:56 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A69E92053B; Tue, 3 Nov 2020 20:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437016; bh=wckzC39GFGHqWU0KEpBCK8E57m64cHZTVwf5aaZZpo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gVWPVVi7RnbnNox7kaarOjDySMWPJFkbU7oHGN/i+0fngO1lV+8j3wgHSIBPUAKga fB4LDttQKVDdGC4+IhZKjO75e+x7Z8K72qaf0k3kmkx2eUVW0bo3PQXoDIXOYhYtCs He2izo8oO8BQc5ByiZ1+ufEvSlGbCz+v1HmznZPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ashish Sangwan , Anna Schumaker Subject: [PATCH 5.4 109/214] NFS: fix nfs_path in case of a rename retry Date: Tue, 3 Nov 2020 21:35:57 +0100 Message-Id: <20201103203301.151917125@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ashish Sangwan commit 247db73560bc3e5aef6db50c443c3c0db115bc93 upstream. We are generating incorrect path in case of rename retry because we are restarting from wrong dentry. We should restart from the dentry which was received in the call to nfs_path. CC: stable@vger.kernel.org Signed-off-by: Ashish Sangwan Signed-off-by: Anna Schumaker Signed-off-by: Greg Kroah-Hartman --- fs/nfs/namespace.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c @@ -31,9 +31,9 @@ int nfs_mountpoint_expiry_timeout = 500 /* * nfs_path - reconstruct the path given an arbitrary dentry * @base - used to return pointer to the end of devname part of path - * @dentry - pointer to dentry + * @dentry_in - pointer to dentry * @buffer - result buffer - * @buflen - length of buffer + * @buflen_in - length of buffer * @flags - options (see below) * * Helper function for constructing the server pathname @@ -48,15 +48,19 @@ int nfs_mountpoint_expiry_timeout = 500 * the original device (export) name * (if unset, the original name is returned verbatim) */ -char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen, - unsigned flags) +char *nfs_path(char **p, struct dentry *dentry_in, char *buffer, + ssize_t buflen_in, unsigned flags) { char *end; int namelen; unsigned seq; const char *base; + struct dentry *dentry; + ssize_t buflen; rename_retry: + buflen = buflen_in; + dentry = dentry_in; end = buffer+buflen; *--end = '\0'; buflen--;