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