Skip to content

Commit

Permalink
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Linus Torvalds committed Jan 6, 2006
2 parents 221fc10 + 9e56904 commit 47853e7
Show file tree
Hide file tree
Showing 62 changed files with 2,140 additions and 1,339 deletions.
8 changes: 8 additions & 0 deletions Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,14 @@ running once the system is up.
nfsroot= [NFS] nfs root filesystem for disk-less boxes.
See Documentation/nfsroot.txt.

nfs.callback_tcpport=
[NFS] set the TCP port on which the NFSv4 callback
channel should listen.

nfs.idmap_cache_timeout=
[NFS] set the maximum lifetime for idmapper cache
entries.

nmi_watchdog= [KNL,BUGS=IA-32] Debugging features for SMP kernels

no387 [BUGS=IA-32] Tells the kernel to use the 387 maths
Expand Down
41 changes: 22 additions & 19 deletions fs/lockd/clntproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
static int nlmclnt_test(struct nlm_rqst *, struct file_lock *);
static int nlmclnt_lock(struct nlm_rqst *, struct file_lock *);
static int nlmclnt_unlock(struct nlm_rqst *, struct file_lock *);
static void nlmclnt_unlock_callback(struct rpc_task *);
static void nlmclnt_cancel_callback(struct rpc_task *);
static int nlm_stat_to_errno(u32 stat);
static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host);

static const struct rpc_call_ops nlmclnt_unlock_ops;
static const struct rpc_call_ops nlmclnt_cancel_ops;

/*
* Cookie counter for NLM requests
*/
Expand Down Expand Up @@ -221,8 +222,7 @@ nlmclnt_proc(struct inode *inode, int cmd, struct file_lock *fl)
goto done;
}
clnt->cl_softrtry = nfssrv->client->cl_softrtry;
clnt->cl_intr = nfssrv->client->cl_intr;
clnt->cl_chatty = nfssrv->client->cl_chatty;
clnt->cl_intr = nfssrv->client->cl_intr;
}

/* Keep the old signal mask */
Expand Down Expand Up @@ -399,8 +399,7 @@ nlmclnt_call(struct nlm_rqst *req, u32 proc)
/*
* Generic NLM call, async version.
*/
int
nlmsvc_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback)
int nlmsvc_async_call(struct nlm_rqst *req, u32 proc, const struct rpc_call_ops *tk_ops)
{
struct nlm_host *host = req->a_host;
struct rpc_clnt *clnt;
Expand All @@ -419,13 +418,12 @@ nlmsvc_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback)
msg.rpc_proc = &clnt->cl_procinfo[proc];

/* bootstrap and kick off the async RPC call */
status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, callback, req);
status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, tk_ops, req);

return status;
}

static int
nlmclnt_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback)
static int nlmclnt_async_call(struct nlm_rqst *req, u32 proc, const struct rpc_call_ops *tk_ops)
{
struct nlm_host *host = req->a_host;
struct rpc_clnt *clnt;
Expand All @@ -448,7 +446,7 @@ nlmclnt_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback)
/* Increment host refcount */
nlm_get_host(host);
/* bootstrap and kick off the async RPC call */
status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, callback, req);
status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, tk_ops, req);
if (status < 0)
nlm_release_host(host);
return status;
Expand Down Expand Up @@ -664,7 +662,7 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)

if (req->a_flags & RPC_TASK_ASYNC) {
status = nlmclnt_async_call(req, NLMPROC_UNLOCK,
nlmclnt_unlock_callback);
&nlmclnt_unlock_ops);
/* Hrmf... Do the unlock early since locks_remove_posix()
* really expects us to free the lock synchronously */
do_vfs_lock(fl);
Expand Down Expand Up @@ -692,10 +690,9 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
return -ENOLCK;
}

static void
nlmclnt_unlock_callback(struct rpc_task *task)
static void nlmclnt_unlock_callback(struct rpc_task *task, void *data)
{
struct nlm_rqst *req = (struct nlm_rqst *) task->tk_calldata;
struct nlm_rqst *req = data;
int status = req->a_res.status;

if (RPC_ASSASSINATED(task))
Expand All @@ -722,6 +719,10 @@ nlmclnt_unlock_callback(struct rpc_task *task)
rpc_restart_call(task);
}

static const struct rpc_call_ops nlmclnt_unlock_ops = {
.rpc_call_done = nlmclnt_unlock_callback,
};

