Skip to content

Commit

Permalink
NFS: Trim extra slash in v4 nfs_path
Browse files Browse the repository at this point in the history
A NFSv4 mount of a subdirectory will show an extra slash (as in
'server://path') in proc's mountinfo which will not match the device name
and path.  This can cause problems for programs searching for the mount.
Fix this by checking for a leading slash in the dentry path, if so trim
away any trailing slashes in the device name.

Signed-off-by: Benjamin Coddington <[email protected]>
Signed-off-by: Anna Schumaker <[email protected]>
  • Loading branch information
Benjamin Coddington authored and amschuma-ntap committed Oct 24, 2016
1 parent 83aa3e0 commit 86a6c21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/nfs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen,
return end;
}
namelen = strlen(base);
if (flags & NFS_PATH_CANONICAL) {
if (*end == '/') {
/* Strip off excess slashes in base string */
while (namelen > 0 && base[namelen - 1] == '/')
namelen--;
Expand Down

0 comments on commit 86a6c21

Please sign in to comment.