• 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: namespaces with parent-slave"
14
15	fs_bind_makedir rshared dir1
16	EXPECT_PASS mount --bind "$FS_BIND_DISK1" dir1
17
18	mkdir dir2
19	EXPECT_PASS mount --bind dir1 dir2
20	EXPECT_PASS mount --make-slave dir2
21
22	fs_bind_create_ns
23
24	EXPECT_PASS mount --bind "$FS_BIND_DISK2" dir1/a
25	fs_bind_check dir1/a dir2/a
26	EXPECT_PASS mount --bind "$FS_BIND_DISK3" dir2/b
27	fs_bind_check -n dir1/b dir2/b
28
29
30	fs_bind_check -s "$FS_BIND_DISK2" dir1/a dir2/a
31	fs_bind_check -s -n "$FS_BIND_DISK3" dir2/b
32	fs_bind_check -s -n "$FS_BIND_DISK3" dir1/b
33	fs_bind_exec_ns mount --bind "$PWD/$FS_BIND_DISK4" $PWD/dir1/c
34	fs_bind_check -s dir1/c dir2/c
35
36	fs_bind_exec_ns umount $PWD/dir2/a
37	fs_bind_check -s -n dir1/a dir2/a
38
39
40	fs_bind_check "$FS_BIND_DISK2" dir1/a dir2/a
41	fs_bind_check "$FS_BIND_DISK4" dir1/c dir2/c
42
43	fs_bind_destroy_ns
44
45	EXPECT_PASS umount dir1/c
46	EXPECT_PASS umount dir1/a
47	EXPECT_PASS umount dir2/b
48	EXPECT_PASS umount dir2
49	EXPECT_PASS umount dir1
50	EXPECT_PASS umount dir1
51}
52
53tst_run
54