Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 60818
b: refs/heads/master
c: dd90b50
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Linus Torvalds committed Jul 17, 2007
1 parent 54b10d7 commit 7a1d13f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 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: fb66a1989c8abc3015aa334f617658b277e5fe98
refs/heads/master: dd90b50906db2c03e236e046f2fc7f7290efe4b4
39 changes: 23 additions & 16 deletions trunk/fs/exportfs/expfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,27 @@ find_acceptable_alias(struct dentry *result,
return NULL;
}

/*
* Find root of a disconnected subtree and return a reference to it.
*/
static struct dentry *
find_disconnected_root(struct dentry *dentry)
{
dget(dentry);
spin_lock(&dentry->d_lock);
while (!IS_ROOT(dentry) &&
(dentry->d_parent->d_flags & DCACHE_DISCONNECTED)) {
struct dentry *parent = dentry->d_parent;
dget(parent);
spin_unlock(&dentry->d_lock);
dput(dentry);
dentry = parent;
spin_lock(&dentry->d_lock);
}
spin_unlock(&dentry->d_lock);
return dentry;
}

/**
* find_exported_dentry - helper routine to implement export_operations->decode_fh
* @sb: The &super_block identifying the filesystem
Expand Down Expand Up @@ -164,23 +185,9 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent,
* the noprogress counter. If we go through the loop 10 times (2 is
* probably enough) without getting anywhere, we just give up
*/
noprogress= 0;
noprogress = 0;
while (target_dir->d_flags & DCACHE_DISCONNECTED && noprogress++ < 10) {
struct dentry *pd = target_dir;

dget(pd);
spin_lock(&pd->d_lock);
while (!IS_ROOT(pd) &&
(pd->d_parent->d_flags&DCACHE_DISCONNECTED)) {
struct dentry *parent = pd->d_parent;

dget(parent);
spin_unlock(&pd->d_lock);
dput(pd);
pd = parent;
spin_lock(&pd->d_lock);
}
spin_unlock(&pd->d_lock);
struct dentry *pd = find_disconnected_root(target_dir);

if (!IS_ROOT(pd)) {
/* must have found a connected parent - great */
Expand Down

0 comments on commit 7a1d13f

Please sign in to comment.