aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/cifsproto.h2
-rw-r--r--fs/cifs/dir.c11
-rw-r--r--fs/cifs/fcntl.c2
-rw-r--r--fs/cifs/file.c4
-rw-r--r--fs/cifs/inode.c14
-rw-r--r--fs/cifs/link.c15
-rw-r--r--fs/cifs/readdir.c2
-rw-r--r--fs/cifs/xattr.c8
8 files changed, 29 insertions, 29 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index c411f2e001aa..656b78ddf674 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -40,7 +40,7 @@ extern unsigned int _GetXid(void);
40extern void _FreeXid(unsigned int); 40extern void _FreeXid(unsigned int);
41#define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__FUNCTION__, xid,current->fsuid)); 41#define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__FUNCTION__, xid,current->fsuid));
42#define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__FUNCTION__,curr_xid,(int)rc));} 42#define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__FUNCTION__,curr_xid,(int)rc));}
43extern char *build_path_from_dentry(struct dentry *, const struct cifs_sb_info *cifs_sb); 43extern char *build_path_from_dentry(struct dentry *);
44extern char *build_wildcard_path_from_dentry(struct dentry *direntry); 44extern char *build_wildcard_path_from_dentry(struct dentry *direntry);
45extern void renew_parental_timestamps(struct dentry *direntry); 45extern void renew_parental_timestamps(struct dentry *direntry);
46extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, 46extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
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);
diff --git a/fs/cifs/fcntl.c b/fs/cifs/fcntl.c
index 2e5137b7352a..d527e2c76073 100644
--- a/fs/cifs/fcntl.c
+++ b/fs/cifs/fcntl.c
@@ -83,7 +83,7 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
83 pTcon = cifs_sb->tcon; 83 pTcon = cifs_sb->tcon;
84 84
85 down(&file->f_dentry->d_sb->s_vfs_rename_sem); 85 down(&file->f_dentry->d_sb->s_vfs_rename_sem);
86 full_path = build_path_from_dentry(file->f_dentry, cifs_sb); 86 full_path = build_path_from_dentry(file->f_dentry);
87 up(&file->f_dentry->d_sb->s_vfs_rename_sem); 87 up(&file->f_dentry->d_sb->s_vfs_rename_sem);
88 88
89 if(full_path == NULL) { 89 if(full_path == NULL) {
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 8ae962e7c93f..026b5c5ccc89 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -196,7 +196,7 @@ int cifs_open(struct inode *inode, struct file *file)
196 } 196 }
197 197
198 down(&inode->i_sb->s_vfs_rename_sem); 198 down(&inode->i_sb->s_vfs_rename_sem);
199 full_path = build_path_from_dentry(file->f_dentry, cifs_sb); 199 full_path = build_path_from_dentry(file->f_dentry);
200 up(&inode->i_sb->s_vfs_rename_sem); 200 up(&inode->i_sb->s_vfs_rename_sem);
201 if (full_path == NULL) { 201 if (full_path == NULL) {
202 FreeXid(xid); 202 FreeXid(xid);
@@ -366,7 +366,7 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
366 those that already have the rename sem can end up causing writepage 366 those that already have the rename sem can end up causing writepage
367 to get called and if the server was down that means we end up here, 367 to get called and if the server was down that means we end up here,
368 and we can never tell if the caller already has the rename_sem */ 368 and we can never tell if the caller already has the rename_sem */
369 full_path = build_path_from_dentry(file->f_dentry, cifs_sb); 369 full_path = build_path_from_dentry(file->f_dentry);
370 if (full_path == NULL) { 370 if (full_path == NULL) {
371 up(&pCifsFile->fh_sem); 371 up(&pCifsFile->fh_sem);
372 FreeXid(xid); 372 FreeXid(xid);
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 34f0168c4041..0485c6d6ecd5 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -436,7 +436,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
436 /* Unlink can be called from rename so we can not grab the sem here 436 /* Unlink can be called from rename so we can not grab the sem here
437 since we deadlock otherwise */ 437 since we deadlock otherwise */
438/* down(&direntry->d_sb->s_vfs_rename_sem);*/ 438/* down(&direntry->d_sb->s_vfs_rename_sem);*/
439 full_path = build_path_from_dentry(direntry, cifs_sb); 439 full_path = build_path_from_dentry(direntry);
440/* up(&direntry->d_sb->s_vfs_rename_sem);*/ 440/* up(&direntry->d_sb->s_vfs_rename_sem);*/
441 if (full_path == NULL) { 441 if (full_path == NULL) {
442 FreeXid(xid); 442 FreeXid(xid);
@@ -580,7 +580,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
580 pTcon = cifs_sb->tcon; 580 pTcon = cifs_sb->tcon;
581 581
582 down(&inode->i_sb->s_vfs_rename_sem); 582 down(&inode->i_sb->s_vfs_rename_sem);
583 full_path = build_path_from_dentry(direntry, cifs_sb); 583 full_path = build_path_from_dentry(direntry);
584 up(&inode->i_sb->s_vfs_rename_sem); 584 up(&inode->i_sb->s_vfs_rename_sem);
585 if (full_path == NULL) { 585 if (full_path == NULL) {
586 FreeXid(xid); 586 FreeXid(xid);
@@ -654,7 +654,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
654 pTcon = cifs_sb->tcon; 654 pTcon = cifs_sb->tcon;
655 655
656 down(&inode->i_sb->s_vfs_rename_sem); 656 down(&inode->i_sb->s_vfs_rename_sem);
657 full_path = build_path_from_dentry(direntry, cifs_sb); 657 full_path = build_path_from_dentry(direntry);
658 up(&inode->i_sb->s_vfs_rename_sem); 658 up(&inode->i_sb->s_vfs_rename_sem);
659 if (full_path == NULL) { 659 if (full_path == NULL) {
660 FreeXid(xid); 660 FreeXid(xid);
@@ -707,8 +707,8 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
707 707
708 /* we already have the rename sem so we do not need to grab it again 708 /* we already have the rename sem so we do not need to grab it again
709 here to protect the path integrity */ 709 here to protect the path integrity */
710 fromName = build_path_from_dentry(source_direntry, cifs_sb_source); 710 fromName = build_path_from_dentry(source_direntry);
711 toName = build_path_from_dentry(target_direntry, cifs_sb_target); 711 toName = build_path_from_dentry(target_direntry);
712 if ((fromName == NULL) || (toName == NULL)) { 712 if ((fromName == NULL) || (toName == NULL)) {
713 rc = -ENOMEM; 713 rc = -ENOMEM;
714 goto cifs_rename_exit; 714 goto cifs_rename_exit;
@@ -824,7 +824,7 @@ int cifs_revalidate(struct dentry *direntry)
824 824
825 /* can not safely grab the rename sem here if rename calls revalidate 825 /* can not safely grab the rename sem here if rename calls revalidate
826 since that would deadlock */ 826 since that would deadlock */
827 full_path = build_path_from_dentry(direntry, cifs_sb); 827 full_path = build_path_from_dentry(direntry);
828 if (full_path == NULL) { 828 if (full_path == NULL) {
829 FreeXid(xid); 829 FreeXid(xid);
830 return -ENOMEM; 830 return -ENOMEM;
@@ -973,7 +973,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
973 pTcon = cifs_sb->tcon; 973 pTcon = cifs_sb->tcon;
974 974
975 down(&direntry->d_sb->s_vfs_rename_sem); 975 down(&direntry->d_sb->s_vfs_rename_sem);
976 full_path = build_path_from_dentry(direntry, cifs_sb); 976 full_path = build_path_from_dentry(direntry);
977 up(&direntry->d_sb->s_vfs_rename_sem); 977 up(&direntry->d_sb->s_vfs_rename_sem);
978 if (full_path == NULL) { 978 if (full_path == NULL) {
979 FreeXid(xid); 979 FreeXid(xid);
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index b8ec6646456a..b43e071fe110 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -49,8 +49,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
49 BB note DFS case in future though (when we may have to check) */ 49 BB note DFS case in future though (when we may have to check) */
50 50
51 down(&inode->i_sb->s_vfs_rename_sem); 51 down(&inode->i_sb->s_vfs_rename_sem);
52 fromName = build_path_from_dentry(old_file, cifs_sb_target); 52 fromName = build_path_from_dentry(old_file);
53 toName = build_path_from_dentry(direntry, cifs_sb_target); 53 toName = build_path_from_dentry(direntry);
54 up(&inode->i_sb->s_vfs_rename_sem); 54 up(&inode->i_sb->s_vfs_rename_sem);
55 if((fromName == NULL) || (toName == NULL)) { 55 if((fromName == NULL) || (toName == NULL)) {
56 rc = -ENOMEM; 56 rc = -ENOMEM;
@@ -105,17 +105,16 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
105 105
106 xid = GetXid(); 106 xid = GetXid();
107 107
108 cifs_sb = CIFS_SB(inode->i_sb);
109 pTcon = cifs_sb->tcon;
110
111 down(&direntry->d_sb->s_vfs_rename_sem); 108 down(&direntry->d_sb->s_vfs_rename_sem);
112 full_path = build_path_from_dentry(direntry, cifs_sb); 109 full_path = build_path_from_dentry(direntry);
113 up(&direntry->d_sb->s_vfs_rename_sem); 110 up(&direntry->d_sb->s_vfs_rename_sem);
114 111
115 if (!full_path) 112 if (!full_path)
116 goto out_no_free; 113 goto out_no_free;
117 114
118 cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode)); 115 cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode));
116 cifs_sb = CIFS_SB(inode->i_sb);
117 pTcon = cifs_sb->tcon;
119 target_path = kmalloc(PATH_MAX, GFP_KERNEL); 118 target_path = kmalloc(PATH_MAX, GFP_KERNEL);
120 if (!target_path) { 119 if (!target_path) {
121 target_path = ERR_PTR(-ENOMEM); 120 target_path = ERR_PTR(-ENOMEM);
@@ -168,7 +167,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
168 pTcon = cifs_sb->tcon; 167 pTcon = cifs_sb->tcon;
169 168
170 down(&inode->i_sb->s_vfs_rename_sem); 169 down(&inode->i_sb->s_vfs_rename_sem);
171 full_path = build_path_from_dentry(direntry, cifs_sb); 170 full_path = build_path_from_dentry(direntry);
172 up(&inode->i_sb->s_vfs_rename_sem); 171 up(&inode->i_sb->s_vfs_rename_sem);
173 172
174 if(full_path == NULL) { 173 if(full_path == NULL) {
@@ -237,7 +236,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
237/* BB would it be safe against deadlock to grab this sem 236/* BB would it be safe against deadlock to grab this sem
238 even though rename itself grabs the sem and calls lookup? */ 237 even though rename itself grabs the sem and calls lookup? */
239/* down(&inode->i_sb->s_vfs_rename_sem);*/ 238/* down(&inode->i_sb->s_vfs_rename_sem);*/
240 full_path = build_path_from_dentry(direntry, cifs_sb); 239 full_path = build_path_from_dentry(direntry);
241/* up(&inode->i_sb->s_vfs_rename_sem);*/ 240/* up(&inode->i_sb->s_vfs_rename_sem);*/
242 241
243 if(full_path == NULL) { 242 if(full_path == NULL) {
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index f769292e2a93..9780f4ee7f12 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -368,7 +368,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
368 return -EINVAL; 368 return -EINVAL;
369 369
370 down(&file->f_dentry->d_sb->s_vfs_rename_sem); 370 down(&file->f_dentry->d_sb->s_vfs_rename_sem);
371 full_path = build_path_from_dentry(file->f_dentry, cifs_sb); 371 full_path = build_path_from_dentry(file->f_dentry);
372 up(&file->f_dentry->d_sb->s_vfs_rename_sem); 372 up(&file->f_dentry->d_sb->s_vfs_rename_sem);
373 373
374 if(full_path == NULL) { 374 if(full_path == NULL) {
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index f4fc8ddebba7..c1e02eff1d25 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -63,7 +63,7 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name)
63 pTcon = cifs_sb->tcon; 63 pTcon = cifs_sb->tcon;
64 64
65 down(&sb->s_vfs_rename_sem); 65 down(&sb->s_vfs_rename_sem);
66 full_path = build_path_from_dentry(direntry, cifs_sb); 66 full_path = build_path_from_dentry(direntry);
67 up(&sb->s_vfs_rename_sem); 67 up(&sb->s_vfs_rename_sem);
68 if(full_path == NULL) { 68 if(full_path == NULL) {
69 FreeXid(xid); 69 FreeXid(xid);
@@ -118,7 +118,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
118 pTcon = cifs_sb->tcon; 118 pTcon = cifs_sb->tcon;
119 119
120 down(&sb->s_vfs_rename_sem); 120 down(&sb->s_vfs_rename_sem);
121 full_path = build_path_from_dentry(direntry, cifs_sb); 121 full_path = build_path_from_dentry(direntry);
122 up(&sb->s_vfs_rename_sem); 122 up(&sb->s_vfs_rename_sem);
123 if(full_path == NULL) { 123 if(full_path == NULL) {
124 FreeXid(xid); 124 FreeXid(xid);
@@ -227,7 +227,7 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
227 pTcon = cifs_sb->tcon; 227 pTcon = cifs_sb->tcon;
228 228
229 down(&sb->s_vfs_rename_sem); 229 down(&sb->s_vfs_rename_sem);
230 full_path = build_path_from_dentry(direntry, cifs_sb); 230 full_path = build_path_from_dentry(direntry);
231 up(&sb->s_vfs_rename_sem); 231 up(&sb->s_vfs_rename_sem);
232 if(full_path == NULL) { 232 if(full_path == NULL) {
233 FreeXid(xid); 233 FreeXid(xid);
@@ -328,7 +328,7 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
328 pTcon = cifs_sb->tcon; 328 pTcon = cifs_sb->tcon;
329 329
330 down(&sb->s_vfs_rename_sem); 330 down(&sb->s_vfs_rename_sem);
331 full_path = build_path_from_dentry(direntry, cifs_sb); 331 full_path = build_path_from_dentry(direntry);
332 up(&sb->s_vfs_rename_sem); 332 up(&sb->s_vfs_rename_sem);
333 if(full_path == NULL) { 333 if(full_path == NULL) {
334 FreeXid(xid); 334 FreeXid(xid);