aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/dir.c')
-rw-r--r--fs/cifs/dir.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 248ddebd67f4..cf90c9ad2c87 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -43,11 +43,12 @@ renew_parental_timestamps(struct dentry *direntry)
43 43
44/* Note: caller must free return buffer */ 44/* Note: caller must free return buffer */
45char * 45char *
46build_path_from_dentry(struct dentry *direntry, const struct cifs_sb_info *cifs_sb) 46build_path_from_dentry(struct dentry *direntry)
47{ 47{
48 struct dentry *temp; 48 struct dentry *temp;
49 int namelen = 0; 49 int namelen = 0;
50 char *full_path; 50 char *full_path;
51 char dirsep = CIFS_DIR_SEP(CIFS_SB(direntry->d_sb));
51 52
52 if(direntry == NULL) 53 if(direntry == NULL)
53 return NULL; /* not much we can do if dentry is freed and 54 return NULL; /* not much we can do if dentry is freed and
@@ -74,7 +75,7 @@ cifs_bp_rename_retry:
74 if (namelen < 0) { 75 if (namelen < 0) {
75 break; 76 break;
76 } else { 77 } else {
77 full_path[namelen] = CIFS_DIR_SEP(cifs_sb); 78 full_path[namelen] = dirsep;
78 strncpy(full_path + namelen + 1, temp->d_name.name, 79 strncpy(full_path + namelen + 1, temp->d_name.name,
79 temp->d_name.len); 80 temp->d_name.len);
80 cFYI(0, (" name: %s ", full_path + namelen)); 81 cFYI(0, (" name: %s ", full_path + namelen));
@@ -138,7 +139,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
138 pTcon = cifs_sb->tcon; 139 pTcon = cifs_sb->tcon;
139 140
140 down(&direntry->d_sb->s_vfs_rename_sem); 141 down(&direntry->d_sb->s_vfs_rename_sem);
141 full_path = build_path_from_dentry(direntry, cifs_sb); 142 full_path = build_path_from_dentry(direntry);
142 up(&direntry->d_sb->s_vfs_rename_sem); 143 up(&direntry->d_sb->s_vfs_rename_sem);
143 if(full_path == NULL) { 144 if(full_path == NULL) {
144 FreeXid(xid); 145 FreeXid(xid);
@@ -310,7 +311,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t dev
310 pTcon = cifs_sb->tcon; 311 pTcon = cifs_sb->tcon;
311 312
312 down(&direntry->d_sb->s_vfs_rename_sem); 313 down(&direntry->d_sb->s_vfs_rename_sem);
313 full_path = build_path_from_dentry(direntry, cifs_sb); 314 full_path = build_path_from_dentry(direntry);
314 up(&direntry->d_sb->s_vfs_rename_sem); 315 up(&direntry->d_sb->s_vfs_rename_sem);
315 if(full_path == NULL) 316 if(full_path == NULL)
316 rc = -ENOMEM; 317 rc = -ENOMEM;
@@ -409,7 +410,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
409 /* can not grab the rename sem here since it would 410 /* can not grab the rename sem here since it would
410 deadlock in the cases (beginning of sys_rename itself) 411 deadlock in the cases (beginning of sys_rename itself)
411 in which we already have the sb rename sem */ 412 in which we already have the sb rename sem */
412 full_path = build_path_from_dentry(direntry, cifs_sb); 413 full_path = build_path_from_dentry(direntry);
413 if(full_path == NULL) { 414 if(full_path == NULL) {
414 FreeXid(xid); 415 FreeXid(xid);
415 return ERR_PTR(-ENOMEM); 416 return ERR_PTR(-ENOMEM);