Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[sfrench/cifs-2.6.git] / fs / cifs / dir.c
index 77e1fc01d747fd342de2591d2ce0f4d4fbbd095d..1d0ca3eaaca51f282bcec21163493fda104b5cad 100644 (file)
@@ -48,13 +48,14 @@ build_path_from_dentry(struct dentry *direntry)
        struct dentry *temp;
        int namelen = 0;
        char *full_path;
-       char dirsep = CIFS_DIR_SEP(CIFS_SB(direntry->d_sb));
+       char dirsep;
 
        if(direntry == NULL)
                return NULL;  /* not much we can do if dentry is freed and
                we need to reopen the file after it was closed implicitly
                when the server crashed */
 
+       dirsep = CIFS_DIR_SEP(CIFS_SB(direntry->d_sb));
 cifs_bp_rename_retry:
        for (temp = direntry; !IS_ROOT(temp);) {
                namelen += (1 + temp->d_name.len);
@@ -138,9 +139,9 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        cifs_sb = CIFS_SB(inode->i_sb);
        pTcon = cifs_sb->tcon;
 
-       down(&direntry->d_sb->s_vfs_rename_sem);
+       mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
        full_path = build_path_from_dentry(direntry);
-       up(&direntry->d_sb->s_vfs_rename_sem);
+       mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
        if(full_path == NULL) {
                FreeXid(xid);
                return -ENOMEM;
@@ -315,9 +316,9 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
        cifs_sb = CIFS_SB(inode->i_sb);
        pTcon = cifs_sb->tcon;
 
-       down(&direntry->d_sb->s_vfs_rename_sem);
+       mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
        full_path = build_path_from_dentry(direntry);
-       up(&direntry->d_sb->s_vfs_rename_sem);
+       mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
        if(full_path == NULL)
                rc = -ENOMEM;
        else if (pTcon->ses->capabilities & CAP_UNIX) {