diff options
author | Eric Paris <eparis@redhat.com> | 2009-12-17 21:24:25 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:54 -0400 |
commit | ecf081d1a73b077916f514f2ec744ded32b88ca1 (patch) | |
tree | f1a9892131a297d0f67cb0fd9189e3aac83e2219 /include/asm-generic | |
parent | 35566087099c3ff8901d65ee98af56347ee66e5a (diff) |
vfs: introduce FMODE_NONOTIFY
This is a new f_mode which can only be set by the kernel. It indicates
that the fd was opened by fanotify and should not cause future fanotify
events. This is needed to prevent fanotify livelock. An example of
obvious livelock is from fanotify close events.
Process A closes file1
This creates a close event for file1.
fanotify opens file1 for Listener X
Listener X deals with the event and closes its fd for file1.
This creates a close event for file1.
fanotify opens file1 for Listener X
Listener X deals with the event and closes its fd for file1.
This creates a close event for file1.
fanotify opens file1 for Listener X
Listener X deals with the event and closes its fd for file1.
notice a pattern?
The fix is to add the FMODE_NONOTIFY bit to the open filp done by the kernel
for fanotify. Thus when that file is used it will not generate future
events.
This patch simply defines the bit.
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/fcntl.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h index fcd268ce0674..009bd6149d99 100644 --- a/include/asm-generic/fcntl.h +++ b/include/asm-generic/fcntl.h | |||
@@ -3,6 +3,14 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | 5 | ||
6 | /* | ||
7 | * FMODE_EXEC is 0x20 | ||
8 | * FMODE_NONOTIFY is 0x800000 | ||
9 | * These cannot be used by userspace O_* until internal and external open | ||
10 | * flags are split. | ||
11 | * -Eric Paris | ||
12 | */ | ||
13 | |||
6 | #define O_ACCMODE 00000003 | 14 | #define O_ACCMODE 00000003 |
7 | #define O_RDONLY 00000000 | 15 | #define O_RDONLY 00000000 |
8 | #define O_WRONLY 00000001 | 16 | #define O_WRONLY 00000001 |