linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: FMODE_EXEC or alike?
Date: Tue, 21 Feb 2006 13:30:55 +0200	[thread overview]
Message-ID: <20060221113055.GF5733@linuxhacker.ru> (raw)
In-Reply-To: <20060220215122.7aa8bbe5.akpm@osdl.org>

Hello!

  Introduce FMODE_EXEC file flag, to indicate that file is being opened for
  execution. This is useful for distributed filesystems to maintain consistent
  behavior for returning ETXTBUSY when opening for write and execution
  happens on different nodes.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>

--- linux-2.6.16-rc4/include/linux/fs.h.orig	2006-02-21 11:26:43.000000000 +0200
+++ linux-2.6.16-rc4/include/linux/fs.h	2006-02-21 11:30:16.000000000 +0200
@@ -65,6 +65,11 @@ extern int dir_notify_enable;
 #define FMODE_PREAD	8
 #define FMODE_PWRITE	FMODE_PREAD	/* These go hand in hand */
 
+/* File is being opened for execution. Primary users of this flag are
+   distributed filesystems that can use it to achieve correct ETXTBUSY
+   behavior for cross-node execution/opening_for_writing of files */
+#define FMODE_EXEC	16
+
 #define RW_MASK		1
 #define RWA_MASK	2
 #define READ 0
--- linux-2.6.16-rc4/fs/exec.c.orig	2006-02-19 20:34:06.000000000 +0200
+++ linux-2.6.16-rc4/fs/exec.c	2006-02-21 13:06:42.000000000 +0200
@@ -127,7 +127,7 @@ asmlinkage long sys_uselib(const char __
 	struct nameidata nd;
 	int error;
 
-	error = __user_path_lookup_open(library, LOOKUP_FOLLOW, &nd, FMODE_READ);
+	error = __user_path_lookup_open(library, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC);
 	if (error)
 		goto out;
 
@@ -477,7 +477,7 @@ struct file *open_exec(const char *name)
 	int err;
 	struct file *file;
 
-	err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, FMODE_READ);
+	err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC);
 	file = ERR_PTR(err);
 
 	if (!err) {

  reply	other threads:[~2006-02-21 11:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-20 22:19 FMODE_EXEC or alike? Oleg Drokin
2006-02-21  5:51 ` Andrew Morton
2006-02-21 11:30   ` Oleg Drokin [this message]
2006-02-21 11:36     ` Andrew Morton
2006-02-21 11:56       ` Oleg Drokin
2006-02-21 13:59   ` Trond Myklebust
2006-02-21 14:15     ` Antonio Vargas
2006-02-21 14:21       ` Oleg Drokin
2006-02-22  9:57         ` Antonio Vargas
2006-02-21 14:42       ` Trond Myklebust
2006-02-21 23:26     ` J. Bruce Fields
2006-02-21 23:32       ` Trond Myklebust
2006-02-22 19:57         ` J. Bruce Fields
2006-02-22 21:36           ` Trond Myklebust
2006-02-22 22:04             ` J. Bruce Fields
2006-02-22 22:17               ` Trond Myklebust
2006-02-22 23:31                 ` J. Bruce Fields
2006-02-21 10:39 ` Christoph Hellwig
2006-02-22  1:03   ` Chris Wedgwood
2006-02-22  8:59     ` Steven Whitehouse
2006-02-22 21:42       ` J. Bruce Fields
2006-02-22 22:02         ` Christoph Hellwig

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=20060221113055.GF5733@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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).