2011-11-29 21:15:37

by Maxim Uvarov

[permalink] [raw]
Subject: nfs no inotify IN_DELETE event

Hello,

I'm looking on inotify02 test future in mainline kernel on nfs:

inotify_init() = 3
inotify_add_watch(3, ".", IN_ALL_EVENTS)
creat("test_file1", 0755) = 5
rename("test_file1", "test_file2") = 0
getcwd("/mnt/nfs2/tmp", 256) = 14
rename("/mnt/nfs2/tmp", "/mnt/nfs2/tmp.rename1") = 0
unlink("test_file2") = 0

After unlink() if file sytem is not nfs there is event:
IN_DELETE 0x00000200 /* Subfile was deleted */
for file test_file2. If file system is nfs there is no such event.

For the first time I thought that this is nfs sever bug related to nfs
"silly renamed files" feature. But logically - file test_file2 was not
deleted. It was removed with his directory from event watch directory to
non event watch directory.

1. is it ok that unlink() in that test returns 0, not -1 ENOENT?

2. should we get IN_DELETE for all files and sub folders for event watch
directory? Or there should be only one event that directory was removed?

To reproduce:
http://ltp.sourceforge.net/
make
cd testcases/kernel/syscalls/inotify
export TMPDIR=/mnt/nfs/tmp/
export TDIRECTORY=/mnt/nfs/tmp/
./inotify02

Best regards,
Maxim Uvarov.