summaryrefslogtreecommitdiff
path: root/fs/aufs/plink.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/aufs/plink.c')
-rw-r--r--fs/aufs/plink.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/aufs/plink.c b/fs/aufs/plink.c
index c42734dd4..d8d75e85d 100644
--- a/fs/aufs/plink.c
+++ b/fs/aufs/plink.c
@@ -32,6 +32,7 @@ int au_plink_maint(struct super_block *sb, int flags)
{
int err;
pid_t pid, ppid;
+ struct task_struct *parent, *prev;
struct au_sbinfo *sbi;
SiMustAnyLock(sb);
@@ -46,11 +47,22 @@ int au_plink_maint(struct super_block *sb, int flags)
goto out;
/* todo: it highly depends upon /sbin/mount.aufs */
+ prev = NULL;
+ parent = current;
+ ppid = 0;
rcu_read_lock();
- ppid = task_pid_vnr(rcu_dereference(current->real_parent));
+ while (1) {
+ parent = rcu_dereference(parent->real_parent);
+ if (parent == prev)
+ break;
+ ppid = task_pid_vnr(parent);
+ if (pid == ppid) {
+ rcu_read_unlock();
+ goto out;
+ }
+ prev = parent;
+ }
rcu_read_unlock();
- if (pid == ppid)
- goto out;
if (au_ftest_lock(flags, NOPLMW)) {
/* if there is no i_mutex lock in VFS, we don't need to wait */