• 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
10test()
11{
12	tst_res TINFO "cloneNS: slave child to slave parent"
13
14	mkdir parent1 parent2
15	EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1
16	EXPECT_PASS mount --make-rshared parent1
17	EXPECT_PASS mount --bind parent1 parent2
18
19	fs_bind_check parent1 parent2
20
21	EXPECT_PASS mount --move parent1 parent2/a
22
23	fs_bind_check parent2 parent2/a parent2/a/a
24
25	fs_bind_create_ns
26
27	fs_bind_check parent2 parent2/a parent2/a/a
28
29	EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent2/b
30	fs_bind_check parent2/b parent2/a/b parent2/a/a/b
31
32
33	fs_bind_check -s parent2 parent2/a parent2/a/a
34	fs_bind_check -s parent2/b parent2/a/b parent2/a/a/b
35
36	fs_bind_exec_ns mount --bind "$PWD/$FS_BIND_DISK3" "$PWD/parent2/a/c"
37	fs_bind_check -s parent2/c parent2/a/c parent2/a/a/c
38
39
40	fs_bind_check parent2 parent2/a parent2/a/a
41	fs_bind_check parent2/c parent2/a/c parent2/a/a/c
42
43	EXPECT_PASS umount parent2/a/a/c
44	fs_bind_check parent2/c parent2/a/c parent2/a/a/c
45
46
47	fs_bind_check -s parent2/c parent2/a/c parent2/a/a/c
48
49	EXPECT_PASS umount parent2/a/b
50	EXPECT_PASS umount parent2/a/a
51	EXPECT_PASS umount parent2
52}
53
54. fs_bind_lib.sh
55tst_run
56