Commit 247db735 authored by Ashish Sangwan's avatar Ashish Sangwan Committed by Anna Schumaker
Browse files

NFS: fix nfs_path in case of a rename retry



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: default avatarAshish Sangwan <ashishsangwan2@gmail.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 5904c16d
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -32,9 +32,9 @@ int nfs_mountpoint_expiry_timeout = 500 * HZ;
/*
/*
 * nfs_path - reconstruct the path given an arbitrary dentry
 * nfs_path - reconstruct the path given an arbitrary dentry
 * @base - used to return pointer to the end of devname part of path
 * @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
 * @buffer - result buffer
 * @buflen - length of buffer
 * @buflen_in - length of buffer
 * @flags - options (see below)
 * @flags - options (see below)
 *
 *
 * Helper function for constructing the server pathname
 * Helper function for constructing the server pathname
@@ -49,15 +49,19 @@ int nfs_mountpoint_expiry_timeout = 500 * HZ;
 *		       the original device (export) name
 *		       the original device (export) name
 *		       (if unset, the original name is returned verbatim)
 *		       (if unset, the original name is returned verbatim)
 */
 */
char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen,
char *nfs_path(char **p, struct dentry *dentry_in, char *buffer,
	       unsigned flags)
	       ssize_t buflen_in, unsigned flags)
{
{
	char *end;
	char *end;
	int namelen;
	int namelen;
	unsigned seq;
	unsigned seq;
	const char *base;
	const char *base;
	struct dentry *dentry;
	ssize_t buflen;


rename_retry:
rename_retry:
	buflen = buflen_in;
	dentry = dentry_in;
	end = buffer+buflen;
	end = buffer+buflen;
	*--end = '\0';
	*--end = '\0';
	buflen--;
	buflen--;