Skip to contentSkip to conversation

Lustre VFS patches for 2.6

PATCH In review Oleg Drokin 1 participant 1 message Jul 7, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 9/9 Lustre VFS patches for 2.6

Lustre needs to differentiate plain opens from opens for exec, in the latter case it is possible that client will decide that it cannot execute a file (after succesful open intent completion) e.g. due to wrong permissions and that may cause server to leak open file reference as close will never be called.

 fs/exec.c          |    4 ++--
 include/linux/fs.h |    1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
include/linux/fs.h renamed from include/linux/fs.h.orig +1 -0
@@ -74,6 +74,7 @@ extern int leases_enable, dir_notify_ena
 
 #define FMODE_READ 1
 #define FMODE_WRITE 2
+#define FMODE_EXEC 4
 
 #define RW_MASK		1
 #define RWA_MASK	2
fs/exec.c renamed from fs/exec.c.orig +2 -2
@@ -122,7 +122,7 @@ asmlinkage long sys_uselib(const char __
 	int error;
 
 	intent_init(&nd.intent.open, IT_OPEN);
-	nd.intent.open.flags = FMODE_READ;
+	nd.intent.open.flags = FMODE_READ|FMODE_EXEC;
 	error = user_path_walk_it(library, &nd);
 	if (error)
 		goto out;
@@ -476,7 +476,7 @@ struct file *open_exec(const char *name)
 	struct file *file;
 
 	intent_init(&nd.intent.open, IT_OPEN);
-	nd.intent.open.flags = FMODE_READ;
+	nd.intent.open.flags = FMODE_READ|FMODE_EXEC;
 	err = path_lookup_it(name, LOOKUP_FOLLOW, &nd);
 	file = ERR_PTR(err);