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