• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) International Business Machines  Corp., 2005
4# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
5# Author: Avantika Mathur (mathurav@us.ibm.com)
6
7FS_BIND_TESTFUNC=test
8
9. fs_bind_lib.sh
10
11test()
12{
13	tst_res TINFO "cloneNS: slave child to slave parent"
14
15	mkdir parent1 parent2
16	EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1
17	EXPECT_PASS mount --make-rshared parent1
18	EXPECT_PASS mount --bind parent1 parent2
19
20	fs_bind_check parent1 parent2
21
22	EXPECT_PASS mount --move parent1 parent2/a
23
24	fs_bind_check parent2 parent2/a parent2/a/a
25
26	fs_bind_create_ns
27
28	fs_bind_check parent2 parent2/a parent2/a/a
29
30	EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent2/b
31	fs_bind_check parent2/b parent2/a/b parent2/a/a/b
32
33
34	fs_bind_check -s parent2 parent2/a parent2/a/a
35	fs_bind_check -s parent2/b parent2/a/b parent2/a/a/b
36
37	fs_bind_exec_ns mount --bind "$PWD/$FS_BIND_DISK3" "$PWD/parent2/a/c"
38	fs_bind_check -s parent2/c parent2/a/c parent2/a/a/c
39
40
41	fs_bind_check parent2 parent2/a parent2/a/a
42	fs_bind_check parent2/c parent2/a/c parent2/a/a/c
43
44	EXPECT_PASS umount parent2/a/a/c
45	fs_bind_check parent2/c parent2/a/c parent2/a/a/c
46
47
48	fs_bind_check -s parent2/c parent2/a/c parent2/a/a/c
49
50	EXPECT_PASS umount parent2/a/b
51	EXPECT_PASS umount parent2/a/a
52	EXPECT_PASS umount parent2
53}
54
55tst_run
56