• 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: slave child to slave parent"
13
14	fs_bind_makedir rshared parent1
15	fs_bind_makedir rshared parent2
16	fs_bind_makedir rshared share1
17	fs_bind_makedir rshared share2
18	fs_bind_makedir rshared parent1/child1
19
20	EXPECT_PASS mount --bind parent2 share2
21	EXPECT_PASS mount --bind share1 parent1/child1
22	EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1
23	EXPECT_PASS mount --bind "$FS_BIND_DISK2" share2
24	EXPECT_PASS mount --make-rslave parent1/child1
25	EXPECT_PASS mount --make-rslave parent2
26
27	mkdir parent2/child2
28	fs_bind_check parent1/child1 share1
29	fs_bind_check parent2 share2
30
31	EXPECT_PASS mount --bind parent1/child1 parent2/child2
32	fs_bind_check parent1/child1 parent2/child2
33
34	EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent1/child1/a
35	fs_bind_check -n  parent1/child1/a parent2/child2/a
36	fs_bind_check -n parent1/child1/a share1/a
37
38	EXPECT_PASS mount --bind "$FS_BIND_DISK4" parent2/child2/b
39	fs_bind_check -n parent1/child1/b parent2/child2/b
40	fs_bind_check -n parent2/child2 share2/child2
41
42	EXPECT_PASS umount parent2/child2/b
43
44	EXPECT_PASS mount --bind "$FS_BIND_DISK4" share1/c
45	fs_bind_check share1/c parent1/child1/c
46	fs_bind_check parent1/child1/c parent2/child2/c
47
48	EXPECT_PASS umount parent1/child1/a
49	EXPECT_PASS umount share1/c
50	EXPECT_PASS umount parent2/child2
51	EXPECT_PASS umount parent1/child1
52	EXPECT_PASS umount parent1/child1
53	EXPECT_PASS umount parent1/child1
54	EXPECT_PASS umount share1
55	EXPECT_PASS umount share2
56	EXPECT_PASS umount share2
57	EXPECT_PASS umount share2
58	EXPECT_PASS umount parent2
59	EXPECT_PASS umount parent1
60}
61
62. fs_bind_lib.sh
63tst_run
64