/*
* Cancel a blocked lock request.
* We always use an async RPC call for this in order not to hang a
Expand Down Expand Up @@ -750,8 +751,7 @@ nlmclnt_cancel(struct nlm_host *host, struct file_lock *fl)

nlmclnt_setlockargs(req, fl);

status = nlmclnt_async_call(req, NLMPROC_CANCEL,
nlmclnt_cancel_callback);
status = nlmclnt_async_call(req, NLMPROC_CANCEL, &nlmclnt_cancel_ops);
if (status < 0) {
nlmclnt_release_lockargs(req);
kfree(req);
Expand All @@ -765,10 +765,9 @@ nlmclnt_cancel(struct nlm_host *host, struct file_lock *fl)
return status;
}

static void
nlmclnt_cancel_callback(struct rpc_task *task)
static void nlmclnt_cancel_callback(struct rpc_task *task, void *data)
{
struct nlm_rqst *req = (struct nlm_rqst *) task->tk_calldata;
struct nlm_rqst *req = data;

if (RPC_ASSASSINATED(task))
goto die;
Expand Down Expand Up @@ -807,6 +806,10 @@ nlmclnt_cancel_callback(struct rpc_task *task)
rpc_delay(task, 30 * HZ);
}

static const struct rpc_call_ops nlmclnt_cancel_ops = {
.rpc_call_done = nlmclnt_cancel_callback,
};

/*
* Convert an NLM status code to a generic kernel errno
*/
Expand Down
4 changes: 2 additions & 2 deletions fs/lockd/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ nlm_bind_host(struct nlm_host *host)
if ((clnt = host->h_rpcclnt) != NULL) {
xprt = clnt->cl_xprt;
if (time_after_eq(jiffies, host->h_nextrebind)) {
clnt->cl_port = 0;
rpc_force_rebind(clnt);
host->h_nextrebind = jiffies + NLM_HOST_REBIND;
dprintk("lockd: next rebind in %ld jiffies\n",
host->h_nextrebind - jiffies);
Expand Down Expand Up @@ -217,7 +217,7 @@ nlm_rebind_host(struct nlm_host *host)
{
dprintk("lockd: rebind host %s\n", host->h_name);
if (host->h_rpcclnt && time_after_eq(jiffies, host->h_nextrebind)) {
host->h_rpcclnt->cl_port = 0;
rpc_force_rebind(host->h_rpcclnt);
host->h_nextrebind = jiffies + NLM_HOST_REBIND;
}
}
Expand Down
1 change: 0 additions & 1 deletion fs/lockd/mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ nsm_create(void)
if (IS_ERR(clnt))
goto out_err;
clnt->cl_softrtry = 1;
clnt->cl_chatty = 1;
clnt->cl_oneshot = 1;
return clnt;

Expand Down
4 changes: 2 additions & 2 deletions fs/lockd/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ lockd(struct svc_rqst *rqstp)

}

flush_signals(current);

/*
* Check whether there's a new lockd process before
* shutting down the hosts and clearing the slot.
Expand All @@ -192,8 +194,6 @@ lockd(struct svc_rqst *rqstp)
"lockd: new process, skipping host shutdown\n");
wake_up(&lockd_exit);

flush_signals(current);

/* Exit the RPC thread */
svc_exit_thread(rqstp);

Expand Down
15 changes: 9 additions & 6 deletions fs/lockd/svc4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
#define NLMDBG_FACILITY NLMDBG_CLIENT

static u32 nlm4svc_callback(struct svc_rqst *, u32, struct nlm_res *);
static void nlm4svc_callback_exit(struct rpc_task *);

static const struct rpc_call_ops nlm4svc_callback_ops;

/*
* Obtain client and file from arguments
Expand Down Expand Up @@ -470,7 +471,6 @@ nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp,
}



/*
* This is the generic lockd callback for async RPC calls
*/
Expand All @@ -494,7 +494,7 @@ nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_res *resp)
call->a_host = host;
memcpy(&call->a_args, resp, sizeof(*resp));

if (nlmsvc_async_call(call, proc, nlm4svc_callback_exit) < 0)
if (nlmsvc_async_call(call, proc, &nlm4svc_callback_ops) < 0)
goto error;

return rpc_success;
Expand All @@ -504,10 +504,9 @@ nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_res *resp)
return rpc_system_err;
}

