Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226709
b: refs/heads/master
c: 949854d
h: refs/heads/master
i:
  226707: 13b1e04
v: v3
  • Loading branch information
Nick Piggin committed Jan 7, 2011
1 parent 112c0e0 commit 279642b
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9abca36087288fe28de4749c71ca003d4b9e3ed0
refs/heads/master: 949854d02455080d20cd3e1db28a3a18daf7599d
15 changes: 12 additions & 3 deletions trunk/drivers/staging/pohmelfs/path_entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ int pohmelfs_construct_path_string(struct pohmelfs_inode *pi, void *data, int le
int pohmelfs_path_length(struct pohmelfs_inode *pi)
{
struct dentry *d, *root, *first;
int len = 1; /* Root slash */
int len;
unsigned seq;

first = d = d_find_alias(&pi->vfs_inode);
if (!d) {
first = d_find_alias(&pi->vfs_inode);
if (!first) {
dprintk("%s: ino: %llu, mode: %o.\n", __func__, pi->ino, pi->vfs_inode.i_mode);
return -ENOENT;
}
Expand All @@ -95,6 +96,11 @@ int pohmelfs_path_length(struct pohmelfs_inode *pi)
root = dget(current->fs->root.dentry);
spin_unlock(&current->fs->lock);

rename_retry:
len = 1; /* Root slash */
d = first;
seq = read_seqbegin(&rename_lock);
rcu_read_lock();
spin_lock(&dcache_lock);

if (!IS_ROOT(d) && d_unhashed(d))
Expand All @@ -105,6 +111,9 @@ int pohmelfs_path_length(struct pohmelfs_inode *pi)
d = d->d_parent;
}
spin_unlock(&dcache_lock);
rcu_read_unlock();
if (read_seqretry(&rename_lock, seq))
goto rename_retry;

dput(root);
dput(first);
Expand Down
18 changes: 15 additions & 3 deletions trunk/fs/autofs4/waitq.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,25 @@ static int autofs4_getpath(struct autofs_sb_info *sbi,
{
struct dentry *root = sbi->sb->s_root;
struct dentry *tmp;
char *buf = *name;
char *buf;
char *p;
int len = 0;

int len;
unsigned seq;

rename_retry:
buf = *name;
len = 0;
seq = read_seqbegin(&rename_lock);
rcu_read_lock();
spin_lock(&dcache_lock);
for (tmp = dentry ; tmp != root ; tmp = tmp->d_parent)
len += tmp->d_name.len + 1;

if (!len || --len > NAME_MAX) {
spin_unlock(&dcache_lock);
rcu_read_unlock();
if (read_seqretry(&rename_lock, seq))
goto rename_retry;
return 0;
}

Expand All @@ -209,6 +218,9 @@ static int autofs4_getpath(struct autofs_sb_info *sbi,
strncpy(p, tmp->d_name.name, tmp->d_name.len);
}
spin_unlock(&dcache_lock);
rcu_read_unlock();
if (read_seqretry(&rename_lock, seq))
goto rename_retry;

return len;
}
Expand Down
Loading

0 comments on commit 279642b

Please sign in to comment.