[PATCH] fs: point out any processes using O_PONIES

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Josef 'Jeff' Sipek <jeffpc@xxxxxxxxxxxxxx>

>From the recent discussions all over several mailing lists, and other
internet fora, it is obvious that userspace is looking for semantics the
kernel does not provide.  It is obvious that while today these applications
merely insist on the kernel knowing better and implicitly syncing the data
on the applications' behalf, it will not take long before the applications
will demand more (e.g., pink ponies).

Any applications wishing to inform the kernel that it has these unreasonable
assumptions (POSIX does not guarantee this, and thefore any application
which makes the assumption that the OS does sync data implicitly is by
definition non portable and/or broken) should open all files with the
O_PONIES flag.

This patch introduces a new open(2) flag, O_PONIES, and whenever it is used,
it printks a message identifying the process (pid & comm).  This is
analogous to the printks used to point out processes using old and/or
depricated interfaces.

(Note: compile tested only)

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@xxxxxxxxxxxxxx>
---
 fs/open.c                   |    3 +++
 include/asm-generic/fcntl.h |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/fs/open.c b/fs/open.c
index a3a78ce..e162a6e 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -1039,6 +1039,9 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
 			} else {
 				fsnotify_open(f->f_path.dentry);
 				fd_install(fd, f);
+				if (flags & O_PONIES)
+					printk(KERN_WARNING "'%s' uses O_PONIES\n",
+					       current->comm);
 			}
 		}
 		putname(tmp);
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index b847741..9648af4 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -51,6 +51,9 @@
 #ifndef O_CLOEXEC
 #define O_CLOEXEC	02000000	/* set close_on_exec */
 #endif
+#ifndef O_PONIES
+#define O_PONIES	04000000	/* unreasonable fs assumptions */
+#endif
 #ifndef O_NDELAY
 #define O_NDELAY	O_NONBLOCK
 #endif
-- 
1.6.2.107.ge47ee

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux