Commit 75069f2b5bfb5164beafaf3da597279c25b5535a
Committed by
Linus Torvalds
1 parent
9de93e7873
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
vfs: renumber FMODE_NONOTIFY and add to uniqueness check
Fix clashing values for O_PATH and FMODE_NONOTIFY on sparc. The clashing O_PATH value was added in commit 5229645bdc35 ("vfs: add nonconflicting values for O_PATH") but this can't be changed as it is user-visible. FMODE_NONOTIFY is only used internally in the kernel, but it is in the same numbering space as the other O_* flags, as indicated by the comment at the top of include/uapi/asm-generic/fcntl.h (and its use in fs/notify/fanotify/fanotify_user.c). So renumber it to avoid the clash. All of this has happened before (commit 12ed2e36c98a: "fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict"), and all of this will happen again -- so update the uniqueness check in fcntl_init() to include __FMODE_NONOTIFY. Signed-off-by: David Drysdale <drysdale@google.com> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Jan Kara <jack@suse.cz> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Eric Paris <eparis@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 3 changed files with 5 additions and 4 deletions Side-by-side Diff
fs/fcntl.c
... | ... | @@ -740,14 +740,15 @@ |
740 | 740 | * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY |
741 | 741 | * is defined as O_NONBLOCK on some platforms and not on others. |
742 | 742 | */ |
743 | - BUILD_BUG_ON(20 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( | |
743 | + BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( | |
744 | 744 | O_RDONLY | O_WRONLY | O_RDWR | |
745 | 745 | O_CREAT | O_EXCL | O_NOCTTY | |
746 | 746 | O_TRUNC | O_APPEND | /* O_NONBLOCK | */ |
747 | 747 | __O_SYNC | O_DSYNC | FASYNC | |
748 | 748 | O_DIRECT | O_LARGEFILE | O_DIRECTORY | |
749 | 749 | O_NOFOLLOW | O_NOATIME | O_CLOEXEC | |
750 | - __FMODE_EXEC | O_PATH | __O_TMPFILE | |
750 | + __FMODE_EXEC | O_PATH | __O_TMPFILE | | |
751 | + __FMODE_NONOTIFY | |
751 | 752 | )); |
752 | 753 | |
753 | 754 | fasync_cache = kmem_cache_create("fasync_cache", |
include/linux/fs.h
... | ... | @@ -135,7 +135,7 @@ |
135 | 135 | #define FMODE_CAN_WRITE ((__force fmode_t)0x40000) |
136 | 136 | |
137 | 137 | /* File was opened by fanotify and shouldn't generate fanotify events */ |
138 | -#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) | |
138 | +#define FMODE_NONOTIFY ((__force fmode_t)0x4000000) | |
139 | 139 | |
140 | 140 | /* |
141 | 141 | * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector |
include/uapi/asm-generic/fcntl.h