xref: /aosp_15_r20/external/ltp/testcases/kernel/fs/fs_bind/bind/fs_bind24.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
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 <[email protected]>
5# Author: Avantika Mathur ([email protected])
6
7FS_BIND_TESTFUNC=test
8
9
10test()
11{
12	tst_res TINFO "bind: shared child to shared parent"
13
14	fs_bind_makedir rshared dir1
15	mkdir dir1/1 dir1/1/2 dir1/1/2/3 dir1/1/2/fs_bind_check dir2 dir3 dir4
16	touch dir4/ls
17
18	EXPECT_PASS mount --bind dir1/1/2 dir2
19	EXPECT_PASS mount --make-rslave dir1
20	EXPECT_PASS mount --make-rshared dir1
21
22	EXPECT_PASS mount --bind dir1/1/2/3 dir3
23	EXPECT_PASS mount --make-rslave dir1
24
25	EXPECT_PASS mount --bind dir4 dir2/fs_bind_check
26	fs_bind_check dir1/1/2/fs_bind_check/ dir4
27
28	EXPECT_PASS umount dir2/fs_bind_check
29	EXPECT_PASS umount dir3
30	EXPECT_PASS umount dir2
31	EXPECT_PASS umount dir1
32}
33
34. fs_bind_lib.sh
35tst_run
36