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
This commit is contained in:
commit
2d56d3c43c
15 changed files with 546 additions and 205 deletions
|
@ -3,6 +3,10 @@
|
|||
|
||||
#include <asm/fcntl.h>
|
||||
|
||||
/* Cancel a blocking posix lock; internal use only until we expose an
|
||||
* asynchronous lock api to userspace: */
|
||||
#define F_CANCELLK (F_LINUX_SPECIFIC_BASE+5)
|
||||
|
||||
#define F_SETLEASE (F_LINUX_SPECIFIC_BASE+0)
|
||||
#define F_GETLEASE (F_LINUX_SPECIFIC_BASE+1)
|
||||
|
||||
|
|
|
@ -786,6 +786,7 @@ struct file_lock_operations {
|
|||
struct lock_manager_operations {
|
||||
int (*fl_compare_owner)(struct file_lock *, struct file_lock *);
|
||||
void (*fl_notify)(struct file_lock *); /* unblock callback */
|
||||
int (*fl_grant)(struct file_lock *, struct file_lock *, int);
|
||||
void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
|
||||
void (*fl_release_private)(struct file_lock *);
|
||||
void (*fl_break)(struct file_lock *);
|
||||
|
@ -857,11 +858,13 @@ extern void locks_init_lock(struct file_lock *);
|
|||
extern void locks_copy_lock(struct file_lock *, struct file_lock *);
|
||||
extern void locks_remove_posix(struct file *, fl_owner_t);
|
||||
extern void locks_remove_flock(struct file *);
|
||||
extern int posix_test_lock(struct file *, struct file_lock *, struct file_lock *);
|
||||
extern int posix_lock_file_conf(struct file *, struct file_lock *, struct file_lock *);
|
||||
extern int posix_lock_file(struct file *, struct file_lock *);
|
||||
extern int posix_test_lock(struct file *, struct file_lock *);
|
||||
extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
|
||||
extern int posix_lock_file_wait(struct file *, struct file_lock *);
|
||||
extern int posix_unblock_lock(struct file *, struct file_lock *);
|
||||
extern int vfs_test_lock(struct file *, struct file_lock *);
|
||||
extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
|
||||
extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
|
||||
extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
|
||||
extern int __break_lease(struct inode *inode, unsigned int flags);
|
||||
extern void lease_get_mtime(struct inode *, struct timespec *time);
|
||||
|
|
|
@ -119,6 +119,9 @@ struct nlm_file {
|
|||
* couldn't be granted because of a conflicting lock).
|
||||
*/
|
||||
#define NLM_NEVER (~(unsigned long) 0)
|
||||
/* timeout on non-blocking call: */
|
||||
#define NLM_TIMEOUT (7 * HZ)
|
||||
|
||||
struct nlm_block {
|
||||
struct kref b_count; /* Reference count */
|
||||
struct list_head b_list; /* linked list of all blocks */
|
||||
|
@ -130,6 +133,13 @@ struct nlm_block {
|
|||
unsigned int b_id; /* block id */
|
||||
unsigned char b_granted; /* VFS granted lock */
|
||||
struct nlm_file * b_file; /* file in question */
|
||||
struct cache_req * b_cache_req; /* deferred request handling */
|
||||
struct file_lock * b_fl; /* set for GETLK */
|
||||
struct cache_deferred_req * b_deferred_req;
|
||||
unsigned int b_flags; /* block flags */
|
||||
#define B_QUEUED 1 /* lock queued */
|
||||
#define B_GOT_CALLBACK 2 /* got lock or conflicting lock */
|
||||
#define B_TIMED_OUT 4 /* filesystem too slow to respond */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -185,8 +195,8 @@ typedef int (*nlm_host_match_fn_t)(struct nlm_host *cur, struct nlm_host *ref)
|
|||
__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
|
||||
struct nlm_lock *, int, struct nlm_cookie *);
|
||||
__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
|
||||
__be32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *,
|
||||
struct nlm_lock *);
|
||||
__be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *,
|
||||
struct nlm_lock *, struct nlm_lock *, struct nlm_cookie *);
|
||||
__be32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
|
||||
unsigned long nlmsvc_retry_blocked(void);
|
||||
void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue