aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/pohmelfs
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/pohmelfs')
-rw-r--r--drivers/staging/pohmelfs/path_entry.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/staging/pohmelfs/path_entry.c b/drivers/staging/pohmelfs/path_entry.c
index 8ec83d2dffb..bbe42f42ca8 100644
--- a/drivers/staging/pohmelfs/path_entry.c
+++ b/drivers/staging/pohmelfs/path_entry.c
@@ -83,10 +83,11 @@ out:
83int pohmelfs_path_length(struct pohmelfs_inode *pi) 83int pohmelfs_path_length(struct pohmelfs_inode *pi)
84{ 84{
85 struct dentry *d, *root, *first; 85 struct dentry *d, *root, *first;
86 int len = 1; /* Root slash */ 86 int len;
87 unsigned seq;
87 88
88 first = d = d_find_alias(&pi->vfs_inode); 89 first = d_find_alias(&pi->vfs_inode);
89 if (!d) { 90 if (!first) {
90 dprintk("%s: ino: %llu, mode: %o.\n", __func__, pi->ino, pi->vfs_inode.i_mode); 91 dprintk("%s: ino: %llu, mode: %o.\n", __func__, pi->ino, pi->vfs_inode.i_mode);
91 return -ENOENT; 92 return -ENOENT;
92 } 93 }
@@ -95,6 +96,11 @@ int pohmelfs_path_length(struct pohmelfs_inode *pi)
95 root = dget(current->fs->root.dentry); 96 root = dget(current->fs->root.dentry);
96 spin_unlock(&current->fs->lock); 97 spin_unlock(&current->fs->lock);
97 98
99rename_retry:
100 len = 1; /* Root slash */
101 d = first;
102 seq = read_seqbegin(&rename_lock);
103 rcu_read_lock();
98 spin_lock(&dcache_lock); 104 spin_lock(&dcache_lock);
99 105
100 if (!IS_ROOT(d) && d_unhashed(d)) 106 if (!IS_ROOT(d) && d_unhashed(d))
@@ -105,6 +111,9 @@ int pohmelfs_path_length(struct pohmelfs_inode *pi)
105 d = d->d_parent; 111 d = d->d_parent;
106 } 112 }
107 spin_unlock(&dcache_lock); 113 spin_unlock(&dcache_lock);
114 rcu_read_unlock();
115 if (read_seqretry(&rename_lock, seq))
116 goto rename_retry;
108 117
109 dput(root); 118 dput(root);
110 dput(first); 119 dput(first);