diff options
| author | Daniel Rosenberg <drosen@google.com> | 2017-01-05 14:37:11 -0800 |
|---|---|---|
| committer | Arvin Quilao <arquilao@gmail.com> | 2017-03-07 04:06:51 +0000 |
| commit | beaf8b2566a94165561afc859ccdb6d066e3362d (patch) | |
| tree | 1a530f59a7dbd5e25f4a604a26940f8fa171a307 | |
| parent | 686fea7dc74a8c3f434cf34024191af243edd4eb (diff) | |
ANDROID: mnt: remount should propagate to slaves of slaves
propagate_remount was not accounting for the slave mounts
of other slave mounts, leading to some namespaces not
recieving the remount information.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 33731928
Change-Id: Idc9e8c2ed126a4143229fc23f10a959c2d0a3854
| -rw-r--r-- | fs/pnode.c | 27 | ||||
| -rw-r--r-- | fs/pnode.h | 2 |
2 files changed, 22 insertions, 7 deletions
diff --git a/fs/pnode.c b/fs/pnode.c index 2ef946f51a1..46a71f920a6 100644 --- a/fs/pnode.c +++ b/fs/pnode.c @@ -360,16 +360,31 @@ int propagate_umount(struct list_head *list) return 0; } -int propagate_remount(struct mount *mnt) { - struct mount *m; +/* + * Iterates over all slaves, and slaves of slaves. + */ +static struct mount *next_descendent(struct mount *root, struct mount *cur) +{ + if (!IS_MNT_NEW(cur) && !list_empty(&cur->mnt_slave_list)) + return first_slave(cur); + do { + if (cur->mnt_slave.next != &cur->mnt_master->mnt_slave_list) + return next_slave(cur); + cur = cur->mnt_master; + } while (cur != root); + return NULL; +} + +void propagate_remount(struct mount *mnt) +{ + struct mount *m = mnt; struct super_block *sb = mnt->mnt.mnt_sb; - int ret = 0; if (sb->s_op->copy_mnt_data) { - for (m = first_slave(mnt); m->mnt_slave.next != &mnt->mnt_slave_list; m = next_slave(m)) { + m = next_descendent(mnt, m); + while (m) { sb->s_op->copy_mnt_data(m->mnt.data, mnt->mnt.data); + m = next_descendent(mnt, m); } } - - return ret; } diff --git a/fs/pnode.h b/fs/pnode.h index ae8d67a9e96..b0709096de7 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -36,7 +36,7 @@ int propagate_mnt(struct mount *, struct mountpoint *, struct mount *, struct list_head *); int propagate_umount(struct list_head *); int propagate_mount_busy(struct mount *, int); -int propagate_remount(struct mount *); +void propagate_remount(struct mount *); void mnt_release_group_id(struct mount *); int get_dominating_id(struct mount *mnt, const struct path *root); unsigned int mnt_get_count(struct mount *mnt); |
