diff options
-rw-r--r-- | fs/cifs/inode.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index bc673c8c1e6b..e1031b9e2c55 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -161,12 +161,14 @@ static void cifs_unix_info_to_inode(struct inode *inode, | |||
161 | spin_unlock(&inode->i_lock); | 161 | spin_unlock(&inode->i_lock); |
162 | } | 162 | } |
163 | 163 | ||
164 | static const unsigned char *cifs_get_search_path(struct cifsTconInfo *pTcon, | 164 | static const unsigned char *cifs_get_search_path(struct cifs_sb_info *cifs_sb, |
165 | const char *search_path) | 165 | const char *search_path) |
166 | { | 166 | { |
167 | int tree_len; | 167 | int tree_len; |
168 | int path_len; | 168 | int path_len; |
169 | int i; | ||
169 | char *tmp_path; | 170 | char *tmp_path; |
171 | struct cifsTconInfo *pTcon = cifs_sb->tcon; | ||
170 | 172 | ||
171 | if (!(pTcon->Flags & SMB_SHARE_IS_IN_DFS)) | 173 | if (!(pTcon->Flags & SMB_SHARE_IS_IN_DFS)) |
172 | return search_path; | 174 | return search_path; |
@@ -180,6 +182,11 @@ static const unsigned char *cifs_get_search_path(struct cifsTconInfo *pTcon, | |||
180 | return search_path; | 182 | return search_path; |
181 | 183 | ||
182 | strncpy(tmp_path, pTcon->treeName, tree_len); | 184 | strncpy(tmp_path, pTcon->treeName, tree_len); |
185 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) | ||
186 | for (i = 0; i < tree_len; i++) { | ||
187 | if (tmp_path[i] == '\\') | ||
188 | tmp_path[i] = '/'; | ||
189 | } | ||
183 | strncpy(tmp_path+tree_len, search_path, path_len); | 190 | strncpy(tmp_path+tree_len, search_path, path_len); |
184 | tmp_path[tree_len+path_len] = 0; | 191 | tmp_path[tree_len+path_len] = 0; |
185 | return tmp_path; | 192 | return tmp_path; |
@@ -199,7 +206,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
199 | pTcon = cifs_sb->tcon; | 206 | pTcon = cifs_sb->tcon; |
200 | cFYI(1, ("Getting info on %s", search_path)); | 207 | cFYI(1, ("Getting info on %s", search_path)); |
201 | 208 | ||
202 | full_path = cifs_get_search_path(pTcon, search_path); | 209 | full_path = cifs_get_search_path(cifs_sb, search_path); |
203 | 210 | ||
204 | try_again_CIFSSMBUnixQPathInfo: | 211 | try_again_CIFSSMBUnixQPathInfo: |
205 | /* could have done a find first instead but this returns more info */ | 212 | /* could have done a find first instead but this returns more info */ |
@@ -402,7 +409,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
402 | return -ENOMEM; | 409 | return -ENOMEM; |
403 | pfindData = (FILE_ALL_INFO *)buf; | 410 | pfindData = (FILE_ALL_INFO *)buf; |
404 | 411 | ||
405 | full_path = cifs_get_search_path(pTcon, search_path); | 412 | full_path = cifs_get_search_path(cifs_sb, search_path); |
406 | 413 | ||
407 | try_again_CIFSSMBQPathInfo: | 414 | try_again_CIFSSMBQPathInfo: |
408 | /* could do find first instead but this returns more info */ | 415 | /* could do find first instead but this returns more info */ |