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