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 "rbind: multi-level slave p-nodes" 14 15 fs_bind_makedir rshared dir1 16 17 mkdir dir1/x dir2 dir3 dir4 18 19 EXPECT_PASS mount --rbind dir1 dir2 20 EXPECT_PASS mount --make-rslave dir2 21 EXPECT_PASS mount --make-share dir2 22 23 EXPECT_PASS mount --rbind dir2 dir3 24 EXPECT_PASS mount --make-rslave dir3 25 EXPECT_PASS mount --make-share dir3 26 27 EXPECT_PASS mount --rbind dir3 dir4 28 EXPECT_PASS mount --make-rslave dir4 29 30 EXPECT_PASS mount --rbind "$FS_BIND_DISK1" dir1/x 31 32 fs_bind_check dir1/x dir2/x dir3/x dir4/x 33 34 EXPECT_PASS mount --rbind "$FS_BIND_DISK2" dir2/x/a 35 fs_bind_check -n dir1/x/a dir2/x/a 36 fs_bind_check dir2/x/a dir3/x/a dir4/x/a 37 38 EXPECT_PASS mount --rbind "$FS_BIND_DISK3" dir3/x/b 39 fs_bind_check -n dir1/x/b dir3/x/b 40 fs_bind_check -n dir2/x/b dir3/x/b 41 fs_bind_check dir3/x/b dir4/x/b 42 43 EXPECT_PASS mount --rbind "$FS_BIND_DISK4" dir4/x/c 44 fs_bind_check -n dir1/x/c dir4/x/c 45 fs_bind_check -n dir2/x/c dir4/x/c 46 fs_bind_check -n dir3/x/c dir4/x/c 47 48 49 EXPECT_PASS umount dir2/x/a 50 EXPECT_PASS umount dir3/x/b 51 EXPECT_PASS umount dir4/x/c 52 EXPECT_PASS umount dir1/x 53 EXPECT_PASS umount dir1 54 EXPECT_PASS umount dir2 55 EXPECT_PASS umount dir3 56 EXPECT_PASS umount dir4 57} 58 59tst_run 60