static void
nlm4svc_callback_exit(struct rpc_task *task)
static void nlm4svc_callback_exit(struct rpc_task *task, void *data)
{
struct nlm_rqst *call = (struct nlm_rqst *) task->tk_calldata;
struct nlm_rqst *call = data;

if (task->tk_status < 0) {
dprintk("lockd: %4d callback failed (errno = %d)\n",
Expand All @@ -517,6 +516,10 @@ nlm4svc_callback_exit(struct rpc_task *task)
kfree(call);
}

static const struct rpc_call_ops nlm4svc_callback_ops = {
.rpc_call_done = nlm4svc_callback_exit,
};

/*
* NLM Server procedures.
*/
Expand Down
42 changes: 22 additions & 20 deletions fs/lockd/svclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@

static void nlmsvc_insert_block(struct nlm_block *block, unsigned long);
static int nlmsvc_remove_block(struct nlm_block *block);
static void nlmsvc_grant_callback(struct rpc_task *task);

static const struct rpc_call_ops nlmsvc_grant_ops;

/*
* The list of blocked locks to retry
Expand Down Expand Up @@ -226,31 +227,27 @@ nlmsvc_create_block(struct svc_rqst *rqstp, struct nlm_file *file,
* It is the caller's responsibility to check whether the file
* can be closed hereafter.
*/
static void
static int
nlmsvc_delete_block(struct nlm_block *block, int unlock)
{
struct file_lock *fl = &block->b_call.a_args.lock.fl;
struct nlm_file *file = block->b_file;
struct nlm_block **bp;
int status = 0;

dprintk("lockd: deleting block %p...\n", block);

/* Remove block from list */
nlmsvc_remove_block(block);
if (fl->fl_next)
posix_unblock_lock(file->f_file, fl);
if (unlock) {
fl->fl_type = F_UNLCK;
posix_lock_file(file->f_file, fl);
block->b_granted = 0;
}
if (unlock)
status = posix_unblock_lock(file->f_file, fl);

/* If the block is in the middle of a GRANT callback,
* don't kill it yet. */
if (block->b_incall) {
nlmsvc_insert_block(block, NLM_NEVER);
block->b_done = 1;
return;
return status;
}

/* Remove block from file's list of blocks */
Expand All @@ -265,6 +262,7 @@ nlmsvc_delete_block(struct nlm_block *block, int unlock)
nlm_release_host(block->b_host);
nlmclnt_freegrantargs(&block->b_call);
kfree(block);
return status;
}

/*
Expand All @@ -275,6 +273,7 @@ int
nlmsvc_traverse_blocks(struct nlm_host *host, struct nlm_file *file, int action)
{
struct nlm_block *block, *next;
/* XXX: Will everything get cleaned up if we don't unlock here? */

down(&file->f_sema);
for (block = file->f_blocks; block; block = next) {
Expand Down Expand Up @@ -444,6 +443,7 @@ u32
nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
{
struct nlm_block *block;
int status = 0;

dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",
file->f_file->f_dentry->d_inode->i_sb->s_id,
Expand All @@ -454,9 +454,9 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)

down(&file->f_sema);
if ((block = nlmsvc_lookup_block(file, lock, 1)) != NULL)
nlmsvc_delete_block(block, 1);
status = nlmsvc_delete_block(block, 1);
up(&file->f_sema);
return nlm_granted;
return status ? nlm_lck_denied : nlm_granted;
}

/*
Expand Down Expand Up @@ -562,7 +562,7 @@ nlmsvc_grant_blocked(struct nlm_block *block)
/* Call the client */
nlm_get_host(block->b_call.a_host);
if (nlmsvc_async_call(&block->b_call, NLMPROC_GRANTED_MSG,
nlmsvc_grant_callback) < 0)
&nlmsvc_grant_ops) < 0)
nlm_release_host(block->b_call.a_host);
up(&file->f_sema);
}
Expand All @@ -575,10 +575,9 @@ nlmsvc_grant_blocked(struct nlm_block *block)
* chain once more in order to have it removed by lockd itself (which can
* then sleep on the file semaphore without disrupting e.g. the nfs client).
*/
static void
nlmsvc_grant_callback(struct rpc_task *task)
static void nlmsvc_grant_callback(struct rpc_task *task, void *data)
{
struct nlm_rqst *call = (struct nlm_rqst *) task->tk_calldata;
struct nlm_rqst *call = data;
struct nlm_block *block;
unsigned long timeout;
struct sockaddr_in *peer_addr = RPC_PEERADDR(task->tk_client);
Expand Down Expand Up @@ -614,6 +613,10 @@ nlmsvc_grant_callback(struct rpc_task *task)
nlm_release_host(call->a_host);
}

static const struct rpc_call_ops nlmsvc_grant_ops = {
.rpc_call_done = nlmsvc_grant_callback,
};

/*
* We received a GRANT_RES callback. Try to find the corresponding
* block.
Expand All @@ -633,11 +636,12 @@ nlmsvc_grant_reply(struct svc_rqst *rqstp, struct nlm_cookie *cookie, u32 status

file->f_count++;
down(&file->f_sema);
if ((block = nlmsvc_find_block(cookie,&rqstp->rq_addr)) != NULL) {
block = nlmsvc_find_block(cookie, &rqstp->rq_addr);
if (block) {
if (status == NLM_LCK_DENIED_GRACE_PERIOD) {
/* Try again in a couple of seconds */
nlmsvc_insert_block(block, 10 * HZ);
block = NULL;
up(&file->f_sema);
} else {
/* Lock is now held by client, or has been rejected.
* In both cases, the block should be removed. */
Expand All @@ -648,8 +652,6 @@ nlmsvc_grant_reply(struct svc_rqst *rqstp, struct nlm_cookie *cookie, u32 status
nlmsvc_delete_block(block, 1);
}
}
if (!block)
up(&file->f_sema);
nlm_release_file(file);
}

Expand Down
Loading

0 comments on commit 47853e7

Please sign in to comment.