aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:34:24 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:34:24 -0400
commit2d56d3c43cc97ae48586745556f5a5b564d61582 (patch)
tree28f2edc1e69b79e94d99023041dd0358861b6956 /include
parent0f9008ef38d5a6305d94bbdd8f20d68fc75c63b6 (diff)
parent586759f03e2e9031ac5589912a51a909ed53c30a (diff)
Merge branch 'server-cluster-locking-api' of git://linux-nfs.org/~bfields/linux
* 'server-cluster-locking-api' of git://linux-nfs.org/~bfields/linux: gfs2: nfs lock support for gfs2 lockd: add code to handle deferred lock requests lockd: always preallocate block in nlmsvc_lock() lockd: handle test_lock deferrals lockd: pass cookie in nlmsvc_testlock lockd: handle fl_grant callbacks lockd: save lock state on deferral locks: add fl_grant callback for asynchronous lock return nfsd4: Convert NFSv4 to new lock interface locks: add lock cancel command locks: allow {vfs,posix}_lock_file to return conflicting lock locks: factor out generic/filesystem switch from setlock code locks: factor out generic/filesystem switch from test_lock locks: give posix_test_lock same interface as ->lock locks: make ->lock release private data before returning in GETLK case locks: create posix-to-flock helper functions locks: trivial removal of unnecessary parentheses
Diffstat (limited to 'include')
-rw-r--r--include/linux/fcntl.h4
-rw-r--r--include/linux/fs.h9
-rw-r--r--include/linux/lockd/lockd.h14
3 files changed, 22 insertions, 5 deletions
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 996f5611cd59..40b93265d4ba 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -3,6 +3,10 @@
3 3
4#include <asm/fcntl.h> 4#include <asm/fcntl.h>
5 5
6/* Cancel a blocking posix lock; internal use only until we expose an
7 * asynchronous lock api to userspace: */
8#define F_CANCELLK (F_LINUX_SPECIFIC_BASE+5)
9
6#define F_SETLEASE (F_LINUX_SPECIFIC_BASE+0) 10#define F_SETLEASE (F_LINUX_SPECIFIC_BASE+0)
7#define F_GETLEASE (F_LINUX_SPECIFIC_BASE+1) 11#define F_GETLEASE (F_LINUX_SPECIFIC_BASE+1)
8 12
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 55a74ffa7e3b..bc6d27cecaac 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -786,6 +786,7 @@ struct file_lock_operations {
786struct lock_manager_operations { 786struct lock_manager_operations {
787 int (*fl_compare_owner)(struct file_lock *, struct file_lock *); 787 int (*fl_compare_owner)(struct file_lock *, struct file_lock *);
788 void (*fl_notify)(struct file_lock *); /* unblock callback */ 788 void (*fl_notify)(struct file_lock *); /* unblock callback */
789 int (*fl_grant)(struct file_lock *, struct file_lock *, int);
789 void (*fl_copy_lock)(struct file_lock *, struct file_lock *); 790 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
790 void (*fl_release_private)(struct file_lock *); 791 void (*fl_release_private)(struct file_lock *);
791 void (*fl_break)(struct file_lock *); 792 void (*fl_break)(struct file_lock *);
@@ -857,11 +858,13 @@ extern void locks_init_lock(struct file_lock *);
857extern void locks_copy_lock(struct file_lock *, struct file_lock *); 858extern void locks_copy_lock(struct file_lock *, struct file_lock *);
858extern void locks_remove_posix(struct file *, fl_owner_t); 859extern void locks_remove_posix(struct file *, fl_owner_t);
859extern void locks_remove_flock(struct file *); 860extern void locks_remove_flock(struct file *);
860extern int posix_test_lock(struct file *, struct file_lock *, struct file_lock *); 861extern int posix_test_lock(struct file *, struct file_lock *);
861extern int posix_lock_file_conf(struct file *, struct file_lock *, struct file_lock *); 862extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
862extern int posix_lock_file(struct file *, struct file_lock *);
863extern int posix_lock_file_wait(struct file *, struct file_lock *); 863extern int posix_lock_file_wait(struct file *, struct file_lock *);
864extern int posix_unblock_lock(struct file *, struct file_lock *); 864extern int posix_unblock_lock(struct file *, struct file_lock *);
865extern int vfs_test_lock(struct file *, struct file_lock *);
866extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
867extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
865extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 868extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
866extern int __break_lease(struct inode *inode, unsigned int flags); 869extern int __break_lease(struct inode *inode, unsigned int flags);
867extern void lease_get_mtime(struct inode *, struct timespec *time); 870extern void lease_get_mtime(struct inode *, struct timespec *time);
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index f6a81e0b1b93..05707e2fccae 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -119,6 +119,9 @@ struct nlm_file {
119 * couldn't be granted because of a conflicting lock). 119 * couldn't be granted because of a conflicting lock).
120 */ 120 */
121#define NLM_NEVER (~(unsigned long) 0) 121#define NLM_NEVER (~(unsigned long) 0)
122/* timeout on non-blocking call: */
123#define NLM_TIMEOUT (7 * HZ)
124
122struct nlm_block { 125struct nlm_block {
123 struct kref b_count; /* Reference count */ 126 struct kref b_count; /* Reference count */
124 struct list_head b_list; /* linked list of all blocks */ 127 struct list_head b_list; /* linked list of all blocks */
@@ -130,6 +133,13 @@ struct nlm_block {
130 unsigned int b_id; /* block id */ 133 unsigned int b_id; /* block id */
131 unsigned char b_granted; /* VFS granted lock */ 134 unsigned char b_granted; /* VFS granted lock */
132 struct nlm_file * b_file; /* file in question */ 135 struct nlm_file * b_file; /* file in question */
136 struct cache_req * b_cache_req; /* deferred request handling */
137 struct file_lock * b_fl; /* set for GETLK */
138 struct cache_deferred_req * b_deferred_req;
139 unsigned int b_flags; /* block flags */
140#define B_QUEUED 1 /* lock queued */
141#define B_GOT_CALLBACK 2 /* got lock or conflicting lock */
142#define B_TIMED_OUT 4 /* filesystem too slow to respond */
133}; 143};
134 144
135/* 145/*
@@ -185,8 +195,8 @@ typedef int (*nlm_host_match_fn_t)(struct nlm_host *cur, struct nlm_host *ref)
185__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 195__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
186 struct nlm_lock *, int, struct nlm_cookie *); 196 struct nlm_lock *, int, struct nlm_cookie *);
187__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 197__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
188__be32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *, 198__be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *,
189 struct nlm_lock *); 199 struct nlm_lock *, struct nlm_lock *, struct nlm_cookie *);
190__be32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); 200__be32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
191unsigned long nlmsvc_retry_blocked(void); 201unsigned long nlmsvc_retry_blocked(void);
192void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, 202void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,