Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4489673ivc; Tue, 3 Nov 2020 13:24:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJx62K8tDfRuO5cMuHRjGaCureq/RwT1+Ehr95e3dyrqzCsDIWz/RYIVL3EXdv8TmjCOPW8/ X-Received: by 2002:a17:906:748b:: with SMTP id e11mr12774596ejl.513.1604438675386; Tue, 03 Nov 2020 13:24:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604438675; cv=none; d=google.com; s=arc-20160816; b=mT2siUbugoyIkWlAbCzd2j0FtDlbJGa3IgrWpYH6/bv2lGYDdlC2hDYB5XW3hc6U1w 4rY0Bl65TzdYyWmthm4j5NayS/+Si7z//3nssyC3t+YMKgpsGXa6++aqpLL58MhPHNfG Uv1J4fnVDQ9bvQg9O4NcAwmc/Y93DuH7zIFJRkvBaG4btutABiZLD5Xf+Y43g21tTh87 rFFhLZXS8v/QHpW5VTw5ozPRwLyOviI3jMFuHZbHArJHIdnRbVe6yry3xjJRp+nU4QEA u9LkOO4OediGgmpkwn64ZUdQ4wwAN3O+ASk20SA8ZfSTFgVReR4DZ2vCz3Z/haNC0P+k GZSQ== 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=u6RT0jl5yaarvL2XVZlJu1csjyRlVbZP5fqTo0+W9/4=; b=pdsYheGYooOpm2dSG7BBDHooRHaLXPwl0VUdQVk69/IGipZKlAsT09rQWJtjYSS8CS IAVr8Uzko8xGxF7brLyaw0LXFICA8zyeBjX/O7QeuyGPypGdn5SB3xbaFMvxyGL8O+VE pKeMqfKPz3267iYfEzcwf7PYkWcKEA7fsy/MZ6z9IgVEW7nIsqdKRUop+Er7xUOx9iJz UPC6bv+xgORyBIgoFqhwIlR6yCcEk6cjbVR7MdUd/cMu5gfD1e2uMXe2eAqTxHXZ7F69 lXDzCas3YmGEBWIYOQp9GJpj6DzA5bjBdWvBDYwR3TXjSWlIZYVvpCGvtaeNeJ6nHc7T dsSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=abcqKEZU; 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 w17si58990eji.277.2020.11.03.13.24.11; Tue, 03 Nov 2020 13:24:35 -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=abcqKEZU; 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 S2388067AbgKCVFr (ORCPT + 99 others); Tue, 3 Nov 2020 16:05:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:44316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387889AbgKCVFk (ORCPT ); Tue, 3 Nov 2020 16:05:40 -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 98DA3205ED; Tue, 3 Nov 2020 21:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437540; bh=6yNpOKm4tr/TBozL8nohTeanZGCz0M3PhgGIBz13FYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=abcqKEZUbzRTLHAEixdWfltR/Aei4+aQRou0mqV0TQz30FORc5FwIBJYQnNYBD+bb am6SxWh85BDkTZjcQLdTKxKLAMT98ejjWd8QHKa3WfUqHEeFUIgEoW0Xw6i9xLUjSm KLY9eZJdPbaLG9L85ndS1ZLCWXndPl6nUB4zm2FI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ashish Sangwan , Anna Schumaker Subject: [PATCH 4.19 119/191] NFS: fix nfs_path in case of a rename retry Date: Tue, 3 Nov 2020 21:36:51 +0100 Message-Id: <20201103203244.480461936@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@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 @@ -30,9 +30,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 @@ -47,15 +47,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--;