linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
To: linux-fsdevel@vger.kernel.org
Cc: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Subject: [PATCH] fs: point out any processes using O_PONIES
Date: Wed, 1 Apr 2009 00:18:43 -0400	[thread overview]
Message-ID: <20090401041843.GN19690@josefsipek.net> (raw)


From: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>

>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@josefsipek.net>
---
 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


                 reply	other threads:[~2009-04-01  4:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090401041843.GN19690@josefsipek.net \
    --to=jeffpc@josefsipek.net \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).