summaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-10-05 01:18:40 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-10-05 01:18:40 +0000
commit012bb3e61e5eced6c610f9e036372bf0c8def2d1 (patch)
tree87efc733f9b164e8c85c0336f92c8fb7eff6d183 /fs/lockd
parent625a1589d3d6464b5d90b8a0918789e3afffd220 (diff)
Merge with Linux 2.4.0-test9. Please check DECstation, I had a number
of rejects to fixup while integrating Linus patches. I also found that this kernel will only boot SMP on Origin; the UP kernel freeze soon after bootup with SCSI timeout messages. I commit this anyway since I found that the last CVS versions had the same problem.
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/clntlock.c2
-rw-r--r--fs/lockd/clntproc.c18
-rw-r--r--fs/lockd/host.c4
-rw-r--r--fs/lockd/svc.c12
-rw-r--r--fs/lockd/svclock.c4
-rw-r--r--fs/lockd/svcshare.c1
-rw-r--r--fs/lockd/xdr.c4
-rw-r--r--fs/lockd/xdr4.c4
8 files changed, 32 insertions, 17 deletions
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index a3a4f072f..820bc4c7b 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -168,6 +168,7 @@ reclaimer(void *ptr)
* reclaim is in progress */
lock_kernel();
lockd_up();
+ down(&file_lock_sem);
/* First, reclaim all locks that have been granted previously. */
restart:
@@ -185,6 +186,7 @@ restart:
}
tmp = tmp->next;
}
+ up(&file_lock_sem);
host->h_reclaiming = 0;
wake_up(&host->h_gracewait);
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index a5ec6c774..c60f48da1 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -47,7 +47,6 @@ nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
struct nlm_args *argp = &req->a_args;
struct nlm_lock *lock = &argp->lock;
- memset(argp, 0, sizeof(*argp));
nlmclnt_next_cookie(&argp->cookie);
argp->state = nsm_local_state;
memcpy(&lock->fh, NFS_FH(fl->fl_file->f_dentry), sizeof(struct nfs_fh));
@@ -55,7 +54,7 @@ nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
lock->oh.data = req->a_owner;
lock->oh.len = sprintf(req->a_owner, "%d@%s",
current->pid, system_utsname.nodename);
- lock->fl = *fl;
+ locks_copy_lock(&lock->fl, fl);
}
/*
@@ -157,7 +156,9 @@ nlmclnt_proc(struct inode *inode, int cmd, struct file_lock *fl)
call->a_flags = RPC_TASK_ASYNC;
} else {
spin_unlock_irqrestore(&current->sigmask_lock, flags);
- call->a_flags = 0;
+ memset(call, 0, sizeof(*call));
+ locks_init_lock(&call->a_args.lock.fl);
+ locks_init_lock(&call->a_res.lock.fl);
}
call->a_host = host;
@@ -214,8 +215,12 @@ nlmclnt_alloc_call(void)
while (!signalled()) {
call = (struct nlm_rqst *) kmalloc(sizeof(struct nlm_rqst), GFP_KERNEL);
- if (call)
+ if (call) {
+ memset(call, 0, sizeof(*call));
+ locks_init_lock(&call->a_args.lock.fl);
+ locks_init_lock(&call->a_res.lock.fl);
return call;
+ }
printk("nlmclnt_alloc_call: failed, waiting for memory\n");
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(5*HZ);
@@ -389,7 +394,7 @@ nlmclnt_test(struct nlm_rqst *req, struct file_lock *fl)
* Report the conflicting lock back to the application.
* FIXME: Is it OK to report the pid back as well?
*/
- memcpy(fl, &req->a_res.lock.fl, sizeof(*fl));
+ locks_copy_lock(fl, &req->a_res.lock.fl);
/* fl->fl_pid = 0; */
} else {
return nlm_stat_to_errno(req->a_res.status);
@@ -476,6 +481,9 @@ nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl)
int status;
req = &reqst;
+ memset(req, 0, sizeof(*req));
+ locks_init_lock(&req->a_args.lock.fl);
+ locks_init_lock(&req->a_res.lock.fl);
req->a_host = host;
req->a_flags = 0;
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index a18c2d109..f14c9fcdf 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -29,8 +29,8 @@
#define NLM_HOST_ADDR(sv) (&(sv)->s_nlmclnt->cl_xprt->addr)
static struct nlm_host * nlm_hosts[NLM_HOST_NRHASH];
-static unsigned long next_gc = 0;
-static int nrhosts = 0;
+static unsigned long next_gc;
+static int nrhosts;
static DECLARE_MUTEX(nlm_host_sema);
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index c9e4b4b17..951ecbeaa 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -39,12 +39,12 @@
#define ALLOWED_SIGS (sigmask(SIGKILL))
extern struct svc_program nlmsvc_program;
-struct nlmsvc_binding * nlmsvc_ops = NULL;
+struct nlmsvc_binding * nlmsvc_ops;
static DECLARE_MUTEX(nlmsvc_sema);
-static unsigned int nlmsvc_users = 0;
-static pid_t nlmsvc_pid = 0;
-unsigned long nlmsvc_grace_period = 0;
-unsigned long nlmsvc_timeout = 0;
+static unsigned int nlmsvc_users;
+static pid_t nlmsvc_pid;
+unsigned long nlmsvc_grace_period;
+unsigned long nlmsvc_timeout;
static DECLARE_MUTEX_LOCKED(lockd_start);
static DECLARE_WAIT_QUEUE_HEAD(lockd_exit);
@@ -53,7 +53,7 @@ static DECLARE_WAIT_QUEUE_HEAD(lockd_exit);
* Currently the following can be set only at insmod time.
* Ideally, they would be accessible through the sysctl interface.
*/
-unsigned long nlm_grace_period = 0;
+unsigned long nlm_grace_period;
unsigned long nlm_timeout = LOCKD_DFLT_TIMEO;
/*
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 56c8d8173..a175d39eb 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -170,6 +170,8 @@ nlmsvc_create_block(struct svc_rqst *rqstp, struct nlm_file *file,
if (!(block = (struct nlm_block *) kmalloc(sizeof(*block), GFP_KERNEL)))
goto failed;
memset(block, 0, sizeof(*block));
+ locks_init_lock(&block->b_call.a_args.lock.fl);
+ locks_init_lock(&block->b_call.a_res.lock.fl);
/* Set notifier function for VFS, and init args */
lock->fl.fl_notify = nlmsvc_notify_blocked;
@@ -347,7 +349,7 @@ again:
/* Append to list of blocked */
nlmsvc_insert_block(block, NLM_NEVER);
- if (!list_empty(&block->b_call.a_args.lock.fl.fl_block)) {
+ if (list_empty(&block->b_call.a_args.lock.fl.fl_list)) {
/* Now add block to block list of the conflicting lock
if we haven't done so. */
dprintk("lockd: blocking on this lock.\n");
diff --git a/fs/lockd/svcshare.c b/fs/lockd/svcshare.c
index 4b34b9786..ab06a5d31 100644
--- a/fs/lockd/svcshare.c
+++ b/fs/lockd/svcshare.c
@@ -54,7 +54,6 @@ nlmsvc_share_file(struct nlm_host *host, struct nlm_file *file,
share->s_owner.len = oh->len;
share->s_next = file->f_shares;
file->f_shares = share;
- file->f_count += 1;
update:
share->s_access = argp->fsm_access;
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index d93ed2ac5..062191b9a 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -129,7 +129,7 @@ nlm_decode_lock(u32 *p, struct nlm_lock *lock)
|| !(p = nlm_decode_oh(p, &lock->oh)))
return NULL;
- memset(fl, 0, sizeof(*fl));
+ locks_init_lock(fl);
fl->fl_owner = current->files;
fl->fl_pid = ntohl(*p++);
fl->fl_flags = FL_POSIX;
@@ -314,6 +314,7 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
int len;
memset(lock, 0, sizeof(*lock));
+ locks_init_lock(&lock->fl);
lock->fl.fl_pid = ~(u32) 0;
if (!(p = nlm_decode_cookie(p, &argp->cookie))
@@ -430,6 +431,7 @@ nlmclt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
s32 start, len, end;
memset(&resp->lock, 0, sizeof(resp->lock));
+ locks_init_lock(fl);
excl = ntohl(*p++);
fl->fl_pid = ntohl(*p++);
if (!(p = nlm_decode_oh(p, &resp->lock.oh)))
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index 7ffa0a433..739387ab9 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -131,7 +131,7 @@ nlm4_decode_lock(u32 *p, struct nlm_lock *lock)
|| !(p = nlm4_decode_oh(p, &lock->oh)))
return NULL;
- memset(fl, 0, sizeof(*fl));
+ locks_init_lock(fl);
fl->fl_owner = current->files;
fl->fl_pid = ntohl(*p++);
fl->fl_flags = FL_POSIX;
@@ -322,6 +322,7 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
int len;
memset(lock, 0, sizeof(*lock));
+ locks_init_lock(&lock->fl);
lock->fl.fl_pid = ~(u32) 0;
if (!(p = nlm4_decode_cookie(p, &argp->cookie))
@@ -438,6 +439,7 @@ nlm4clt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
s64 start, end, len;
memset(&resp->lock, 0, sizeof(resp->lock));
+ locks_init_lock(fl);
excl = ntohl(*p++);
fl->fl_pid = ntohl(*p++);
if (!(p = nlm4_decode_oh(p, &resp->lock.oh)))