diff options
| author | Daniel Rosenberg <drosen@google.com> | 2019-01-11 18:44:18 -0800 |
|---|---|---|
| committer | Alistair Delva <adelva@google.com> | 2020-05-03 00:27:09 +0000 |
| commit | 955d167947d2b902e8de1a25b5109e5b72e14099 (patch) | |
| tree | ce16b1b730f8aa16adc9054cfb721a3527e451e4 /fs/pnode.c | |
| parent | d004940de27a5dc897951494d2f7ca5c5c630bbf (diff) | |
ANDROID: mnt: Propagate remount correctly
This switches over to propagation_next to respect
namepsace semantics.
Test: Remounting to change the options of a fs with mount based
options should propagate to all shared copies of that mount,
and the slaves/indirect slaves of those.
Bug: 122428178
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: Ic35cd2782a646435689f5bedfa1f218fe4ab8254
Diffstat (limited to 'fs/pnode.c')
| -rw-r--r-- | fs/pnode.c | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/fs/pnode.c b/fs/pnode.c index 4f6bdc185187..b81231711ad7 100644 --- a/fs/pnode.c +++ b/fs/pnode.c @@ -609,36 +609,18 @@ int propagate_umount(struct list_head *list) return 0; } -/* - * 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 { - struct mount *master = cur->mnt_master; - - if (!master || cur->mnt_slave.next != &master->mnt_slave_list) { - struct mount *next = next_slave(cur); - - return (next == root) ? NULL : next; - } - cur = master; - } while (cur != root); - return NULL; -} - void propagate_remount(struct mount *mnt) { - struct mount *m = mnt; + struct mount *parent = mnt->mnt_parent; + struct mount *p = mnt, *m; struct super_block *sb = mnt->mnt.mnt_sb; - if (sb->s_op->copy_mnt_data) { - m = next_descendent(mnt, m); - while (m) { + if (!sb->s_op->copy_mnt_data) + return; + for (p = propagation_next(parent, parent); p; + p = propagation_next(p, parent)) { + m = __lookup_mnt(&p->mnt, mnt->mnt_mountpoint); + if (m) sb->s_op->copy_mnt_data(m->mnt.data, mnt->mnt.data); - m = next_descendent(mnt, m); - } } } |
