diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 77fc5e1..f1599e0 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -584,6 +584,9 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) char *full_path = NULL; char *s, *p; char sep; + struct inode *dir; + struct dentry *child; + struct inode tempinode; full_path = cifs_build_path_to_root(vol, cifs_sb, cifs_sb_master_tcon(cifs_sb)); @@ -594,12 +597,10 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) sep = CIFS_DIR_SEP(cifs_sb); dentry = dget(sb->s_root); + dir = dentry->d_inode; p = s = full_path; do { - struct inode *dir = dentry->d_inode; - struct dentry *child; - if (!dir) { dput(dentry); dentry = ERR_PTR(-ENOENT); @@ -626,6 +627,8 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) mutex_unlock(&dir->i_mutex); dput(dentry); dentry = child; + if (no inode and not a leaf) + dir = tempinode; } while (!IS_ERR(dentry)); kfree(full_path); return dentry;