summaryrefslogtreecommitdiff
path: root/test/nfs/nfs-dir.test
blob: 33e5f5f124f20f7f3db7e4dd2f97fd9324d7651d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
This is a regression test for a bug in 2.4 kernels. The test must be run
as root on a machine that has a loopback mounted NFS export. The mount
must have root squashing enabled. The test must be run in the root of
the nfs mount, and requires the following environment variable:

EXPORT_PATH => the path that is mounted at the working directory.

	Create a test directory and file.

	$ umask 022
	$ mkdir %{EXPORT_PATH}/test
	$ echo blah > %{EXPORT_PATH}/test/blah

	Make sure the file can be accessed before.

	$ su bin
	$ cat test/blah
	> blah

	Set up a situation that triggers the bug.

	$ su
	$ chmod go-rwx %{EXPORT_PATH}/test
	$ setfacl -m u:bin:rx %{EXPORT_PATH}/test
	$ ls -dl %{EXPORT_PATH}/test | awk '{print $1, $3, $4}'
	> drwxr-x---+ root root
	$ getfacl --omit-header %{EXPORT_PATH}/test 2> /dev/null
	> user::rwx
	> user:bin:r-x
	> group::---
	> mask::r-x
	> other::---
	>

	This should also succeed. With the bug, reading the file would
	fail with "Stale NFS file handle" or "Input/output error".

	$ su bin
	$ cat test/blah
	> blah
	$ sleep 3
	$ cat test/blah
	> blah
	$ cat test/blah
	> blah

	Clean up.

	$ su
	$ rm -rf %{EXPORT_PATH}/test