summaryrefslogtreecommitdiff
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-04-11 22:59:45 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-04-11 22:59:45 -0700
commitcea39746deca7ce8b10f21e4a4b3e96c33381e2e (patch)
tree673297c70a7c5bc0d22d035d85bb40df16b24621 /include/linux/fs.h
parent3f66b056e1b56427eec0b26e0a20ac08fb8a6dc9 (diff)
[PATCH] add file_operations.fcntl
From: Chuck Lever <cel@citi.umich.edu> O_DIRECT|O_APPEND cannot possibly work on NFS, so NFS needs some way of preventing the user from setting this combination. We felt that the best way of implementing this restriction is to allow the filesytem to implement its own fcntl() handler. This patch does, that, and provide the appropriate handler for NFS. Additional details from Chuck: Forgetting O_DIRECT for a moment, O_APPEND writes on NFS don't work in any case when multiple clients are writing to a file, since an NFS client can never guarantee it knows where the true end of file is 100% of the time. it works as expected iff only one client writes to an O_APPEND file at a time. Multi-client O_APPEND writing doesn't seem to be a problem for any application I'm aware of. Since it can be made to behave in the multi-client case with careful application logic or by using file locking, I don't think we should disallow it. I want to drop the inode semaphore when doing NFS direct I/O because it is synchronous; holding the i_sem means we reduce direct I/O concurrency to one I/O per file at a time. the important thing sct was worried about was the case where a single client is writing with O_APPEND and O_DIRECT, and we don't hold the i_sem during the write. We must at least hold the i_sem when determining where the end of file is to do the O_APPEND write. In 2.6, I believe that is handled correctly in the VFS layer, so this is not an issue for 2.6, right?
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3e71560374c0..02976f7c9f47 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -621,6 +621,9 @@ extern struct list_head file_lock_list;
#include <linux/fcntl.h>
+extern long generic_file_fcntl(int fd, unsigned int cmd,
+ unsigned long arg, struct file *filp);
+
extern int fcntl_getlk(struct file *, struct flock __user *);
extern int fcntl_setlk(struct file *, unsigned int, struct flock __user *);
@@ -830,6 +833,8 @@ struct file_operations {
ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void __user *);
ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
+ long (*fcntl)(int fd, unsigned int cmd,
+ unsigned long arg, struct file *filp);
};
struct inode_operations {