* [PATCH 00/14] NFS/RPC client patches for 2.6.21
@ 2007-01-18 23:23 Chuck Lever
2007-01-18 23:29 ` [PATCH 01/14] NFS: fix print format for tk_pid Chuck Lever
` (13 more replies)
0 siblings, 14 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:23 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
Hi Trond-
I'd like you to consider these for 2.6.21. These include the new kernel
rpcbind client that supports versions 3 and 4 of the rpcbind protocol,
patches to fix tk_pid printk formatting, several patches that fix up RPC
buffer allocation, and a patch that makes rpc_show_tasks output more
readable by converting absolute function addresses to names.
--
corporate: <chuck dot lever at oracle dot com>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH 01/14] NFS: fix print format for tk_pid
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
@ 2007-01-18 23:29 ` Chuck Lever
2007-01-19 0:03 ` Christoph Hellwig
2007-01-18 23:29 ` [PATCH 02/14] SUNRPC: fix print format for tk_pid in auth_gss support Chuck Lever
` (12 subsequent siblings)
13 siblings, 1 reply; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:29 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
The tk_pid field is an unsigned short. The proper print format specifier for
that type is %5u, not %4d.
Also clean up some miscellaneous print formatting nits.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfs/direct.c | 6 +++---
fs/nfs/read.c | 4 ++--
fs/nfs/write.c | 8 ++++----
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index bd21d7f..7c02dc7 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -309,7 +309,7 @@ static ssize_t nfs_direct_read_schedule(
rpc_execute(&data->task);
- dfprintk(VFS, "NFS: %5u initiated direct read call (req %s/%Ld, %zu bytes @ offset %Lu)\n",
+ dprintk("NFS: %5u initiated direct read call (req %s/%Ld, %zu bytes @ offset %Lu)\n",
data->task.tk_pid,
inode->i_sb->s_id,
(long long)NFS_FILEID(inode),
@@ -639,7 +639,7 @@ static ssize_t nfs_direct_write_schedule
rpc_execute(&data->task);
- dfprintk(VFS, "NFS: %5u initiated direct write call (req %s/%Ld, %zu bytes @ offset %Lu)\n",
+ dprintk("NFS: %5u initiated direct write call (req %s/%Ld, %zu bytes @ offset %Lu)\n",
data->task.tk_pid,
inode->i_sb->s_id,
(long long)NFS_FILEID(inode),
@@ -797,7 +797,7 @@ ssize_t nfs_file_direct_write(struct kio
const char __user *buf = iov[0].iov_base;
size_t count = iov[0].iov_len;
- dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n",
+ dprintk("nfs: direct write(%s/%s, %lu@%Ld)\n",
file->f_path.dentry->d_parent->d_name.name,
file->f_path.dentry->d_name.name,
(unsigned long) count, (long long) pos);
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index a9c2652..47f5e56 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -278,7 +278,7 @@ static void nfs_read_rpcsetup(struct nfs
data->task.tk_cookie = (unsigned long)inode;
- dprintk("NFS: %4d initiated read call (req %s/%Ld, %u bytes @ offset %Lu)\n",
+ dprintk("NFS: %5u initiated read call (req %s/%Ld, %u bytes @ offset %Lu)\n",
data->task.tk_pid,
inode->i_sb->s_id,
(long long)NFS_FILEID(inode),
@@ -452,7 +452,7 @@ int nfs_readpage_result(struct rpc_task
{
int status;
- dprintk("%s: %4d, (status %d)\n", __FUNCTION__, task->tk_pid,
+ dprintk("NFS: %s: %5u, (status %d)\n", __FUNCTION__, task->tk_pid,
task->tk_status);
status = NFS_PROTO(data->inode)->read_done(task, data);
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 345492e..0ab8435 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -852,7 +852,7 @@ static void nfs_write_rpcsetup(struct nf
data->task.tk_priority = flush_task_priority(how);
data->task.tk_cookie = (unsigned long)inode;
- dprintk("NFS: %4d initiated write call (req %s/%Ld, %u bytes @ offset %Lu)\n",
+ dprintk("NFS: %5u initiated write call (req %s/%Ld, %u bytes @ offset %Lu)\n",
data->task.tk_pid,
inode->i_sb->s_id,
(long long)NFS_FILEID(inode),
@@ -1134,7 +1134,7 @@ int nfs_writeback_done(struct rpc_task *
struct nfs_writeres *resp = &data->res;
int status;
- dprintk("NFS: %4d nfs_writeback_done (status %d)\n",
+ dprintk("NFS: %5u nfs_writeback_done (status %d)\n",
task->tk_pid, task->tk_status);
/*
@@ -1250,7 +1250,7 @@ static void nfs_commit_rpcsetup(struct l
data->task.tk_priority = flush_task_priority(how);
data->task.tk_cookie = (unsigned long)inode;
- dprintk("NFS: %4d initiated commit call\n", data->task.tk_pid);
+ dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid);
}
/*
@@ -1291,7 +1291,7 @@ static void nfs_commit_done(struct rpc_t
struct nfs_write_data *data = calldata;
struct nfs_page *req;
- dprintk("NFS: %4d nfs_commit_done (status %d)\n",
+ dprintk("NFS: %5u nfs_commit_done (status %d)\n",
task->tk_pid, task->tk_status);
/* Call the NFS version-specific code */
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 02/14] SUNRPC: fix print format for tk_pid in auth_gss support
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
2007-01-18 23:29 ` [PATCH 01/14] NFS: fix print format for tk_pid Chuck Lever
@ 2007-01-18 23:29 ` Chuck Lever
2007-01-18 23:29 ` [PATCH 03/14] SUNRPC: fix print format for tk_pid Chuck Lever
` (11 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:29 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
The tk_pid field is an unsigned short. The proper print format specifier for
that type is %5u, not %4d.
Also clean up some miscellaneous print formatting nits.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
net/sunrpc/auth_gss/auth_gss.c | 52 +++++++++++++++++---------------
net/sunrpc/auth_gss/gss_krb5_crypto.c | 8 ++---
net/sunrpc/auth_gss/gss_krb5_mech.c | 3 +-
net/sunrpc/auth_gss/gss_krb5_seal.c | 2 +
net/sunrpc/auth_gss/gss_krb5_seqnum.c | 2 +
net/sunrpc/auth_gss/gss_krb5_unseal.c | 2 +
net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 +-
net/sunrpc/auth_gss/gss_mech_switch.c | 6 ++--
net/sunrpc/auth_gss/gss_spkm3_mech.c | 9 +++---
net/sunrpc/auth_gss/gss_spkm3_seal.c | 14 +++++----
net/sunrpc/auth_gss/gss_spkm3_token.c | 14 +++++----
net/sunrpc/auth_gss/gss_spkm3_unseal.c | 9 +++---
net/sunrpc/auth_gss/svcauth_gss.c | 11 ++++---
13 files changed, 73 insertions(+), 63 deletions(-)
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index e1a104a..2fe8e91 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -241,7 +241,7 @@ gss_fill_context(const void *p, const vo
}
return q;
err:
- dprintk("RPC: gss_fill_context returning %ld\n", -PTR_ERR(p));
+ dprintk("RPC: gss_fill_context returning %ld\n", -PTR_ERR(p));
return p;
}
@@ -276,10 +276,10 @@ __gss_find_upcall(struct gss_auth *gss_a
if (pos->uid != uid)
continue;
atomic_inc(&pos->count);
- dprintk("RPC: gss_find_upcall found msg %p\n", pos);
+ dprintk("RPC: gss_find_upcall found msg %p\n", pos);
return pos;
}
- dprintk("RPC: gss_find_upcall found nothing\n");
+ dprintk("RPC: gss_find_upcall found nothing\n");
return NULL;
}
@@ -393,7 +393,8 @@ gss_refresh_upcall(struct rpc_task *task
struct gss_upcall_msg *gss_msg;
int err = 0;
- dprintk("RPC: %4u gss_refresh_upcall for uid %u\n", task->tk_pid, cred->cr_uid);
+ dprintk("RPC: %5u gss_refresh_upcall for uid %u\n", task->tk_pid,
+ cred->cr_uid);
gss_msg = gss_setup_upcall(task->tk_client, gss_auth, cred);
if (IS_ERR(gss_msg)) {
err = PTR_ERR(gss_msg);
@@ -413,8 +414,8 @@ gss_refresh_upcall(struct rpc_task *task
spin_unlock(&gss_auth->lock);
gss_release_msg(gss_msg);
out:
- dprintk("RPC: %4u gss_refresh_upcall for uid %u result %d\n", task->tk_pid,
- cred->cr_uid, err);
+ dprintk("RPC: %5u gss_refresh_upcall for uid %u result %d\n",
+ task->tk_pid, cred->cr_uid, err);
return err;
}
@@ -426,7 +427,7 @@ gss_create_upcall(struct gss_auth *gss_a
DEFINE_WAIT(wait);
int err = 0;
- dprintk("RPC: gss_upcall for uid %u\n", cred->cr_uid);
+ dprintk("RPC: gss_upcall for uid %u\n", cred->cr_uid);
gss_msg = gss_setup_upcall(gss_auth->client, gss_auth, cred);
if (IS_ERR(gss_msg)) {
err = PTR_ERR(gss_msg);
@@ -454,7 +455,8 @@ out_intr:
finish_wait(&gss_msg->waitqueue, &wait);
gss_release_msg(gss_msg);
out:
- dprintk("RPC: gss_create_upcall for uid %u result %d\n", cred->cr_uid, err);
+ dprintk("RPC: gss_create_upcall for uid %u result %d\n",
+ cred->cr_uid, err);
return err;
}
@@ -546,14 +548,14 @@ gss_pipe_downcall(struct file *filp, con
}
gss_put_ctx(ctx);
kfree(buf);
- dprintk("RPC: gss_pipe_downcall returning length %Zu\n", mlen);
+ dprintk("RPC: gss_pipe_downcall returning length %Zu\n", mlen);
return mlen;
err_put_ctx:
gss_put_ctx(ctx);
err:
kfree(buf);
out:
- dprintk("RPC: gss_pipe_downcall returning %d\n", err);
+ dprintk("RPC: gss_pipe_downcall returning %d\n", err);
return err;
}
@@ -591,7 +593,7 @@ gss_pipe_destroy_msg(struct rpc_pipe_msg
static unsigned long ratelimit;
if (msg->errno < 0) {
- dprintk("RPC: gss_pipe_destroy_msg releasing msg %p\n",
+ dprintk("RPC: gss_pipe_destroy_msg releasing msg %p\n",
gss_msg);
atomic_inc(&gss_msg->count);
gss_unhash_msg(gss_msg);
@@ -618,7 +620,7 @@ gss_create(struct rpc_clnt *clnt, rpc_au
struct rpc_auth * auth;
int err = -ENOMEM; /* XXX? */
- dprintk("RPC: creating GSS authenticator for client %p\n",clnt);
+ dprintk("RPC: creating GSS authenticator for client %p\n", clnt);
if (!try_module_get(THIS_MODULE))
return ERR_PTR(err);
@@ -670,8 +672,8 @@ gss_destroy(struct rpc_auth *auth)
{
struct gss_auth *gss_auth;
- dprintk("RPC: destroying GSS authenticator %p flavor %d\n",
- auth, auth->au_flavor);
+ dprintk("RPC: destroying GSS authenticator %p flavor %d\n",
+ auth, auth->au_flavor);
gss_auth = container_of(auth, struct gss_auth, rpc_auth);
rpc_unlink(gss_auth->dentry);
@@ -689,7 +691,7 @@ gss_destroy(struct rpc_auth *auth)
static void
gss_destroy_ctx(struct gss_cl_ctx *ctx)
{
- dprintk("RPC: gss_destroy_ctx\n");
+ dprintk("RPC: gss_destroy_ctx\n");
if (ctx->gc_gss_ctx)
gss_delete_sec_context(&ctx->gc_gss_ctx);
@@ -703,7 +705,7 @@ gss_destroy_cred(struct rpc_cred *rc)
{
struct gss_cred *cred = container_of(rc, struct gss_cred, gc_base);
- dprintk("RPC: gss_destroy_cred \n");
+ dprintk("RPC: gss_destroy_cred \n");
if (cred->gc_ctx)
gss_put_ctx(cred->gc_ctx);
@@ -726,7 +728,7 @@ gss_create_cred(struct rpc_auth *auth, s
struct gss_cred *cred = NULL;
int err = -ENOMEM;
- dprintk("RPC: gss_create_cred for uid %d, flavor %d\n",
+ dprintk("RPC: gss_create_cred for uid %d, flavor %d\n",
acred->uid, auth->au_flavor);
if (!(cred = kzalloc(sizeof(*cred), GFP_KERNEL)))
@@ -745,7 +747,7 @@ gss_create_cred(struct rpc_auth *auth, s
return &cred->gc_base;
out_err:
- dprintk("RPC: gss_create_cred failed with error %d\n", err);
+ dprintk("RPC: gss_create_cred failed with error %d\n", err);
return ERR_PTR(err);
}
@@ -799,7 +801,7 @@ gss_marshal(struct rpc_task *task, __be3
struct kvec iov;
struct xdr_buf verf_buf;
- dprintk("RPC: %4u gss_marshal\n", task->tk_pid);
+ dprintk("RPC: %5u gss_marshal\n", task->tk_pid);
*p++ = htonl(RPC_AUTH_GSS);
cred_len = p++;
@@ -865,7 +867,7 @@ gss_validate(struct rpc_task *task, __be
u32 flav,len;
u32 maj_stat;
- dprintk("RPC: %4u gss_validate\n", task->tk_pid);
+ dprintk("RPC: %5u gss_validate\n", task->tk_pid);
flav = ntohl(*p++);
if ((len = ntohl(*p++)) > RPC_MAX_AUTH_SIZE)
@@ -888,12 +890,12 @@ gss_validate(struct rpc_task *task, __be
* calculate the length of the verifier: */
task->tk_auth->au_verfsize = XDR_QUADLEN(len) + 2;
gss_put_ctx(ctx);
- dprintk("RPC: %4u GSS gss_validate: gss_verify_mic succeeded.\n",
+ dprintk("RPC: %5u gss_validate: gss_verify_mic succeeded.\n",
task->tk_pid);
return p + XDR_QUADLEN(len);
out_bad:
gss_put_ctx(ctx);
- dprintk("RPC: %4u gss_validate failed.\n", task->tk_pid);
+ dprintk("RPC: %5u gss_validate failed.\n", task->tk_pid);
return NULL;
}
@@ -1063,7 +1065,7 @@ gss_wrap_req(struct rpc_task *task,
struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
int status = -EIO;
- dprintk("RPC: %4u gss_wrap_req\n", task->tk_pid);
+ dprintk("RPC: %5u gss_wrap_req\n", task->tk_pid);
if (ctx->gc_proc != RPC_GSS_PROC_DATA) {
/* The spec seems a little ambiguous here, but I think that not
* wrapping context destruction requests makes the most sense.
@@ -1086,7 +1088,7 @@ gss_wrap_req(struct rpc_task *task,
}
out:
gss_put_ctx(ctx);
- dprintk("RPC: %4u gss_wrap_req returning %d\n", task->tk_pid, status);
+ dprintk("RPC: %5u gss_wrap_req returning %d\n", task->tk_pid, status);
return status;
}
@@ -1192,7 +1194,7 @@ out_decode:
status = decode(rqstp, p, obj);
out:
gss_put_ctx(ctx);
- dprintk("RPC: %4u gss_unwrap_resp returning %d\n", task->tk_pid,
+ dprintk("RPC: %5u gss_unwrap_resp returning %d\n", task->tk_pid,
status);
return status;
}
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index d926cda..cd64efd 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -66,7 +66,7 @@ krb5_encrypt(
goto out;
if (crypto_blkcipher_ivsize(tfm) > 16) {
- dprintk("RPC: gss_k5encrypt: tfm iv size to large %d\n",
+ dprintk("RPC: gss_k5encrypt: tfm iv size to large %d\n",
crypto_blkcipher_ivsize(tfm));
goto out;
}
@@ -79,7 +79,7 @@ krb5_encrypt(
ret = crypto_blkcipher_encrypt_iv(&desc, sg, sg, length);
out:
- dprintk("RPC: krb5_encrypt returns %d\n",ret);
+ dprintk("RPC: krb5_encrypt returns %d\n", ret);
return ret;
}
@@ -102,7 +102,7 @@ krb5_decrypt(
goto out;
if (crypto_blkcipher_ivsize(tfm) > 16) {
- dprintk("RPC: gss_k5decrypt: tfm iv size to large %d\n",
+ dprintk("RPC: gss_k5decrypt: tfm iv size to large %d\n",
crypto_blkcipher_ivsize(tfm));
goto out;
}
@@ -114,7 +114,7 @@ krb5_decrypt(
ret = crypto_blkcipher_decrypt_iv(&desc, sg, sg, length);
out:
- dprintk("RPC: gss_k5decrypt returns %d\n",ret);
+ dprintk("RPC: gss_k5decrypt returns %d\n",ret);
return ret;
}
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
index 05d4bee..7b19432 100644
--- a/net/sunrpc/auth_gss/gss_krb5_mech.c
+++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
@@ -175,7 +175,8 @@ gss_import_sec_context_kerberos(const vo
}
ctx_id->internal_ctx_id = ctx;
- dprintk("RPC: Successfully imported new context.\n");
+
+ dprintk("RPC: Successfully imported new context.\n");
return 0;
out_err_free_key2:
diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c
index d0bb506..a0d9faa 100644
--- a/net/sunrpc/auth_gss/gss_krb5_seal.c
+++ b/net/sunrpc/auth_gss/gss_krb5_seal.c
@@ -83,7 +83,7 @@ gss_get_mic_kerberos(struct gss_ctx *gss
s32 now;
u32 seq_send;
- dprintk("RPC: gss_krb5_seal\n");
+ dprintk("RPC: gss_krb5_seal\n");
now = get_seconds();
diff --git a/net/sunrpc/auth_gss/gss_krb5_seqnum.c b/net/sunrpc/auth_gss/gss_krb5_seqnum.c
index c604baf..2f0b112 100644
--- a/net/sunrpc/auth_gss/gss_krb5_seqnum.c
+++ b/net/sunrpc/auth_gss/gss_krb5_seqnum.c
@@ -70,7 +70,7 @@ krb5_get_seq_num(struct crypto_blkcipher
s32 code;
unsigned char plain[8];
- dprintk("RPC: krb5_get_seq_num:\n");
+ dprintk("RPC: krb5_get_seq_num:\n");
if ((code = krb5_decrypt(key, cksum, buf, plain, 8)))
return code;
diff --git a/net/sunrpc/auth_gss/gss_krb5_unseal.c b/net/sunrpc/auth_gss/gss_krb5_unseal.c
index 87f8977..e30a993 100644
--- a/net/sunrpc/auth_gss/gss_krb5_unseal.c
+++ b/net/sunrpc/auth_gss/gss_krb5_unseal.c
@@ -86,7 +86,7 @@ gss_verify_mic_kerberos(struct gss_ctx *
unsigned char *ptr = (unsigned char *)read_token->data;
int bodysize;
- dprintk("RPC: krb5_read_token\n");
+ dprintk("RPC: krb5_read_token\n");
if (g_verify_token_header(&ctx->mech_used, &bodysize, &ptr,
read_token->len))
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
index fe25b3d..42b3220 100644
--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
+++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
@@ -129,7 +129,7 @@ gss_wrap_kerberos(struct gss_ctx *ctx, i
struct page **tmp_pages;
u32 seq_send;
- dprintk("RPC: gss_wrap_kerberos\n");
+ dprintk("RPC: gss_wrap_kerberos\n");
now = get_seconds();
@@ -215,7 +215,7 @@ gss_unwrap_kerberos(struct gss_ctx *ctx,
int data_len;
int blocksize;
- dprintk("RPC: gss_unwrap_kerberos\n");
+ dprintk("RPC: gss_unwrap_kerberos\n");
ptr = (u8 *)buf->head[0].iov_base + offset;
if (g_verify_token_header(&kctx->mech_used, &bodysize, &ptr,
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c
index 3db7453..c7681db 100644
--- a/net/sunrpc/auth_gss/gss_mech_switch.c
+++ b/net/sunrpc/auth_gss/gss_mech_switch.c
@@ -113,7 +113,7 @@ gss_mech_register(struct gss_api_mech *g
spin_lock(®istered_mechs_lock);
list_add(&gm->gm_list, ®istered_mechs);
spin_unlock(®istered_mechs_lock);
- dprintk("RPC: registered gss mechanism %s\n", gm->gm_name);
+ dprintk("RPC: registered gss mechanism %s\n", gm->gm_name);
return 0;
}
@@ -125,7 +125,7 @@ gss_mech_unregister(struct gss_api_mech
spin_lock(®istered_mechs_lock);
list_del(&gm->gm_list);
spin_unlock(®istered_mechs_lock);
- dprintk("RPC: unregistered gss mechanism %s\n", gm->gm_name);
+ dprintk("RPC: unregistered gss mechanism %s\n", gm->gm_name);
gss_mech_free(gm);
}
@@ -298,7 +298,7 @@ gss_unwrap(struct gss_ctx *ctx_id,
u32
gss_delete_sec_context(struct gss_ctx **context_handle)
{
- dprintk("RPC: gss_delete_sec_context deleting %p\n",
+ dprintk("RPC: gss_delete_sec_context deleting %p\n",
*context_handle);
if (!*context_handle)
diff --git a/net/sunrpc/auth_gss/gss_spkm3_mech.c b/net/sunrpc/auth_gss/gss_spkm3_mech.c
index 8ef3f1c..7e15aa6 100644
--- a/net/sunrpc/auth_gss/gss_spkm3_mech.c
+++ b/net/sunrpc/auth_gss/gss_spkm3_mech.c
@@ -97,7 +97,8 @@ gss_import_sec_context_spkm3(const void
if (IS_ERR(p))
goto out_err_free_ctx;
if (version != 1) {
- dprintk("RPC: unknown spkm3 token format: obsolete nfs-utils?\n");
+ dprintk("RPC: unknown spkm3 token format: "
+ "obsolete nfs-utils?\n");
goto out_err_free_ctx;
}
@@ -138,7 +139,7 @@ gss_import_sec_context_spkm3(const void
ctx_id->internal_ctx_id = ctx;
- dprintk("Successfully imported new spkm context.\n");
+ dprintk("RPC: Successfully imported new spkm context.\n");
return 0;
out_err_free_intg_key:
@@ -183,7 +184,7 @@ gss_verify_mic_spkm3(struct gss_ctx *ct
maj_stat = spkm3_read_token(sctx, checksum, signbuf, SPKM_MIC_TOK);
- dprintk("RPC: gss_verify_mic_spkm3 returning %d\n", maj_stat);
+ dprintk("RPC: gss_verify_mic_spkm3 returning %d\n", maj_stat);
return maj_stat;
}
@@ -197,7 +198,7 @@ gss_get_mic_spkm3(struct gss_ctx *ctx,
err = spkm3_make_token(sctx, message_buffer,
message_token, SPKM_MIC_TOK);
- dprintk("RPC: gss_get_mic_spkm3 returning %d\n", err);
+ dprintk("RPC: gss_get_mic_spkm3 returning %d\n", err);
return err;
}
diff --git a/net/sunrpc/auth_gss/gss_spkm3_seal.c b/net/sunrpc/auth_gss/gss_spkm3_seal.c
index b179d58..104cbf4 100644
--- a/net/sunrpc/auth_gss/gss_spkm3_seal.c
+++ b/net/sunrpc/auth_gss/gss_spkm3_seal.c
@@ -75,20 +75,21 @@ spkm3_make_token(struct spkm3_ctx *ctx,
now = jiffies;
if (ctx->ctx_id.len != 16) {
- dprintk("RPC: spkm3_make_token BAD ctx_id.len %d\n",
+ dprintk("RPC: spkm3_make_token BAD ctx_id.len %d\n",
ctx->ctx_id.len);
goto out_err;
}
if (!g_OID_equal(&ctx->intg_alg, &hmac_md5_oid)) {
- dprintk("RPC: gss_spkm3_seal: unsupported I-ALG algorithm."
- "only support hmac-md5 I-ALG.\n");
+ dprintk("RPC: gss_spkm3_seal: unsupported I-ALG "
+ "algorithm. only support hmac-md5 I-ALG.\n");
goto out_err;
} else
checksum_type = CKSUMTYPE_HMAC_MD5;
if (!g_OID_equal(&ctx->conf_alg, &cast5_cbc_oid)) {
- dprintk("RPC: gss_spkm3_seal: unsupported C-ALG algorithm\n");
+ dprintk("RPC: gss_spkm3_seal: unsupported C-ALG "
+ "algorithm\n");
goto out_err;
}
@@ -113,7 +114,8 @@ spkm3_make_token(struct spkm3_ctx *ctx,
spkm3_make_mic_token(&ptr, tokenlen, &mic_hdr, &md5cksum, md5elen, md5zbit);
} else if (toktype == SPKM_WRAP_TOK) { /* Not Supported */
- dprintk("RPC: gss_spkm3_seal: SPKM_WRAP_TOK not supported\n");
+ dprintk("RPC: gss_spkm3_seal: SPKM_WRAP_TOK "
+ "not supported\n");
goto out_err;
}
@@ -153,7 +155,7 @@ make_spkm3_checksum(s32 cksumtype, struc
cksumname = "md5";
break;
default:
- dprintk("RPC: spkm3_make_checksum:"
+ dprintk("RPC: spkm3_make_checksum:"
" unsupported checksum %d", cksumtype);
return GSS_S_FAILURE;
}
diff --git a/net/sunrpc/auth_gss/gss_spkm3_token.c b/net/sunrpc/auth_gss/gss_spkm3_token.c
index 35188b6..156413a 100644
--- a/net/sunrpc/auth_gss/gss_spkm3_token.c
+++ b/net/sunrpc/auth_gss/gss_spkm3_token.c
@@ -209,7 +209,7 @@ spkm3_verify_mic_token(unsigned char **t
/* spkm3 innercontext token preamble */
if ((ptr[0] != 0xa4) || (ptr[2] != 0x30)) {
- dprintk("RPC: BAD SPKM ictoken preamble\n");
+ dprintk("RPC: BAD SPKM ictoken preamble\n");
goto out;
}
@@ -217,25 +217,25 @@ spkm3_verify_mic_token(unsigned char **t
/* token type */
if ((ptr[4] != 0x02) || (ptr[5] != 0x02)) {
- dprintk("RPC: BAD asn1 SPKM3 token type\n");
+ dprintk("RPC: BAD asn1 SPKM3 token type\n");
goto out;
}
/* only support SPKM_MIC_TOK */
if((ptr[6] != 0x01) || (ptr[7] != 0x01)) {
- dprintk("RPC: ERROR unsupported SPKM3 token \n");
+ dprintk("RPC: ERROR unsupported SPKM3 token \n");
goto out;
}
/* contextid */
if (ptr[8] != 0x03) {
- dprintk("RPC: BAD SPKM3 asn1 context-id type\n");
+ dprintk("RPC: BAD SPKM3 asn1 context-id type\n");
goto out;
}
ctxelen = ptr[9];
if (ctxelen > 17) { /* length includes asn1 zbit octet */
- dprintk("RPC: BAD SPKM3 contextid len %d\n", ctxelen);
+ dprintk("RPC: BAD SPKM3 contextid len %d\n", ctxelen);
goto out;
}
@@ -251,7 +251,9 @@ spkm3_verify_mic_token(unsigned char **t
*/
if (*mic_hdrlen != 6 + ctxelen) {
- dprintk("RPC: BAD SPKM_ MIC_TOK header len %d: we only support default int-alg (should be absent) and do not support snd-seq\n", *mic_hdrlen);
+ dprintk("RPC: BAD SPKM_ MIC_TOK header len %d: we only "
+ "support default int-alg (should be absent) "
+ "and do not support snd-seq\n", *mic_hdrlen);
goto out;
}
/* checksum */
diff --git a/net/sunrpc/auth_gss/gss_spkm3_unseal.c b/net/sunrpc/auth_gss/gss_spkm3_unseal.c
index e54581c..ac1ad6b 100644
--- a/net/sunrpc/auth_gss/gss_spkm3_unseal.c
+++ b/net/sunrpc/auth_gss/gss_spkm3_unseal.c
@@ -72,7 +72,7 @@ spkm3_read_token(struct spkm3_ctx *ctx,
/* decode the token */
if (toktype != SPKM_MIC_TOK) {
- dprintk("RPC: BAD SPKM3 token type: %d\n", toktype);
+ dprintk("RPC: BAD SPKM3 token type: %d\n", toktype);
goto out;
}
@@ -80,7 +80,7 @@ spkm3_read_token(struct spkm3_ctx *ctx,
goto out;
if (*cksum++ != 0x03) {
- dprintk("RPC: spkm3_read_token BAD checksum type\n");
+ dprintk("RPC: spkm3_read_token BAD checksum type\n");
goto out;
}
md5elen = *cksum++;
@@ -97,7 +97,8 @@ spkm3_read_token(struct spkm3_ctx *ctx,
*/
ret = GSS_S_DEFECTIVE_TOKEN;
if (!g_OID_equal(&ctx->intg_alg, &hmac_md5_oid)) {
- dprintk("RPC: gss_spkm3_seal: unsupported I-ALG algorithm\n");
+ dprintk("RPC: gss_spkm3_seal: unsupported I-ALG "
+ "algorithm\n");
goto out;
}
@@ -113,7 +114,7 @@ spkm3_read_token(struct spkm3_ctx *ctx,
ret = GSS_S_BAD_SIG;
code = memcmp(md5cksum.data, wire_cksum.data, wire_cksum.len);
if (code) {
- dprintk("RPC: bad MIC checksum\n");
+ dprintk("RPC: bad MIC checksum\n");
goto out;
}
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 066c64a..8944cab 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -669,14 +669,14 @@ gss_verify_header(struct svc_rqst *rqstp
}
if (gc->gc_seq > MAXSEQ) {
- dprintk("RPC: svcauth_gss: discarding request with large sequence number %d\n",
- gc->gc_seq);
+ dprintk("RPC: svcauth_gss: discarding request with "
+ "large sequence number %d\n", gc->gc_seq);
*authp = rpcsec_gsserr_ctxproblem;
return SVC_DENIED;
}
if (!gss_check_seq_num(rsci, gc->gc_seq)) {
- dprintk("RPC: svcauth_gss: discarding request with old sequence number %d\n",
- gc->gc_seq);
+ dprintk("RPC: svcauth_gss: discarding request with "
+ "old sequence number %d\n", gc->gc_seq);
return SVC_DROP;
}
return SVC_OK;
@@ -958,7 +958,8 @@ svcauth_gss_accept(struct svc_rqst *rqst
__be32 *reject_stat = resv->iov_base + resv->iov_len;
int ret;
- dprintk("RPC: svcauth_gss: argv->iov_len = %zd\n",argv->iov_len);
+ dprintk("RPC: svcauth_gss: argv->iov_len = %zd\n",
+ argv->iov_len);
*authp = rpc_autherr_badcred;
if (!svcdata)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 03/14] SUNRPC: fix print format for tk_pid
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
2007-01-18 23:29 ` [PATCH 01/14] NFS: fix print format for tk_pid Chuck Lever
2007-01-18 23:29 ` [PATCH 02/14] SUNRPC: fix print format for tk_pid in auth_gss support Chuck Lever
@ 2007-01-18 23:29 ` Chuck Lever
2007-01-18 23:29 ` [PATCH 04/14] SUNRPC: Eliminate side effects from rpc_malloc Chuck Lever
` (10 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:29 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
The tk_pid field is an unsigned short. The proper print format specifier for
that type is %5u, not %4d.
Also clean up some miscellaneous print formatting nits.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
net/sunrpc/auth.c | 25 +++++----
net/sunrpc/auth_unix.c | 9 ++-
net/sunrpc/cache.c | 3 +
net/sunrpc/clnt.c | 129 ++++++++++++++++++++++++++----------------------
net/sunrpc/pmap_clnt.c | 18 ++++---
net/sunrpc/sched.c | 66 +++++++++++++------------
net/sunrpc/stats.c | 6 +-
net/sunrpc/svc.c | 6 +-
net/sunrpc/xprt.c | 57 ++++++++++++---------
net/sunrpc/xprtsock.c | 107 +++++++++++++++++++++-------------------
10 files changed, 228 insertions(+), 198 deletions(-)
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 993ff1a..5752f29 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -181,7 +181,7 @@ rpcauth_gc_credcache(struct rpc_auth *au
struct rpc_cred *cred;
int i;
- dprintk("RPC: gc'ing RPC credentials for auth %p\n", auth);
+ dprintk("RPC: gc'ing RPC credentials for auth %p\n", auth);
for (i = 0; i < RPC_CREDCACHE_NR; i++) {
hlist_for_each_safe(pos, next, &cache->hashtable[i]) {
cred = hlist_entry(pos, struct rpc_cred, cr_hash);
@@ -267,7 +267,7 @@ rpcauth_lookupcred(struct rpc_auth *auth
};
struct rpc_cred *ret;
- dprintk("RPC: looking up %s cred\n",
+ dprintk("RPC: looking up %s cred\n",
auth->au_ops->au_name);
get_group_info(acred.group_info);
ret = auth->au_ops->lookup_cred(auth, &acred, flags);
@@ -287,7 +287,7 @@ rpcauth_bindcred(struct rpc_task *task)
struct rpc_cred *ret;
int flags = 0;
- dprintk("RPC: %4d looking up %s cred\n",
+ dprintk("RPC: %5u looking up %s cred\n",
task->tk_pid, task->tk_auth->au_ops->au_name);
get_group_info(acred.group_info);
if (task->tk_flags & RPC_TASK_ROOTCREDS)
@@ -304,8 +304,9 @@ rpcauth_bindcred(struct rpc_task *task)
void
rpcauth_holdcred(struct rpc_task *task)
{
- dprintk("RPC: %4d holding %s cred %p\n",
- task->tk_pid, task->tk_auth->au_ops->au_name, task->tk_msg.rpc_cred);
+ dprintk("RPC: %5u holding %s cred %p\n",
+ task->tk_pid, task->tk_auth->au_ops->au_name,
+ task->tk_msg.rpc_cred);
if (task->tk_msg.rpc_cred)
get_rpccred(task->tk_msg.rpc_cred);
}
@@ -324,7 +325,7 @@ rpcauth_unbindcred(struct rpc_task *task
{
struct rpc_cred *cred = task->tk_msg.rpc_cred;
- dprintk("RPC: %4d releasing %s cred %p\n",
+ dprintk("RPC: %5u releasing %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, cred);
put_rpccred(cred);
@@ -336,7 +337,7 @@ rpcauth_marshcred(struct rpc_task *task,
{
struct rpc_cred *cred = task->tk_msg.rpc_cred;
- dprintk("RPC: %4d marshaling %s cred %p\n",
+ dprintk("RPC: %5u marshaling %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, cred);
return cred->cr_ops->crmarshal(task, p);
@@ -347,7 +348,7 @@ rpcauth_checkverf(struct rpc_task *task,
{
struct rpc_cred *cred = task->tk_msg.rpc_cred;
- dprintk("RPC: %4d validating %s cred %p\n",
+ dprintk("RPC: %5u validating %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, cred);
return cred->cr_ops->crvalidate(task, p);
@@ -359,7 +360,7 @@ rpcauth_wrap_req(struct rpc_task *task,
{
struct rpc_cred *cred = task->tk_msg.rpc_cred;
- dprintk("RPC: %4d using %s cred %p to wrap rpc data\n",
+ dprintk("RPC: %5u using %s cred %p to wrap rpc data\n",
task->tk_pid, cred->cr_ops->cr_name, cred);
if (cred->cr_ops->crwrap_req)
return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj);
@@ -373,7 +374,7 @@ rpcauth_unwrap_resp(struct rpc_task *tas
{
struct rpc_cred *cred = task->tk_msg.rpc_cred;
- dprintk("RPC: %4d using %s cred %p to unwrap rpc data\n",
+ dprintk("RPC: %5u using %s cred %p to unwrap rpc data\n",
task->tk_pid, cred->cr_ops->cr_name, cred);
if (cred->cr_ops->crunwrap_resp)
return cred->cr_ops->crunwrap_resp(task, decode, rqstp,
@@ -388,7 +389,7 @@ rpcauth_refreshcred(struct rpc_task *tas
struct rpc_cred *cred = task->tk_msg.rpc_cred;
int err;
- dprintk("RPC: %4d refreshing %s cred %p\n",
+ dprintk("RPC: %5u refreshing %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, cred);
err = cred->cr_ops->crrefresh(task);
@@ -400,7 +401,7 @@ rpcauth_refreshcred(struct rpc_task *tas
void
rpcauth_invalcred(struct rpc_task *task)
{
- dprintk("RPC: %4d invalidating %s cred %p\n",
+ dprintk("RPC: %5u invalidating %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, task->tk_msg.rpc_cred);
spin_lock(&rpc_credcache_lock);
if (task->tk_msg.rpc_cred)
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
index f7f990c..4e7733a 100644
--- a/net/sunrpc/auth_unix.c
+++ b/net/sunrpc/auth_unix.c
@@ -39,7 +39,8 @@ static struct rpc_credops unix_credops;
static struct rpc_auth *
unx_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
{
- dprintk("RPC: creating UNIX authenticator for client %p\n", clnt);
+ dprintk("RPC: creating UNIX authenticator for client %p\n",
+ clnt);
if (atomic_inc_return(&unix_auth.au_count) == 0)
unix_cred_cache.nextgc = jiffies + (unix_cred_cache.expire >> 1);
return &unix_auth;
@@ -48,7 +49,7 @@ unx_create(struct rpc_clnt *clnt, rpc_au
static void
unx_destroy(struct rpc_auth *auth)
{
- dprintk("RPC: destroying UNIX authenticator %p\n", auth);
+ dprintk("RPC: destroying UNIX authenticator %p\n", auth);
rpcauth_free_credcache(auth);
}
@@ -67,8 +68,8 @@ unx_create_cred(struct rpc_auth *auth, s
struct unx_cred *cred;
int i;
- dprintk("RPC: allocating UNIX cred for uid %d gid %d\n",
- acred->uid, acred->gid);
+ dprintk("RPC: allocating UNIX cred for uid %d gid %d\n",
+ acred->uid, acred->gid);
if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL)))
return ERR_PTR(-ENOMEM);
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 1427449..9e72223 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -215,7 +215,8 @@ int cache_check(struct cache_detail *det
if (rv == -EAGAIN)
rv = -ENOENT;
} else if (rv == -EAGAIN || age > refresh_age/2) {
- dprintk("Want update, refage=%ld, age=%ld\n", refresh_age, age);
+ dprintk("RPC: Want update, refage=%ld, age=%ld\n",
+ refresh_age, age);
if (!test_and_set_bit(CACHE_PENDING, &h->flags)) {
switch (cache_make_upcall(detail, h)) {
case -EINVAL:
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index aba528b..f837335 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -42,6 +42,10 @@ #ifdef RPC_DEBUG
# define RPCDBG_FACILITY RPCDBG_CALL
#endif
+#define dprint_status(t) \
+ dprintk("RPC: %5u %s (status %d)\n", t->tk_pid, \
+ __FUNCTION__, t->tk_status)
+
static DECLARE_WAIT_QUEUE_HEAD(destroy_wait);
@@ -106,8 +110,8 @@ static struct rpc_clnt * rpc_new_client(
int err;
int len;
- dprintk("RPC: creating %s client for %s (xprt %p)\n",
- program->name, servname, xprt);
+ dprintk("RPC: creating %s client for %s (xprt %p)\n",
+ program->name, servname, xprt);
err = -EINVAL;
if (!xprt)
@@ -220,7 +224,7 @@ struct rpc_clnt *rpc_create(struct rpc_c
xprt->resvport = 0;
dprintk("RPC: creating %s client for %s (xprt %p)\n",
- args->program->name, args->servername, xprt);
+ args->program->name, args->servername, xprt);
clnt = rpc_new_client(xprt, args->servername, args->program,
args->version, args->authflavor);
@@ -288,7 +292,7 @@ out_no_path:
out_no_stats:
kfree(new);
out_no_clnt:
- dprintk("RPC: %s returned error %d\n", __FUNCTION__, err);
+ dprintk("RPC: %s: returned error %d\n", __FUNCTION__, err);
return ERR_PTR(err);
}
@@ -301,7 +305,7 @@ out_no_clnt:
int
rpc_shutdown_client(struct rpc_clnt *clnt)
{
- dprintk("RPC: shutting down %s client for %s, tasks=%d\n",
+ dprintk("RPC: shutting down %s client for %s, tasks=%d\n",
clnt->cl_protname, clnt->cl_server,
atomic_read(&clnt->cl_users));
@@ -336,7 +340,7 @@ rpc_destroy_client(struct rpc_clnt *clnt
return 1;
BUG_ON(atomic_read(&clnt->cl_users) != 0);
- dprintk("RPC: destroying %s client for %s\n",
+ dprintk("RPC: destroying %s client for %s\n",
clnt->cl_protname, clnt->cl_server);
if (clnt->cl_auth) {
rpcauth_destroy(clnt->cl_auth);
@@ -366,8 +370,8 @@ out_free:
void
rpc_release_client(struct rpc_clnt *clnt)
{
- dprintk("RPC: rpc_release_client(%p, %d)\n",
- clnt, atomic_read(&clnt->cl_users));
+ dprintk("RPC: rpc_release_client(%p, %d)\n",
+ clnt, atomic_read(&clnt->cl_users));
if (!atomic_dec_and_test(&clnt->cl_users))
return;
@@ -660,9 +664,10 @@ call_start(struct rpc_task *task)
{
struct rpc_clnt *clnt = task->tk_client;
- dprintk("RPC: %4d call_start %s%d proc %d (%s)\n", task->tk_pid,
- clnt->cl_protname, clnt->cl_vers, task->tk_msg.rpc_proc->p_proc,
- (RPC_IS_ASYNC(task) ? "async" : "sync"));
+ dprintk("RPC: %5u call_start %s%d proc %d (%s)\n", task->tk_pid,
+ clnt->cl_protname, clnt->cl_vers,
+ task->tk_msg.rpc_proc->p_proc,
+ (RPC_IS_ASYNC(task) ? "async" : "sync"));
/* Increment call count */
task->tk_msg.rpc_proc->p_count++;
@@ -676,7 +681,7 @@ call_start(struct rpc_task *task)
static void
call_reserve(struct rpc_task *task)
{
- dprintk("RPC: %4d call_reserve\n", task->tk_pid);
+ dprint_status(task);
if (!rpcauth_uptodatecred(task)) {
task->tk_action = call_refresh;
@@ -696,8 +701,7 @@ call_reserveresult(struct rpc_task *task
{
int status = task->tk_status;
- dprintk("RPC: %4d call_reserveresult (status %d)\n",
- task->tk_pid, task->tk_status);
+ dprint_status(task);
/*
* After a call to xprt_reserve(), we must have either
@@ -751,8 +755,8 @@ call_allocate(struct rpc_task *task)
struct rpc_xprt *xprt = task->tk_xprt;
unsigned int bufsiz;
- dprintk("RPC: %4d call_allocate (status %d)\n",
- task->tk_pid, task->tk_status);
+ dprint_status(task);
+
task->tk_action = call_bind;
if (req->rq_buffer)
return;
@@ -763,7 +767,8 @@ call_allocate(struct rpc_task *task)
if (xprt->ops->buf_alloc(task, bufsiz << 1) != NULL)
return;
- printk(KERN_INFO "RPC: buffer allocation failed for task %p\n", task);
+
+ dprintk("RPC: %5u rpc_buffer allocation failed\n", task->tk_pid);
if (RPC_IS_ASYNC(task) || !signalled()) {
xprt_release(task);
@@ -800,8 +805,7 @@ call_encode(struct rpc_task *task)
kxdrproc_t encode;
__be32 *p;
- dprintk("RPC: %4d call_encode (status %d)\n",
- task->tk_pid, task->tk_status);
+ dprint_status(task);
/* Default buffer setup */
bufsiz = req->rq_bufsize >> 1;
@@ -847,8 +851,7 @@ call_bind(struct rpc_task *task)
{
struct rpc_xprt *xprt = task->tk_xprt;
- dprintk("RPC: %4d call_bind (status %d)\n",
- task->tk_pid, task->tk_status);
+ dprint_status(task);
task->tk_action = call_connect;
if (!xprt_bound(xprt)) {
@@ -867,8 +870,7 @@ call_bind_status(struct rpc_task *task)
int status = -EACCES;
if (task->tk_status >= 0) {
- dprintk("RPC: %4d call_bind_status (status %d)\n",
- task->tk_pid, task->tk_status);
+ dprint_status(task);
task->tk_status = 0;
task->tk_action = call_connect;
return;
@@ -876,24 +878,24 @@ call_bind_status(struct rpc_task *task)
switch (task->tk_status) {
case -EACCES:
- dprintk("RPC: %4d remote rpcbind: RPC program/version unavailable\n",
- task->tk_pid);
+ dprintk("RPC: %5u remote rpcbind: RPC program/version "
+ "unavailable\n", task->tk_pid);
rpc_delay(task, 3*HZ);
goto retry_timeout;
case -ETIMEDOUT:
- dprintk("RPC: %4d rpcbind request timed out\n",
+ dprintk("RPC: %5u rpcbind request timed out\n",
task->tk_pid);
goto retry_timeout;
case -EPFNOSUPPORT:
- dprintk("RPC: %4d remote rpcbind service unavailable\n",
+ dprintk("RPC: %5u remote rpcbind service unavailable\n",
task->tk_pid);
break;
case -EPROTONOSUPPORT:
- dprintk("RPC: %4d remote rpcbind version 2 unavailable\n",
+ dprintk("RPC: %5u remote rpcbind version 2 unavailable\n",
task->tk_pid);
break;
default:
- dprintk("RPC: %4d unrecognized rpcbind error (%d)\n",
+ dprintk("RPC: %5u unrecognized rpcbind error (%d)\n",
task->tk_pid, -task->tk_status);
status = -EIO;
}
@@ -913,7 +915,7 @@ call_connect(struct rpc_task *task)
{
struct rpc_xprt *xprt = task->tk_xprt;
- dprintk("RPC: %4d call_connect xprt %p %s connected\n",
+ dprintk("RPC: %5u call_connect xprt %p %s connected\n",
task->tk_pid, xprt,
(xprt_connected(xprt) ? "is" : "is not"));
@@ -935,8 +937,7 @@ call_connect_status(struct rpc_task *tas
struct rpc_clnt *clnt = task->tk_client;
int status = task->tk_status;
- dprintk("RPC: %5u call_connect_status (status %d)\n",
- task->tk_pid, task->tk_status);
+ dprint_status(task);
task->tk_status = 0;
if (status >= 0) {
@@ -968,8 +969,7 @@ call_connect_status(struct rpc_task *tas
static void
call_transmit(struct rpc_task *task)
{
- dprintk("RPC: %4d call_transmit (status %d)\n",
- task->tk_pid, task->tk_status);
+ dprint_status(task);
task->tk_action = call_status;
if (task->tk_status < 0)
@@ -1030,8 +1030,7 @@ call_status(struct rpc_task *task)
if (req->rq_received > 0 && !req->rq_bytes_sent)
task->tk_status = req->rq_received;
- dprintk("RPC: %4d call_status (status %d)\n",
- task->tk_pid, task->tk_status);
+ dprint_status(task);
status = task->tk_status;
if (status >= 0) {
@@ -1082,11 +1081,11 @@ call_timeout(struct rpc_task *task)
struct rpc_clnt *clnt = task->tk_client;
if (xprt_adjust_timeout(task->tk_rqstp) == 0) {
- dprintk("RPC: %4d call_timeout (minor)\n", task->tk_pid);
+ dprintk("RPC: %5u call_timeout (minor)\n", task->tk_pid);
goto retry;
}
- dprintk("RPC: %4d call_timeout (major)\n", task->tk_pid);
+ dprintk("RPC: %5u call_timeout (major)\n", task->tk_pid);
task->tk_timeouts++;
if (RPC_IS_SOFT(task)) {
@@ -1120,8 +1119,8 @@ call_decode(struct rpc_task *task)
kxdrproc_t decode = task->tk_msg.rpc_proc->p_decode;
__be32 *p;
- dprintk("RPC: %4d call_decode (status %d)\n",
- task->tk_pid, task->tk_status);
+ dprintk("RPC: %5u call_decode (status %d)\n",
+ task->tk_pid, task->tk_status);
if (task->tk_flags & RPC_CALL_MAJORSEEN) {
printk(KERN_NOTICE "%s: server %s OK\n",
@@ -1135,8 +1134,8 @@ call_decode(struct rpc_task *task)
clnt->cl_stats->rpcretrans++;
goto out_retry;
}
- dprintk("%s: too small RPC reply size (%d bytes)\n",
- clnt->cl_protname, task->tk_status);
+ dprintk("RPC: %s: too small RPC reply size (%d bytes)\n",
+ clnt->cl_protname, task->tk_status);
task->tk_action = call_timeout;
goto out_retry;
}
@@ -1168,8 +1167,8 @@ call_decode(struct rpc_task *task)
task->tk_msg.rpc_resp);
unlock_kernel();
}
- dprintk("RPC: %4d call_decode result %d\n", task->tk_pid,
- task->tk_status);
+ dprintk("RPC: %5u call_decode result %d\n", task->tk_pid,
+ task->tk_status);
return;
out_retry:
req->rq_received = req->rq_private_buf.len = 0;
@@ -1182,7 +1181,7 @@ out_retry:
static void
call_refresh(struct rpc_task *task)
{
- dprintk("RPC: %4d call_refresh\n", task->tk_pid);
+ dprint_status(task);
xprt_release(task); /* Must do to obtain new XID */
task->tk_action = call_refreshresult;
@@ -1198,8 +1197,8 @@ static void
call_refreshresult(struct rpc_task *task)
{
int status = task->tk_status;
- dprintk("RPC: %4d call_refreshresult (status %d)\n",
- task->tk_pid, task->tk_status);
+
+ dprint_status(task);
task->tk_status = 0;
task->tk_action = call_reserve;
@@ -1277,11 +1276,15 @@ call_verify(struct rpc_task *task)
case RPC_AUTH_ERROR:
break;
case RPC_MISMATCH:
- dprintk("%s: RPC call version mismatch!\n", __FUNCTION__);
+ dprintk("RPC: %5u %s: RPC call version "
+ "mismatch!\n",
+ task->tk_pid, __FUNCTION__);
error = -EPROTONOSUPPORT;
goto out_err;
default:
- dprintk("%s: RPC call rejected, unknown error: %x\n", __FUNCTION__, n);
+ dprintk("RPC: %5u %s: RPC call rejected, "
+ "unknown error: %x\n",
+ task->tk_pid, __FUNCTION__, n);
goto out_eio;
}
if (--len < 0)
@@ -1294,8 +1297,8 @@ call_verify(struct rpc_task *task)
if (!task->tk_cred_retry)
break;
task->tk_cred_retry--;
- dprintk("RPC: %4d call_verify: retry stale creds\n",
- task->tk_pid);
+ dprintk("RPC: %5u %s: retry stale creds\n",
+ task->tk_pid, __FUNCTION__);
rpcauth_invalcred(task);
task->tk_action = call_refresh;
goto out_retry;
@@ -1305,8 +1308,8 @@ call_verify(struct rpc_task *task)
if (!task->tk_garb_retry)
break;
task->tk_garb_retry--;
- dprintk("RPC: %4d call_verify: retry garbled creds\n",
- task->tk_pid);
+ dprintk("RPC: %5u %s: retry garbled creds\n",
+ task->tk_pid, __FUNCTION__);
task->tk_action = call_bind;
goto out_retry;
case RPC_AUTH_TOOWEAK:
@@ -1317,8 +1320,8 @@ call_verify(struct rpc_task *task)
printk(KERN_WARNING "call_verify: unknown auth error: %x\n", n);
error = -EIO;
}
- dprintk("RPC: %4d call_verify: call rejected %d\n",
- task->tk_pid, n);
+ dprintk("RPC: %5u %s: call rejected %d\n",
+ task->tk_pid, __FUNCTION__, n);
goto out_err;
}
if (!(p = rpcauth_checkverf(task, p))) {
@@ -1332,20 +1335,24 @@ call_verify(struct rpc_task *task)
case RPC_SUCCESS:
return p;
case RPC_PROG_UNAVAIL:
- dprintk("RPC: call_verify: program %u is unsupported by server %s\n",
+ dprintk("RPC: %5u %s: program %u is unsupported by server %s\n",
+ task->tk_pid, __FUNCTION__,
(unsigned int)task->tk_client->cl_prog,
task->tk_client->cl_server);
error = -EPFNOSUPPORT;
goto out_err;
case RPC_PROG_MISMATCH:
- dprintk("RPC: call_verify: program %u, version %u unsupported by server %s\n",
+ dprintk("RPC: %5u %s: program %u, version %u unsupported by "
+ "server %s\n", task->tk_pid, __FUNCTION__,
(unsigned int)task->tk_client->cl_prog,
(unsigned int)task->tk_client->cl_vers,
task->tk_client->cl_server);
error = -EPROTONOSUPPORT;
goto out_err;
case RPC_PROC_UNAVAIL:
- dprintk("RPC: call_verify: proc %p unsupported by program %u, version %u on server %s\n",
+ dprintk("RPC: %5u %s: proc %p unsupported by program %u, "
+ "version %u on server %s\n",
+ task->tk_pid, __FUNCTION__,
task->tk_msg.rpc_proc,
task->tk_client->cl_prog,
task->tk_client->cl_vers,
@@ -1353,7 +1360,8 @@ call_verify(struct rpc_task *task)
error = -EOPNOTSUPP;
goto out_err;
case RPC_GARBAGE_ARGS:
- dprintk("RPC: %4d %s: server saw garbage\n", task->tk_pid, __FUNCTION__);
+ dprintk("RPC: %5u %s: server saw garbage\n",
+ task->tk_pid, __FUNCTION__);
break; /* retry */
default:
printk(KERN_WARNING "call_verify: server accept status: %x\n", n);
@@ -1364,7 +1372,8 @@ out_garbage:
task->tk_client->cl_stats->rpcgarbage++;
if (task->tk_garb_retry) {
task->tk_garb_retry--;
- dprintk("RPC %s: retrying %4d\n", __FUNCTION__, task->tk_pid);
+ dprintk("RPC: %5u %s: retrying\n",
+ task->tk_pid, __FUNCTION__);
task->tk_action = call_bind;
out_retry:
return ERR_PTR(-EAGAIN);
diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c
index 3946ec3..8d9e780 100644
--- a/net/sunrpc/pmap_clnt.c
+++ b/net/sunrpc/pmap_clnt.c
@@ -94,7 +94,7 @@ void rpc_getport(struct rpc_task *task)
struct rpc_task *child;
int status;
- dprintk("RPC: %4d rpc_getport(%s, %u, %u, %d)\n",
+ dprintk("RPC: %5u rpc_getport(%s, %u, %u, %d)\n",
task->tk_pid, clnt->cl_server,
clnt->cl_prog, clnt->cl_vers, xprt->prot);
@@ -175,7 +175,7 @@ int rpc_getport_external(struct sockaddr
char hostname[32];
int status;
- dprintk("RPC: rpc_getport_external(%u.%u.%u.%u, %u, %u, %d)\n",
+ dprintk("RPC: rpc_getport_external(%u.%u.%u.%u, %u, %u, %d)\n",
NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);
sprintf(hostname, "%u.%u.%u.%u", NIPQUAD(sin->sin_addr.s_addr));
@@ -218,7 +218,7 @@ static void pmap_getport_done(struct rpc
status = 0;
}
- dprintk("RPC: %4d pmap_getport_done(status %d, port %u)\n",
+ dprintk("RPC: %5u pmap_getport_done(status %d, port %u)\n",
child->tk_pid, status, map->pm_port);
pmap_wake_portmap_waiters(xprt, status);
@@ -255,13 +255,14 @@ int rpc_register(u32 prog, u32 vers, int
struct rpc_clnt *pmap_clnt;
int error = 0;
- dprintk("RPC: registering (%u, %u, %d, %u) with portmapper.\n",
+ dprintk("RPC: registering (%u, %u, %d, %u) with portmapper.\n",
prog, vers, prot, port);
pmap_clnt = pmap_create("localhost", &sin, IPPROTO_UDP, 1);
if (IS_ERR(pmap_clnt)) {
error = PTR_ERR(pmap_clnt);
- dprintk("RPC: couldn't create pmap client. Error = %d\n", error);
+ dprintk("RPC: couldn't create pmap client. Error = %d\n",
+ error);
return error;
}
@@ -272,7 +273,7 @@ int rpc_register(u32 prog, u32 vers, int
"RPC: failed to contact portmap (errno %d).\n",
error);
}
- dprintk("RPC: registration status %d/%d\n", error, *okay);
+ dprintk("RPC: registration status %d/%d\n", error, *okay);
/* Client deleted automatically because cl_oneshot == 1 */
return error;
@@ -303,8 +304,9 @@ static struct rpc_clnt *pmap_create(char
*/
static int xdr_encode_mapping(struct rpc_rqst *req, __be32 *p, struct portmap_args *map)
{
- dprintk("RPC: xdr_encode_mapping(%u, %u, %u, %u)\n",
- map->pm_prog, map->pm_vers, map->pm_prot, map->pm_port);
+ dprintk("RPC: xdr_encode_mapping(%u, %u, %u, %u)\n",
+ map->pm_prog, map->pm_vers,
+ map->pm_prot, map->pm_port);
*p++ = htonl(map->pm_prog);
*p++ = htonl(map->pm_vers);
*p++ = htonl(map->pm_prot);
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 79bc4cd..cb0c5f4 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -73,7 +73,7 @@ static DEFINE_SPINLOCK(rpc_sched_lock);
static inline void
__rpc_disable_timer(struct rpc_task *task)
{
- dprintk("RPC: %4d disabling timer\n", task->tk_pid);
+ dprintk("RPC: %5u disabling timer\n", task->tk_pid);
task->tk_timeout_fn = NULL;
task->tk_timeout = 0;
}
@@ -92,7 +92,7 @@ static void rpc_run_timer(struct rpc_tas
callback = task->tk_timeout_fn;
task->tk_timeout_fn = NULL;
if (callback && RPC_IS_QUEUED(task)) {
- dprintk("RPC: %4d running timer\n", task->tk_pid);
+ dprintk("RPC: %5u running timer\n", task->tk_pid);
callback(task);
}
smp_mb__before_clear_bit();
@@ -109,7 +109,7 @@ __rpc_add_timer(struct rpc_task *task, r
if (!task->tk_timeout)
return;
- dprintk("RPC: %4d setting alarm for %lu ms\n",
+ dprintk("RPC: %5u setting alarm for %lu ms\n",
task->tk_pid, task->tk_timeout * 1000 / HZ);
if (timer)
@@ -131,7 +131,7 @@ rpc_delete_timer(struct rpc_task *task)
return;
if (test_and_clear_bit(RPC_TASK_HAS_TIMER, &task->tk_runstate)) {
del_singleshot_timer_sync(&task->tk_timer);
- dprintk("RPC: %4d deleting timer\n", task->tk_pid);
+ dprintk("RPC: %5u deleting timer\n", task->tk_pid);
}
}
@@ -178,8 +178,8 @@ static void __rpc_add_wait_queue(struct
queue->qlen++;
rpc_set_queued(task);
- dprintk("RPC: %4d added to queue %p \"%s\"\n",
- task->tk_pid, queue, rpc_qname(queue));
+ dprintk("RPC: %5u added to queue %p \"%s\"\n",
+ task->tk_pid, queue, rpc_qname(queue));
}
/*
@@ -211,8 +211,8 @@ static void __rpc_remove_wait_queue(stru
else
list_del(&task->u.tk_wait.list);
queue->qlen--;
- dprintk("RPC: %4d removed from queue %p \"%s\"\n",
- task->tk_pid, queue, rpc_qname(queue));
+ dprintk("RPC: %5u removed from queue %p \"%s\"\n",
+ task->tk_pid, queue, rpc_qname(queue));
}
static inline void rpc_set_waitqueue_priority(struct rpc_wait_queue *queue, int priority)
@@ -343,8 +343,8 @@ static void rpc_make_runnable(struct rpc
static void __rpc_sleep_on(struct rpc_wait_queue *q, struct rpc_task *task,
rpc_action action, rpc_action timer)
{
- dprintk("RPC: %4d sleep_on(queue \"%s\" time %ld)\n", task->tk_pid,
- rpc_qname(q), jiffies);
+ dprintk("RPC: %5u sleep_on(queue \"%s\" time %lu)\n",
+ task->tk_pid, rpc_qname(q), jiffies);
if (!RPC_IS_ASYNC(task) && !RPC_IS_ACTIVATED(task)) {
printk(KERN_ERR "RPC: Inactive synchronous task put to sleep!\n");
@@ -380,7 +380,8 @@ void rpc_sleep_on(struct rpc_wait_queue
*/
static void __rpc_do_wake_up_task(struct rpc_task *task)
{
- dprintk("RPC: %4d __rpc_wake_up_task (now %ld)\n", task->tk_pid, jiffies);
+ dprintk("RPC: %5u __rpc_wake_up_task (now %lu)\n",
+ task->tk_pid, jiffies);
#ifdef RPC_DEBUG
BUG_ON(task->tk_magic != RPC_TASK_MAGIC_ID);
@@ -396,7 +397,7 @@ #endif
rpc_make_runnable(task);
- dprintk("RPC: __rpc_wake_up_task done\n");
+ dprintk("RPC: __rpc_wake_up_task done\n");
}
/*
@@ -417,7 +418,7 @@ static void __rpc_wake_up_task(struct rp
static void
__rpc_default_timer(struct rpc_task *task)
{
- dprintk("RPC: %d timeout (default timer)\n", task->tk_pid);
+ dprintk("RPC: %5u timeout (default timer)\n", task->tk_pid);
task->tk_status = -ETIMEDOUT;
rpc_wake_up_task(task);
}
@@ -501,7 +502,8 @@ struct rpc_task * rpc_wake_up_next(struc
{
struct rpc_task *task = NULL;
- dprintk("RPC: wake_up_next(%p \"%s\")\n", queue, rpc_qname(queue));
+ dprintk("RPC: wake_up_next(%p \"%s\")\n",
+ queue, rpc_qname(queue));
rcu_read_lock_bh();
spin_lock(&queue->lock);
if (RPC_IS_PRIORITY(queue))
@@ -628,8 +630,8 @@ static int __rpc_execute(struct rpc_task
{
int status = 0;
- dprintk("RPC: %4d rpc_execute flgs %x\n",
- task->tk_pid, task->tk_flags);
+ dprintk("RPC: %5u __rpc_execute flags=0x%x\n",
+ task->tk_pid, task->tk_flags);
BUG_ON(RPC_IS_QUEUED(task));
@@ -685,7 +687,7 @@ static int __rpc_execute(struct rpc_task
}
/* sync task: sleep here */
- dprintk("RPC: %4d sync task going to sleep\n", task->tk_pid);
+ dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid);
/* Note: Caller should be using rpc_clnt_sigmask() */
status = out_of_line_wait_on_bit(&task->tk_runstate,
RPC_TASK_QUEUED, rpc_wait_bit_interruptible,
@@ -697,16 +699,17 @@ static int __rpc_execute(struct rpc_task
* clean up after sleeping on some queue, we don't
* break the loop here, but go around once more.
*/
- dprintk("RPC: %4d got signal\n", task->tk_pid);
+ dprintk("RPC: %5u got signal\n", task->tk_pid);
task->tk_flags |= RPC_TASK_KILLED;
rpc_exit(task, -ERESTARTSYS);
rpc_wake_up_task(task);
}
rpc_set_running(task);
- dprintk("RPC: %4d sync task resuming\n", task->tk_pid);
+ dprintk("RPC: %5u sync task resuming\n", task->tk_pid);
}
- dprintk("RPC: %4d, return %d, status %d\n", task->tk_pid, status, task->tk_status);
+ dprintk("RPC: %5u return %d, status %d\n", task->tk_pid, status,
+ task->tk_status);
/* Release all resources associated with the task */
rpc_release_task(task);
return status;
@@ -825,7 +828,7 @@ void rpc_init_task(struct rpc_task *task
/* starting timestamp */
task->tk_start = jiffies;
- dprintk("RPC: %4d new task procpid %d\n", task->tk_pid,
+ dprintk("RPC: new task initialized, procpid %u\n",
current->pid);
}
@@ -838,7 +841,7 @@ rpc_alloc_task(void)
static void rpc_free_task(struct rcu_head *rcu)
{
struct rpc_task *task = container_of(rcu, struct rpc_task, u.tk_rcu);
- dprintk("RPC: %4d freeing task\n", task->tk_pid);
+ dprintk("RPC: %5u freeing task\n", task->tk_pid);
mempool_free(task, rpc_task_mempool);
}
@@ -857,7 +860,7 @@ struct rpc_task *rpc_new_task(struct rpc
rpc_init_task(task, clnt, flags, tk_ops, calldata);
- dprintk("RPC: %4d allocated task\n", task->tk_pid);
+ dprintk("RPC: allocated task %p\n", task);
task->tk_flags |= RPC_TASK_DYNAMIC;
out:
return task;
@@ -901,7 +904,7 @@ void rpc_release_task(struct rpc_task *t
#ifdef RPC_DEBUG
BUG_ON(task->tk_magic != RPC_TASK_MAGIC_ID);
#endif
- dprintk("RPC: %4d release task\n", task->tk_pid);
+ dprintk("RPC: %5u release task\n", task->tk_pid);
/* Remove from global task list */
spin_lock(&rpc_sched_lock);
@@ -954,7 +957,7 @@ void rpc_killall_tasks(struct rpc_clnt *
struct rpc_task *rovr;
struct list_head *le;
- dprintk("RPC: killing all tasks for client %p\n", clnt);
+ dprintk("RPC: killing all tasks for client %p\n", clnt);
/*
* Spin lock all_tasks to prevent changes...
@@ -983,7 +986,8 @@ static void rpciod_killall(void)
rpc_killall_tasks(NULL);
flush_workqueue(rpciod_workqueue);
if (!list_empty(&all_tasks)) {
- dprintk("rpciod_killall: waiting for tasks to exit\n");
+ dprintk("RPC: rpciod_killall: waiting for tasks "
+ "to exit\n");
yield();
}
}
@@ -1003,7 +1007,7 @@ rpciod_up(void)
int error = 0;
mutex_lock(&rpciod_mutex);
- dprintk("rpciod_up: users %d\n", rpciod_users);
+ dprintk("RPC: rpciod_up: users %u\n", rpciod_users);
rpciod_users++;
if (rpciod_workqueue)
goto out;
@@ -1011,7 +1015,7 @@ rpciod_up(void)
* If there's no pid, we should be the first user.
*/
if (rpciod_users > 1)
- printk(KERN_WARNING "rpciod_up: no workqueue, %d users??\n", rpciod_users);
+ printk(KERN_WARNING "rpciod_up: no workqueue, %u users??\n", rpciod_users);
/*
* Create the rpciod thread and wait for it to start.
*/
@@ -1033,7 +1037,7 @@ void
rpciod_down(void)
{
mutex_lock(&rpciod_mutex);
- dprintk("rpciod_down sema %d\n", rpciod_users);
+ dprintk("RPC: rpciod_down sema %u\n", rpciod_users);
if (rpciod_users) {
if (--rpciod_users)
goto out;
@@ -1041,7 +1045,7 @@ rpciod_down(void)
printk(KERN_WARNING "rpciod_down: no users??\n");
if (!rpciod_workqueue) {
- dprintk("rpciod_down: Nothing to do!\n");
+ dprintk("RPC: rpciod_down: Nothing to do!\n");
goto out;
}
rpciod_killall();
@@ -1071,7 +1075,7 @@ void rpc_show_tasks(void)
if (RPC_IS_QUEUED(t))
rpc_waitq = rpc_qname(t->u.tk_wait.rpc_waitq);
- printk("%05d %04d %04x %06d %8p %6d %8p %08ld %8s %8p %8p\n",
+ printk("%5u %04d %04x %6d %8p %6d %8p %8ld %8s %8p %8p\n",
t->tk_pid,
(t->tk_msg.rpc_proc ? t->tk_msg.rpc_proc->p_proc : -1),
t->tk_flags, t->tk_status,
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index bd98124..d19cd9e 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -226,7 +226,7 @@ do_register(const char *name, void *data
struct proc_dir_entry *ent;
rpc_proc_init();
- dprintk("RPC: registering /proc/net/rpc/%s\n", name);
+ dprintk("RPC: registering /proc/net/rpc/%s\n", name);
ent = create_proc_entry(name, 0, proc_net_rpc);
if (ent) {
@@ -263,7 +263,7 @@ svc_proc_unregister(const char *name)
void
rpc_proc_init(void)
{
- dprintk("RPC: registering /proc/net/rpc\n");
+ dprintk("RPC: registering /proc/net/rpc\n");
if (!proc_net_rpc) {
struct proc_dir_entry *ent;
ent = proc_mkdir("rpc", proc_net);
@@ -277,7 +277,7 @@ rpc_proc_init(void)
void
rpc_proc_exit(void)
{
- dprintk("RPC: unregistering /proc/net/rpc\n");
+ dprintk("RPC: unregistering /proc/net/rpc\n");
if (proc_net_rpc) {
proc_net_rpc = NULL;
remove_proc_entry("net/rpc", NULL);
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index f3001f3..6627759 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -318,7 +318,7 @@ __svc_create(struct svc_program *prog, u
for (i = 0; i < serv->sv_nrpools; i++) {
struct svc_pool *pool = &serv->sv_pools[i];
- dprintk("initialising pool %u for %s\n",
+ dprintk("svc: initialising pool %u for %s\n",
i, serv->sv_name);
pool->sp_id = i;
@@ -369,7 +369,7 @@ svc_destroy(struct svc_serv *serv)
{
struct svc_sock *svsk;
- dprintk("RPC: svc_destroy(%s, %d)\n",
+ dprintk("svc: svc_destroy(%s, %d)\n",
serv->sv_program->pg_name,
serv->sv_nrthreads);
@@ -655,7 +655,7 @@ svc_register(struct svc_serv *serv, int
if (progp->pg_vers[i] == NULL)
continue;
- dprintk("RPC: svc_register(%s, %s, %d, %d)%s\n",
+ dprintk("svc: svc_register(%s, %s, %d, %d)%s\n",
progp->pg_name,
proto == IPPROTO_UDP? "udp" : "tcp",
port,
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 7a3999f..cf59f7d 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -108,7 +108,7 @@ int xprt_reserve_xprt(struct rpc_task *t
return 1;
out_sleep:
- dprintk("RPC: %4d failed to lock transport %p\n",
+ dprintk("RPC: %5u failed to lock transport %p\n",
task->tk_pid, xprt);
task->tk_timeout = 0;
task->tk_status = -EAGAIN;
@@ -158,7 +158,7 @@ int xprt_reserve_xprt_cong(struct rpc_ta
}
xprt_clear_locked(xprt);
out_sleep:
- dprintk("RPC: %4d failed to lock transport %p\n", task->tk_pid, xprt);
+ dprintk("RPC: %5u failed to lock transport %p\n", task->tk_pid, xprt);
task->tk_timeout = 0;
task->tk_status = -EAGAIN;
if (req && req->rq_ntrans)
@@ -281,7 +281,7 @@ __xprt_get_cong(struct rpc_xprt *xprt, s
if (req->rq_cong)
return 1;
- dprintk("RPC: %4d xprt_cwnd_limited cong = %ld cwnd = %ld\n",
+ dprintk("RPC: %5u xprt_cwnd_limited cong = %lu cwnd = %lu\n",
task->tk_pid, xprt->cong, xprt->cwnd);
if (RPCXPRT_CONGESTED(xprt))
return 0;
@@ -340,7 +340,7 @@ void xprt_adjust_cwnd(struct rpc_task *t
if (cwnd < RPC_CWNDSCALE)
cwnd = RPC_CWNDSCALE;
}
- dprintk("RPC: cong %ld, cwnd was %ld, now %ld\n",
+ dprintk("RPC: cong %ld, cwnd was %ld, now %ld\n",
xprt->cong, xprt->cwnd, cwnd);
xprt->cwnd = cwnd;
__xprt_put_cong(xprt, req);
@@ -387,8 +387,8 @@ void xprt_write_space(struct rpc_xprt *x
spin_lock_bh(&xprt->transport_lock);
if (xprt->snd_task) {
- dprintk("RPC: write space: waking waiting task on xprt %p\n",
- xprt);
+ dprintk("RPC: write space: waking waiting task on "
+ "xprt %p\n", xprt);
rpc_wake_up_task(xprt->snd_task);
}
spin_unlock_bh(&xprt->transport_lock);
@@ -494,7 +494,7 @@ static void xprt_autoclose(struct work_s
*/
void xprt_disconnect(struct rpc_xprt *xprt)
{
- dprintk("RPC: disconnected transport %p\n", xprt);
+ dprintk("RPC: disconnected transport %p\n", xprt);
spin_lock_bh(&xprt->transport_lock);
xprt_clear_connected(xprt);
xprt_wake_pending_tasks(xprt, -ENOTCONN);
@@ -530,7 +530,7 @@ void xprt_connect(struct rpc_task *task)
{
struct rpc_xprt *xprt = task->tk_xprt;
- dprintk("RPC: %4d xprt_connect xprt %p %s connected\n", task->tk_pid,
+ dprintk("RPC: %5u xprt_connect xprt %p %s connected\n", task->tk_pid,
xprt, (xprt_connected(xprt) ? "is" : "is not"));
if (!xprt_bound(xprt)) {
@@ -560,7 +560,7 @@ static void xprt_connect_status(struct r
if (task->tk_status >= 0) {
xprt->stat.connect_count++;
xprt->stat.connect_time += (long)jiffies - xprt->stat.connect_start;
- dprintk("RPC: %4d xprt_connect_status: connection established\n",
+ dprintk("RPC: %5u xprt_connect_status: connection established\n",
task->tk_pid);
return;
}
@@ -568,20 +568,22 @@ static void xprt_connect_status(struct r
switch (task->tk_status) {
case -ECONNREFUSED:
case -ECONNRESET:
- dprintk("RPC: %4d xprt_connect_status: server %s refused connection\n",
- task->tk_pid, task->tk_client->cl_server);
+ dprintk("RPC: %5u xprt_connect_status: server %s refused "
+ "connection\n", task->tk_pid,
+ task->tk_client->cl_server);
break;
case -ENOTCONN:
- dprintk("RPC: %4d xprt_connect_status: connection broken\n",
+ dprintk("RPC: %5u xprt_connect_status: connection broken\n",
task->tk_pid);
break;
case -ETIMEDOUT:
- dprintk("RPC: %4d xprt_connect_status: connect attempt timed out\n",
- task->tk_pid);
+ dprintk("RPC: %5u xprt_connect_status: connect attempt timed "
+ "out\n", task->tk_pid);
break;
default:
- dprintk("RPC: %4d xprt_connect_status: error %d connecting to server %s\n",
- task->tk_pid, -task->tk_status, task->tk_client->cl_server);
+ dprintk("RPC: %5u xprt_connect_status: error %d connecting to "
+ "server %s\n", task->tk_pid, -task->tk_status,
+ task->tk_client->cl_server);
xprt_release_write(xprt, task);
task->tk_status = -EIO;
}
@@ -602,6 +604,9 @@ struct rpc_rqst *xprt_lookup_rqst(struct
if (entry->rq_xid == xid)
return entry;
}
+
+ dprintk("RPC: xprt_lookup_rqst did not find xid %08x\n",
+ ntohl(xid));
xprt->stat.bad_xids++;
return NULL;
}
@@ -654,7 +659,7 @@ static void xprt_timer(struct rpc_task *
struct rpc_rqst *req = task->tk_rqstp;
struct rpc_xprt *xprt = req->rq_xprt;
- dprintk("RPC: %4d xprt_timer\n", task->tk_pid);
+ dprintk("RPC: %5u xprt_timer\n", task->tk_pid);
spin_lock(&xprt->transport_lock);
if (!req->rq_received) {
@@ -678,7 +683,7 @@ int xprt_prepare_transmit(struct rpc_tas
struct rpc_xprt *xprt = req->rq_xprt;
int err = 0;
- dprintk("RPC: %4d xprt_prepare_transmit\n", task->tk_pid);
+ dprintk("RPC: %5u xprt_prepare_transmit\n", task->tk_pid);
spin_lock_bh(&xprt->transport_lock);
if (req->rq_received && !req->rq_bytes_sent) {
@@ -716,7 +721,7 @@ void xprt_transmit(struct rpc_task *task
struct rpc_xprt *xprt = req->rq_xprt;
int status;
- dprintk("RPC: %4d xprt_transmit(%u)\n", task->tk_pid, req->rq_slen);
+ dprintk("RPC: %5u xprt_transmit(%u)\n", task->tk_pid, req->rq_slen);
if (!req->rq_received) {
if (list_empty(&req->rq_list)) {
@@ -736,7 +741,7 @@ void xprt_transmit(struct rpc_task *task
status = xprt->ops->send_request(task);
if (status == 0) {
- dprintk("RPC: %4d xmit complete\n", task->tk_pid);
+ dprintk("RPC: %5u xmit complete\n", task->tk_pid);
spin_lock_bh(&xprt->transport_lock);
xprt->ops->set_retrans_timeout(task);
@@ -777,7 +782,7 @@ static inline void do_xprt_reserve(struc
xprt_request_init(task, xprt);
return;
}
- dprintk("RPC: waiting for request slot\n");
+ dprintk("RPC: waiting for request slot\n");
task->tk_status = -EAGAIN;
task->tk_timeout = 0;
rpc_sleep_on(&xprt->backlog, task, NULL, NULL);
@@ -822,7 +827,7 @@ static void xprt_request_init(struct rpc
req->rq_xid = xprt_alloc_xid(xprt);
req->rq_release_snd_buf = NULL;
xprt_reset_majortimeo(req);
- dprintk("RPC: %4d reserved req %p xid %08x\n", task->tk_pid,
+ dprintk("RPC: %5u reserved req %p xid %08x\n", task->tk_pid,
req, ntohl(req->rq_xid));
}
@@ -856,7 +861,7 @@ void xprt_release(struct rpc_task *task)
req->rq_release_snd_buf(req);
memset(req, 0, sizeof(*req)); /* mark unused */
- dprintk("RPC: %4d release request %p\n", task->tk_pid, req);
+ dprintk("RPC: %5u release request %p\n", task->tk_pid, req);
spin_lock(&xprt->reserve_lock);
list_add(&req->rq_list, &xprt->free);
@@ -906,7 +911,7 @@ struct rpc_xprt *xprt_create_transport(i
return ERR_PTR(-EIO);
}
if (IS_ERR(xprt)) {
- dprintk("RPC: xprt_create_transport: failed, %ld\n",
+ dprintk("RPC: xprt_create_transport: failed, %ld\n",
-PTR_ERR(xprt));
return xprt;
}
@@ -936,7 +941,7 @@ struct rpc_xprt *xprt_create_transport(i
xprt_init_xid(xprt);
- dprintk("RPC: created transport %p with %u slots\n", xprt,
+ dprintk("RPC: created transport %p with %u slots\n", xprt,
xprt->max_reqs);
return xprt;
@@ -951,7 +956,7 @@ static void xprt_destroy(struct kref *kr
{
struct rpc_xprt *xprt = container_of(kref, struct rpc_xprt, kref);
- dprintk("RPC: destroying transport %p\n", xprt);
+ dprintk("RPC: destroying transport %p\n", xprt);
xprt->shutdown = 1;
del_timer_sync(&xprt->timer);
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 49cabff..64736b3 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -192,7 +192,7 @@ static void xs_pktdump(char *msg, u32 *p
u8 *buf = (u8 *) packet;
int j;
- dprintk("RPC: %s\n", msg);
+ dprintk("RPC: %s\n", msg);
for (j = 0; j < count && j < 128; j += 4) {
if (!(j & 31)) {
if (j)
@@ -418,7 +418,7 @@ static void xs_nospace(struct rpc_task *
struct rpc_xprt *xprt = req->rq_xprt;
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
- dprintk("RPC: %4d xmit incomplete (%u left of %u)\n",
+ dprintk("RPC: %5u xmit incomplete (%u left of %u)\n",
task->tk_pid, req->rq_slen - req->rq_bytes_sent,
req->rq_slen);
@@ -467,7 +467,7 @@ static int xs_udp_send_request(struct rp
xprt->addrlen, xdr,
req->rq_bytes_sent);
- dprintk("RPC: xs_udp_send_request(%u) = %d\n",
+ dprintk("RPC: xs_udp_send_request(%u) = %d\n",
xdr->len - req->rq_bytes_sent, status);
if (likely(status >= (int) req->rq_slen))
@@ -488,7 +488,7 @@ static int xs_udp_send_request(struct rp
xs_nospace(task);
break;
default:
- dprintk("RPC: sendmsg returned unrecognized error %d\n",
+ dprintk("RPC: sendmsg returned unrecognized error %d\n",
-status);
break;
}
@@ -539,7 +539,7 @@ static int xs_tcp_send_request(struct rp
status = xs_sendpages(transport->sock,
NULL, 0, xdr, req->rq_bytes_sent);
- dprintk("RPC: xs_tcp_send_request(%u) = %d\n",
+ dprintk("RPC: xs_tcp_send_request(%u) = %d\n",
xdr->len - req->rq_bytes_sent, status);
if (unlikely(status < 0))
@@ -570,7 +570,7 @@ static int xs_tcp_send_request(struct rp
status = -ENOTCONN;
break;
default:
- dprintk("RPC: sendmsg returned unrecognized error %d\n",
+ dprintk("RPC: sendmsg returned unrecognized error %d\n",
-status);
xprt_disconnect(xprt);
break;
@@ -622,7 +622,7 @@ static void xs_close(struct rpc_xprt *xp
if (!sk)
goto clear_close_wait;
- dprintk("RPC: xs_close xprt %p\n", xprt);
+ dprintk("RPC: xs_close xprt %p\n", xprt);
write_lock_bh(&sk->sk_callback_lock);
transport->inet = NULL;
@@ -652,7 +652,7 @@ static void xs_destroy(struct rpc_xprt *
{
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
- dprintk("RPC: xs_destroy xprt %p\n", xprt);
+ dprintk("RPC: xs_destroy xprt %p\n", xprt);
cancel_delayed_work(&transport->connect_worker);
flush_scheduled_work();
@@ -686,7 +686,7 @@ static void xs_udp_data_ready(struct soc
__be32 *xp;
read_lock(&sk->sk_callback_lock);
- dprintk("RPC: xs_udp_data_ready...\n");
+ dprintk("RPC: xs_udp_data_ready...\n");
if (!(xprt = xprt_from_sock(sk)))
goto out;
@@ -698,7 +698,7 @@ static void xs_udp_data_ready(struct soc
repsize = skb->len - sizeof(struct udphdr);
if (repsize < 4) {
- dprintk("RPC: impossible RPC reply size %d!\n", repsize);
+ dprintk("RPC: impossible RPC reply size %d!\n", repsize);
goto dropit;
}
@@ -762,11 +762,11 @@ static inline void xs_tcp_read_fraghdr(s
/* Sanity check of the record length */
if (unlikely(transport->tcp_reclen < 4)) {
- dprintk("RPC: invalid TCP record fragment length\n");
+ dprintk("RPC: invalid TCP record fragment length\n");
xprt_disconnect(xprt);
return;
}
- dprintk("RPC: reading TCP record fragment of length %d\n",
+ dprintk("RPC: reading TCP record fragment of length %d\n",
transport->tcp_reclen);
}
@@ -789,7 +789,7 @@ static inline void xs_tcp_read_xid(struc
char *p;
len = sizeof(transport->tcp_xid) - transport->tcp_offset;
- dprintk("RPC: reading XID (%Zu bytes)\n", len);
+ dprintk("RPC: reading XID (%Zu bytes)\n", len);
p = ((char *) &transport->tcp_xid) + transport->tcp_offset;
used = xdr_skb_read_bits(desc, p, len);
transport->tcp_offset += used;
@@ -798,7 +798,7 @@ static inline void xs_tcp_read_xid(struc
transport->tcp_flags &= ~TCP_RCV_COPY_XID;
transport->tcp_flags |= TCP_RCV_COPY_DATA;
transport->tcp_copied = 4;
- dprintk("RPC: reading reply for XID %08x\n",
+ dprintk("RPC: reading reply for XID %08x\n",
ntohl(transport->tcp_xid));
xs_tcp_check_fraghdr(transport);
}
@@ -816,7 +816,7 @@ static inline void xs_tcp_read_request(s
req = xprt_lookup_rqst(xprt, transport->tcp_xid);
if (!req) {
transport->tcp_flags &= ~TCP_RCV_COPY_DATA;
- dprintk("RPC: XID %08x request not found!\n",
+ dprintk("RPC: XID %08x request not found!\n",
ntohl(transport->tcp_xid));
spin_unlock(&xprt->transport_lock);
return;
@@ -853,19 +853,20 @@ static inline void xs_tcp_read_request(s
* be discarded.
*/
transport->tcp_flags &= ~TCP_RCV_COPY_DATA;
- dprintk("RPC: XID %08x truncated request\n",
+ dprintk("RPC: XID %08x truncated request\n",
ntohl(transport->tcp_xid));
- dprintk("RPC: xprt = %p, tcp_copied = %lu, tcp_offset = %u, tcp_reclen = %u\n",
- xprt, transport->tcp_copied, transport->tcp_offset,
- transport->tcp_reclen);
+ dprintk("RPC: xprt = %p, tcp_copied = %lu, "
+ "tcp_offset = %u, tcp_reclen = %u\n",
+ xprt, transport->tcp_copied,
+ transport->tcp_offset, transport->tcp_reclen);
goto out;
}
- dprintk("RPC: XID %08x read %Zd bytes\n",
+ dprintk("RPC: XID %08x read %Zd bytes\n",
ntohl(transport->tcp_xid), r);
- dprintk("RPC: xprt = %p, tcp_copied = %lu, tcp_offset = %u, tcp_reclen = %u\n",
- xprt, transport->tcp_copied, transport->tcp_offset,
- transport->tcp_reclen);
+ dprintk("RPC: xprt = %p, tcp_copied = %lu, tcp_offset = %u, "
+ "tcp_reclen = %u\n", xprt, transport->tcp_copied,
+ transport->tcp_offset, transport->tcp_reclen);
if (transport->tcp_copied == req->rq_private_buf.buflen)
transport->tcp_flags &= ~TCP_RCV_COPY_DATA;
@@ -891,7 +892,7 @@ static inline void xs_tcp_read_discard(s
desc->count -= len;
desc->offset += len;
transport->tcp_offset += len;
- dprintk("RPC: discarded %Zu bytes\n", len);
+ dprintk("RPC: discarded %Zu bytes\n", len);
xs_tcp_check_fraghdr(transport);
}
@@ -905,7 +906,7 @@ static int xs_tcp_data_recv(read_descrip
.count = len,
};
- dprintk("RPC: xs_tcp_data_recv started\n");
+ dprintk("RPC: xs_tcp_data_recv started\n");
do {
/* Read in a new fragment marker if necessary */
/* Can we ever really expect to get completely empty fragments? */
@@ -926,7 +927,7 @@ static int xs_tcp_data_recv(read_descrip
/* Skip over any trailing bytes on short reads */
xs_tcp_read_discard(transport, &desc);
} while (desc.count);
- dprintk("RPC: xs_tcp_data_recv done\n");
+ dprintk("RPC: xs_tcp_data_recv done\n");
return len - desc.count;
}
@@ -941,8 +942,9 @@ static void xs_tcp_data_ready(struct soc
struct rpc_xprt *xprt;
read_descriptor_t rd_desc;
+ dprintk("RPC: xs_tcp_data_ready...\n");
+
read_lock(&sk->sk_callback_lock);
- dprintk("RPC: xs_tcp_data_ready...\n");
if (!(xprt = xprt_from_sock(sk)))
goto out;
if (xprt->shutdown)
@@ -968,11 +970,11 @@ static void xs_tcp_state_change(struct s
read_lock(&sk->sk_callback_lock);
if (!(xprt = xprt_from_sock(sk)))
goto out;
- dprintk("RPC: xs_tcp_state_change client %p...\n", xprt);
- dprintk("RPC: state %x conn %d dead %d zapped %d\n",
- sk->sk_state, xprt_connected(xprt),
- sock_flag(sk, SOCK_DEAD),
- sock_flag(sk, SOCK_ZAPPED));
+ dprintk("RPC: xs_tcp_state_change client %p...\n", xprt);
+ dprintk("RPC: state %x conn %d dead %d zapped %d\n",
+ sk->sk_state, xprt_connected(xprt),
+ sock_flag(sk, SOCK_DEAD),
+ sock_flag(sk, SOCK_ZAPPED));
switch (sk->sk_state) {
case TCP_ESTABLISHED:
@@ -1140,7 +1142,7 @@ static void xs_set_port(struct rpc_xprt
{
struct sockaddr_in *sap = (struct sockaddr_in *) &xprt->addr;
- dprintk("RPC: setting port for xprt %p to %u\n", xprt, port);
+ dprintk("RPC: setting port for xprt %p to %u\n", xprt, port);
sap->sin_port = htons(port);
}
@@ -1159,7 +1161,7 @@ static int xs_bindresvport(struct sock_x
sizeof(myaddr));
if (err == 0) {
transport->port = port;
- dprintk("RPC: xs_bindresvport bound to port %u\n",
+ dprintk("RPC: xs_bindresvport bound to port %u\n",
port);
return 0;
}
@@ -1169,7 +1171,7 @@ static int xs_bindresvport(struct sock_x
port--;
} while (err == -EADDRINUSE && port != transport->port);
- dprintk("RPC: can't bind to reserved port (%d).\n", -err);
+ dprintk("RPC: can't bind to reserved port (%d).\n", -err);
return err;
}
@@ -1223,7 +1225,7 @@ static void xs_udp_connect_worker(struct
xs_close(xprt);
if ((err = sock_create_kern(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock)) < 0) {
- dprintk("RPC: can't create UDP transport socket (%d).\n", -err);
+ dprintk("RPC: can't create UDP transport socket (%d).\n", -err);
goto out;
}
xs_reclassify_socket(sock);
@@ -1233,7 +1235,7 @@ static void xs_udp_connect_worker(struct
goto out;
}
- dprintk("RPC: worker connecting xprt %p to address: %s\n",
+ dprintk("RPC: worker connecting xprt %p to address: %s\n",
xprt, xprt->address_strings[RPC_DISPLAY_ALL]);
if (!transport->inet) {
@@ -1275,7 +1277,7 @@ static void xs_tcp_reuse_connection(stru
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
struct sockaddr any;
- dprintk("RPC: disconnecting xprt %p to reuse port\n", xprt);
+ dprintk("RPC: disconnecting xprt %p to reuse port\n", xprt);
/*
* Disconnect the transport socket by doing a connect operation
@@ -1285,7 +1287,7 @@ static void xs_tcp_reuse_connection(stru
any.sa_family = AF_UNSPEC;
result = kernel_connect(transport->sock, &any, sizeof(any), 0);
if (result)
- dprintk("RPC: AF_UNSPEC connect return code %d\n",
+ dprintk("RPC: AF_UNSPEC connect return code %d\n",
result);
}
@@ -1309,7 +1311,8 @@ static void xs_tcp_connect_worker(struct
if (!sock) {
/* start from scratch */
if ((err = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &sock)) < 0) {
- dprintk("RPC: can't create TCP transport socket (%d).\n", -err);
+ dprintk("RPC: can't create TCP transport "
+ "socket (%d).\n", -err);
goto out;
}
xs_reclassify_socket(sock);
@@ -1322,7 +1325,7 @@ static void xs_tcp_connect_worker(struct
/* "close" the socket, preserving the local port */
xs_tcp_reuse_connection(xprt);
- dprintk("RPC: worker connecting xprt %p to address: %s\n",
+ dprintk("RPC: worker connecting xprt %p to address: %s\n",
xprt, xprt->address_strings[RPC_DISPLAY_ALL]);
if (!transport->inet) {
@@ -1359,8 +1362,9 @@ static void xs_tcp_connect_worker(struct
xprt->stat.connect_start = jiffies;
status = kernel_connect(sock, (struct sockaddr *) &xprt->addr,
xprt->addrlen, O_NONBLOCK);
- dprintk("RPC: %p connect status %d connected %d sock state %d\n",
- xprt, -status, xprt_connected(xprt), sock->sk->sk_state);
+ dprintk("RPC: %p connect status %d connected %d sock state %d\n",
+ xprt, -status, xprt_connected(xprt),
+ sock->sk->sk_state);
if (status < 0) {
switch (status) {
case -EINPROGRESS:
@@ -1404,7 +1408,8 @@ static void xs_connect(struct rpc_task *
return;
if (transport->sock != NULL) {
- dprintk("RPC: xs_connect delayed xprt %p for %lu seconds\n",
+ dprintk("RPC: xs_connect delayed xprt %p for %lu "
+ "seconds\n",
xprt, xprt->reestablish_timeout / HZ);
schedule_delayed_work(&transport->connect_worker,
xprt->reestablish_timeout);
@@ -1412,7 +1417,7 @@ static void xs_connect(struct rpc_task *
if (xprt->reestablish_timeout > XS_TCP_MAX_REEST_TO)
xprt->reestablish_timeout = XS_TCP_MAX_REEST_TO;
} else {
- dprintk("RPC: xs_connect scheduled xprt %p\n", xprt);
+ dprintk("RPC: xs_connect scheduled xprt %p\n", xprt);
schedule_delayed_work(&transport->connect_worker, 0);
/* flush_scheduled_work can sleep... */
@@ -1507,13 +1512,14 @@ static struct rpc_xprt *xs_setup_xprt(st
struct sock_xprt *new;
if (addrlen > sizeof(xprt->addr)) {
- dprintk("RPC: xs_setup_xprt: address too large\n");
+ dprintk("RPC: xs_setup_xprt: address too large\n");
return ERR_PTR(-EBADF);
}
new = kzalloc(sizeof(*new), GFP_KERNEL);
if (new == NULL) {
- dprintk("RPC: xs_setup_xprt: couldn't allocate rpc_xprt\n");
+ dprintk("RPC: xs_setup_xprt: couldn't allocate "
+ "rpc_xprt\n");
return ERR_PTR(-ENOMEM);
}
xprt = &new->xprt;
@@ -1522,7 +1528,8 @@ static struct rpc_xprt *xs_setup_xprt(st
xprt->slot = kcalloc(xprt->max_reqs, sizeof(struct rpc_rqst), GFP_KERNEL);
if (xprt->slot == NULL) {
kfree(xprt);
- dprintk("RPC: xs_setup_xprt: couldn't allocate slot table\n");
+ dprintk("RPC: xs_setup_xprt: couldn't allocate slot "
+ "table\n");
return ERR_PTR(-ENOMEM);
}
@@ -1572,7 +1579,7 @@ struct rpc_xprt *xs_setup_udp(struct soc
xprt_set_timeout(&xprt->timeout, 5, 5 * HZ);
xs_format_peer_addresses(xprt);
- dprintk("RPC: set up transport to address %s\n",
+ dprintk("RPC: set up transport to address %s\n",
xprt->address_strings[RPC_DISPLAY_ALL]);
return xprt;
@@ -1616,7 +1623,7 @@ struct rpc_xprt *xs_setup_tcp(struct soc
xprt_set_timeout(&xprt->timeout, 2, 60 * HZ);
xs_format_peer_addresses(xprt);
- dprintk("RPC: set up transport to address %s\n",
+ dprintk("RPC: set up transport to address %s\n",
xprt->address_strings[RPC_DISPLAY_ALL]);
return xprt;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 04/14] SUNRPC: Eliminate side effects from rpc_malloc
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
` (2 preceding siblings ...)
2007-01-18 23:29 ` [PATCH 03/14] SUNRPC: fix print format for tk_pid Chuck Lever
@ 2007-01-18 23:29 ` Chuck Lever
2007-01-18 23:30 ` [PATCH 05/14] SUNRPC: Make rpc_free API more generic Chuck Lever
` (9 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:29 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
Currently rpc_malloc sets req->rq_buffer internally. Make this a cleaner
interface: return a pointer to the new buffer (or NULL) and make the
caller set req->rq_buffer and req->rq_bufsize.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
net/sunrpc/clnt.c | 5 ++++-
net/sunrpc/sched.c | 14 +++-----------
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index f837335..244cce4 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -765,8 +765,11 @@ call_allocate(struct rpc_task *task)
* auth->au_wslack */
bufsiz = task->tk_msg.rpc_proc->p_bufsiz + RPC_SLACK_SPACE;
- if (xprt->ops->buf_alloc(task, bufsiz << 1) != NULL)
+ req->rq_buffer = xprt->ops->buf_alloc(task, bufsiz << 1);
+ if (req->rq_buffer != NULL) {
+ req->rq_bufsize = bufsiz;
return;
+ }
dprintk("RPC: %5u rpc_buffer allocation failed\n", task->tk_pid);
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index cb0c5f4..08104dd 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -749,7 +749,6 @@ static void rpc_async_schedule(struct wo
*/
void * rpc_malloc(struct rpc_task *task, size_t size)
{
- struct rpc_rqst *req = task->tk_rqstp;
gfp_t gfp;
if (task->tk_flags & RPC_TASK_SWAPPER)
@@ -757,16 +756,9 @@ void * rpc_malloc(struct rpc_task *task,
else
gfp = GFP_NOFS;
- if (size > RPC_BUFFER_MAXSIZE) {
- req->rq_buffer = kmalloc(size, gfp);
- if (req->rq_buffer)
- req->rq_bufsize = size;
- } else {
- req->rq_buffer = mempool_alloc(rpc_buffer_mempool, gfp);
- if (req->rq_buffer)
- req->rq_bufsize = RPC_BUFFER_MAXSIZE;
- }
- return req->rq_buffer;
+ if (size <= RPC_BUFFER_MAXSIZE)
+ return mempool_alloc(rpc_buffer_mempool, gfp);
+ return kmalloc(size, gfp);
}
/**
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 05/14] SUNRPC: Make rpc_free API more generic
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
` (3 preceding siblings ...)
2007-01-18 23:29 ` [PATCH 04/14] SUNRPC: Eliminate side effects from rpc_malloc Chuck Lever
@ 2007-01-18 23:30 ` Chuck Lever
2007-01-18 23:30 ` [PATCH 06/14] SUNRPC: introduce rpcbind: replacement for in-kernel portmapper Chuck Lever
` (8 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:30 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
Don't diddle with rq_buffer and rq_bufsize inside of rpc_free.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
include/linux/sunrpc/sched.h | 2 +-
include/linux/sunrpc/xprt.h | 2 +-
net/sunrpc/sched.c | 15 +++++++--------
net/sunrpc/xprt.c | 2 +-
4 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 97c7616..88e6e39 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -265,7 +265,7 @@ struct rpc_task *rpc_wake_up_next(struct
void rpc_wake_up_status(struct rpc_wait_queue *, int);
void rpc_delay(struct rpc_task *, unsigned long);
void * rpc_malloc(struct rpc_task *, size_t);
-void rpc_free(struct rpc_task *);
+void rpc_free(struct rpc_task *, void *, size_t);
int rpciod_up(void);
void rpciod_down(void);
int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *));
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index f780e72..51c3660 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -112,7 +112,7 @@ struct rpc_xprt_ops {
void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
void (*connect)(struct rpc_task *task);
void * (*buf_alloc)(struct rpc_task *task, size_t size);
- void (*buf_free)(struct rpc_task *task);
+ void (*buf_free)(struct rpc_task *task, void *buffer, size_t size);
int (*send_request)(struct rpc_task *task);
void (*set_retrans_timeout)(struct rpc_task *task);
void (*timer)(struct rpc_task *task);
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 08104dd..c689196 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -763,20 +763,19 @@ void * rpc_malloc(struct rpc_task *task,
/**
* rpc_free - free buffer allocated via rpc_malloc
- * @task: RPC task with a buffer to be freed
+ * @task: RPC task used when this buffer was allocated
+ * @buffer: buffer to free
*
*/
-void rpc_free(struct rpc_task *task)
+void rpc_free(struct rpc_task *task, void *buffer, size_t size)
{
struct rpc_rqst *req = task->tk_rqstp;
- if (req->rq_buffer) {
- if (req->rq_bufsize == RPC_BUFFER_MAXSIZE)
- mempool_free(req->rq_buffer, rpc_buffer_mempool);
+ if (req) {
+ if (size <= RPC_BUFFER_MAXSIZE)
+ mempool_free(buffer, rpc_buffer_mempool);
else
- kfree(req->rq_buffer);
- req->rq_buffer = NULL;
- req->rq_bufsize = 0;
+ kfree(buffer);
}
}
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index cf59f7d..9f787ac 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -855,7 +855,7 @@ void xprt_release(struct rpc_task *task)
mod_timer(&xprt->timer,
xprt->last_used + xprt->idle_timeout);
spin_unlock_bh(&xprt->transport_lock);
- xprt->ops->buf_free(task);
+ xprt->ops->buf_free(task, req->rq_buffer, req->rq_bufsize);
task->tk_rqstp = NULL;
if (req->rq_release_snd_buf)
req->rq_release_snd_buf(req);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 06/14] SUNRPC: introduce rpcbind: replacement for in-kernel portmapper
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
` (4 preceding siblings ...)
2007-01-18 23:30 ` [PATCH 05/14] SUNRPC: Make rpc_free API more generic Chuck Lever
@ 2007-01-18 23:30 ` Chuck Lever
2007-01-19 0:09 ` Christoph Hellwig
2007-01-18 23:30 ` [PATCH 07/14] SUNRPC: switch socket-based RPC transports to use rpcbind Chuck Lever
` (7 subsequent siblings)
13 siblings, 1 reply; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:30 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
Introduce a replacement for the in-kernel portmapper client that supports
all 3 versions of the rpcbind protocol. This code is not used yet.
Original code by Groupe Bull updated for the latest kernel, with multiple
bug fixes.
Note that rpcb_clnt.c does not yet support registering via versions 3 and
4 of the rpcbind protocol.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
include/linux/sunrpc/clnt.h | 3
include/linux/sunrpc/debug.h | 1
include/linux/sunrpc/xprt.h | 1
net/sunrpc/Makefile | 2
net/sunrpc/rpcb_clnt.c | 539 ++++++++++++++++++++++++++++++++++++++++++
net/sunrpc/xprt.c | 1
6 files changed, 546 insertions(+), 1 deletions(-)
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index a1be89d..502e5ea 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -121,6 +121,8 @@ int rpc_destroy_client(struct rpc_clnt
void rpc_release_client(struct rpc_clnt *);
void rpc_getport(struct rpc_task *);
int rpc_register(u32, u32, int, unsigned short, int *);
+int rpcb_register(u32, u32, int, unsigned short, int *);
+void rpcb_getport(struct rpc_task *);
void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
@@ -143,6 +145,7 @@ char * rpc_peeraddr2str(struct rpc_clnt
* Helper function for NFSroot support
*/
int rpc_getport_external(struct sockaddr_in *, __u32, __u32, int);
+int rpcb_getport_external(struct sockaddr_in *, __u32, __u32, int);
#endif /* __KERNEL__ */
#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 60fce3c..7b11c74 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -18,6 +18,7 @@ #define RPCDBG_DEBUG 0x0004
#define RPCDBG_NFS 0x0008
#define RPCDBG_AUTH 0x0010
#define RPCDBG_PMAP 0x0020
+#define RPCDBG_BIND 0x0020
#define RPCDBG_SCHED 0x0040
#define RPCDBG_TRANS 0x0080
#define RPCDBG_SVCSOCK 0x0100
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 51c3660..6c035cb 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -150,6 +150,7 @@ struct rpc_xprt {
unsigned long state; /* transport state */
unsigned char shutdown : 1, /* being shut down */
resvport : 1; /* use a reserved port */
+ unsigned int bind_index; /* bind function index */
/*
* Connection of transports
diff --git a/net/sunrpc/Makefile b/net/sunrpc/Makefile
index cdcab9c..3417a1e 100644
--- a/net/sunrpc/Makefile
+++ b/net/sunrpc/Makefile
@@ -9,7 +9,7 @@ obj-$(CONFIG_SUNRPC_GSS) += auth_gss/
sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \
auth.o auth_null.o auth_unix.o \
svc.o svcsock.o svcauth.o svcauth_unix.o \
- pmap_clnt.o timer.o xdr.o \
+ pmap_clnt.o rpcb_clnt.o timer.o xdr.o \
sunrpc_syms.o cache.o rpc_pipe.o
sunrpc-$(CONFIG_PROC_FS) += stats.o
sunrpc-$(CONFIG_SYSCTL) += sysctl.o
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
new file mode 100644
index 0000000..8f3e133
--- /dev/null
+++ b/net/sunrpc/rpcb_clnt.c
@@ -0,0 +1,539 @@
+/*
+ * linux/net/sunrpc/rpcb_clnt.c
+ *
+ * In-kernel rpcbind client supporting versions 2, 3, and 4 of the rpcbind
+ * protocol (RFC 1833).
+ *
+ * Added by Gilles Quillard, Bull Open Source, 2005 <gilles.quillard@bull.net>
+ *
+ * Based on net/sunrpc/pmap_clnt.c,
+ * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
+ */
+
+#include <linux/types.h>
+#include <linux/socket.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+
+#include <linux/sunrpc/clnt.h>
+#include <linux/sunrpc/sched.h>
+
+#ifdef RPC_DEBUG
+# define RPCDBG_FACILITY RPCDBG_BIND
+#endif
+
+#define RPC_BIND_PROGRAM (100000U)
+#define RPC_BIND_PORT (111U)
+
+#define RPCB_SET (1)
+#define RPCB_UNSET (2)
+#define RPCB_GETPORT (3)
+#define RPCB_GETADDR (3)
+#define RPCB_GETVERSADDR (9)
+
+/* US-ASCII netid strings -- must work even on s/390 */
+#define RPCB_NETID_UDP "\165\144\160" /* "udp" */
+#define RPCB_NETID_TCP "\164\143\160" /* "tcp" */
+
+static void rpcb_getport_done(struct rpc_task *, void *);
+extern struct rpc_program rpcb_program;
+
+struct rpcbind_args {
+ struct rpc_xprt * r_xprt;
+
+ u32 r_prog;
+ u32 r_vers;
+ u32 r_prot;
+ unsigned short r_port;
+ char * r_netid;
+ char r_addr[128];
+ char * r_owner;
+};
+
+static struct rpc_procinfo rpcb_procedures2[];
+static struct rpc_procinfo rpcb_procedures3[];
+
+static struct rpcb_info {
+ int rpc_vers;
+ struct rpc_procinfo * rpc_proc;
+} rpcb_next_version[];
+
+static void rpcb_getport_prepare(struct rpc_task *task, void *calldata)
+{
+ struct rpcbind_args *map = calldata;
+ struct rpc_xprt *xprt = map->r_xprt;
+ struct rpc_message msg = {
+ .rpc_proc = rpcb_next_version[xprt->bind_index].rpc_proc,
+ .rpc_argp = map,
+ .rpc_resp = &map->r_port,
+ };
+
+ rpc_call_setup(task, &msg, 0);
+}
+
+static inline struct rpcbind_args *rpcb_map_alloc(void)
+{
+ return kzalloc(sizeof(struct rpcbind_args), GFP_ATOMIC);
+}
+
+static inline void rpcb_map_free(struct rpcbind_args *map)
+{
+ kfree(map);
+}
+
+static void rpcb_map_release(void *data)
+{
+ rpcb_map_free(data);
+}
+
+static const struct rpc_call_ops rpcb_getport_ops = {
+ .rpc_call_prepare = rpcb_getport_prepare,
+ .rpc_call_done = rpcb_getport_done,
+ .rpc_release = rpcb_map_release,
+};
+
+static void rpcb_wake_rpcbind_waiters(struct rpc_xprt *xprt, int status)
+{
+ xprt_clear_binding(xprt);
+ rpc_wake_up_status(&xprt->binding, status);
+}
+
+static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, int proto, int version, int privileged)
+{
+ struct rpc_create_args args = {
+ .protocol = proto,
+ .address = srvaddr,
+ .addrsize = sizeof(struct sockaddr_in),
+ .servername = hostname,
+ .program = &rpcb_program,
+ .version = version,
+ .authflavor = RPC_AUTH_NULL,
+ .flags = (RPC_CLNT_CREATE_ONESHOT |
+ RPC_CLNT_CREATE_NOPING),
+ };
+
+ ((struct sockaddr_in *)srvaddr)->sin_port = htons(RPC_BIND_PORT);
+ if (!privileged)
+ args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
+ return rpc_create(&args);
+}
+
+/**
+ * rpcb_register - set or unset a port registration with the local portmapper
+ * @prog: RPC program number to bind
+ * @vers: RPC version number to bind
+ * @prot: transport protocol to use to make this request
+ * @port: port value to register
+ * @okay: result code
+ *
+ * port == 0 means unregister, port != 0 means register.
+ *
+ * This routine supports only rpcbind version 2.
+ */
+int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay)
+{
+ struct sockaddr_in sin = {
+ .sin_family = AF_INET,
+ .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
+ };
+ struct rpcbind_args map = {
+ .r_prog = prog,
+ .r_vers = vers,
+ .r_prot = prot,
+ .r_port = port,
+ };
+ struct rpc_message msg = {
+ .rpc_proc = &rpcb_procedures2[port ? RPCB_SET : RPCB_UNSET],
+ .rpc_argp = &map,
+ .rpc_resp = okay,
+ };
+ struct rpc_clnt *rpcb_clnt;
+ int error = 0;
+
+ dprintk("RPC: %sregistering (%u, %u, %d, %u) with local "
+ "rpcbind\n", (port ? "" : "un"),
+ prog, vers, prot, port);
+
+ rpcb_clnt = rpcb_create("localhost", (struct sockaddr *) &sin,
+ IPPROTO_UDP, 2, 1);
+ if (IS_ERR(rpcb_clnt))
+ return PTR_ERR(rpcb_clnt);
+
+ error = rpc_call_sync(rpcb_clnt, &msg, 0);
+
+ if (error < 0)
+ printk(KERN_WARNING "RPC: failed to contact local rpcbind "
+ "server (errno %d).\n", -error);
+ dprintk("RPC: registration status %d/%d\n", error, *okay);
+
+ return error;
+}
+
+#ifdef CONFIG_ROOT_NFS
+/**
+ * rpcb_getport_external - obtain the port for a given RPC service on a given host
+ * @sin: address of remote peer
+ * @prog: RPC program number to bind
+ * @vers: RPC version number to bind
+ * @prot: transport protocol to use to make this request
+ *
+ * Called from outside the RPC client in a synchronous task context.
+ *
+ * For now, this supports only version 2 queries, but is used only by
+ * mount_clnt for NFS_ROOT.
+ */
+int rpcb_getport_external(struct sockaddr_in *sin, __u32 prog, __u32 vers, int prot)
+{
+ struct rpcbind_args map = {
+ .r_prog = prog,
+ .r_vers = vers,
+ .r_prot = prot,
+ .r_port = 0,
+ };
+ struct rpc_message msg = {
+ .rpc_proc = &rpcb_procedures2[RPCB_GETPORT],
+ .rpc_argp = &map,
+ .rpc_resp = &map.r_port,
+ };
+ struct rpc_clnt *rpcb_clnt;
+ char hostname[40];
+ int status;
+
+ dprintk("RPC: rpcb_getport_external(%u.%u.%u.%u, %u, %u, %d)\n",
+ NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);
+
+ sprintf(hostname, "%u.%u.%u.%u", NIPQUAD(sin->sin_addr.s_addr));
+ rpcb_clnt = rpcb_create(hostname, (struct sockaddr *)sin, prot, 2, 0);
+ if (IS_ERR(rpcb_clnt))
+ return PTR_ERR(rpcb_clnt);
+
+ status = rpc_call_sync(rpcb_clnt, &msg, 0);
+
+ if (status >= 0) {
+ if (map.r_port != 0)
+ return map.r_port;
+ status = -EACCES;
+ }
+ return status;
+}
+#endif
+
+/**
+ * rpcb_getport - obtain the port for a given RPC service on a given host
+ * @task: task that is waiting for portmapper request
+ *
+ * This one can be called for an ongoing RPC request, and can be used in
+ * an async (rpciod) context.
+ */
+void rpcb_getport(struct rpc_task *task)
+{
+ struct rpc_clnt *clnt = task->tk_client;
+ int bind_version;
+ struct rpc_xprt *xprt = task->tk_xprt;
+ struct rpc_clnt *rpcb_clnt;
+ static struct rpcbind_args *map;
+ struct rpc_task *child;
+ struct sockaddr addr;
+ int status;
+
+ dprintk("RPC: %5u rpcb_getport(%s, %u, %u, %d)\n",
+ task->tk_pid, clnt->cl_server,
+ clnt->cl_prog, clnt->cl_vers, xprt->prot);
+
+ /* Autobind on cloned rpc clients is discouraged */
+ BUG_ON(clnt->cl_parent != clnt);
+
+ if (xprt_test_and_set_binding(xprt)) {
+ status = -EACCES; /* tell caller to check again */
+ dprintk("RPC: %5u rpcb_getport waiting for another binder\n",
+ task->tk_pid);
+ goto bailout_nowake;
+ }
+
+ /* Put self on queue before sending rpcbind request, in case
+ * rpcb_getport_done completes before we return from rpc_run_task */
+ rpc_sleep_on(&xprt->binding, task, NULL, NULL);
+
+ /* Someone else may have bound if we slept */
+ if (xprt_bound(xprt)) {
+ status = 0;
+ dprintk("RPC: %5u rpcb_getport already bound\n", task->tk_pid);
+ goto bailout_nofree;
+ }
+
+ if (rpcb_next_version[xprt->bind_index].rpc_proc == NULL) {
+ xprt->bind_index = 0;
+ status = -EACCES; /* tell caller to check again */
+ dprintk("RPC: %5u rpcb_getport no more getport versions "
+ "available\n", task->tk_pid);
+ goto bailout_nofree;
+ }
+ bind_version = rpcb_next_version[xprt->bind_index].rpc_vers;
+
+ dprintk("RPC: %5u rpcb_getport trying rpcbind version %u\n",
+ task->tk_pid, bind_version);
+
+ map = rpcb_map_alloc();
+ if (!map) {
+ status = -ENOMEM;
+ dprintk("RPC: %5u rpcb_getport no memory available\n",
+ task->tk_pid);
+ goto bailout_nofree;
+ }
+ map->r_prog = clnt->cl_prog;
+ map->r_vers = clnt->cl_vers;
+ map->r_prot = xprt->prot;
+ map->r_port = 0;
+ map->r_xprt = xprt_get(xprt);
+ map->r_netid = (xprt->prot == IPPROTO_TCP) ? RPCB_NETID_TCP :
+ RPCB_NETID_UDP;
+ memcpy(&map->r_addr, rpc_peeraddr2str(clnt, RPC_DISPLAY_ADDR),
+ sizeof(map->r_addr));
+ map->r_owner = "rpcb"; /* ignored for GETADDR */
+
+ rpc_peeraddr(clnt, (void *)&addr, sizeof(addr));
+ rpcb_clnt = rpcb_create(clnt->cl_server, &addr, xprt->prot, bind_version, 0);
+ if (IS_ERR(rpcb_clnt)) {
+ status = PTR_ERR(rpcb_clnt);
+ dprintk("RPC: %5u rpcb_getport rpcb_create failed, error %ld\n",
+ task->tk_pid, PTR_ERR(rpcb_clnt));
+ goto bailout;
+ }
+
+ child = rpc_run_task(rpcb_clnt, RPC_TASK_ASYNC, &rpcb_getport_ops, map);
+ if (IS_ERR(child)) {
+ status = -EIO;
+ dprintk("RPC: %5u rpcb_getport rpc_run_task failed\n",
+ task->tk_pid);
+ goto bailout;
+ }
+ rpc_put_task(child);
+
+ task->tk_xprt->stat.bind_count++;
+ return;
+
+bailout:
+ rpcb_map_free(map);
+ xprt_put(xprt);
+bailout_nofree:
+ rpcb_wake_rpcbind_waiters(xprt, status);
+bailout_nowake:
+ task->tk_status = status;
+}
+
+/*
+ * Rpcbind child task calls this callback via tk_exit.
+ */
+static void rpcb_getport_done(struct rpc_task *child, void *data)
+{
+ struct rpcbind_args *map = data;
+ struct rpc_xprt *xprt = map->r_xprt;
+ int status = child->tk_status;
+
+ if (status != -EPROTONOSUPPORT)
+ xprt->bind_index = 0;
+ else
+ xprt->bind_index++;
+
+ if (status < 0) {
+ /* rpcbind server not available on remote host? */
+ xprt->ops->set_port(xprt, 0);
+ } else if (map->r_port == 0) {
+ /* Requested RPC service wasn't registered on remote host */
+ xprt->ops->set_port(xprt, 0);
+ status = -EACCES;
+ } else {
+ /* Succeeded */
+ xprt->ops->set_port(xprt, map->r_port);
+ xprt_set_bound(xprt);
+ status = 0;
+ }
+
+ dprintk("RPC: %5u rpcb_getport_done(status %d, port %u)\n",
+ child->tk_pid, status, map->r_port);
+
+ rpcb_wake_rpcbind_waiters(xprt, status);
+ xprt_put(xprt);
+}
+
+/*
+ * rpcbind version 2 XDR encode/decode routines
+ */
+static int xdr_encode_mapping(struct rpc_rqst *req, __be32 *p, struct rpcbind_args *rpcb)
+{
+ dprintk("RPC: xdr_encode_mapping(%u, %u, %d, %u)\n",
+ rpcb->r_prog, rpcb->r_vers, rpcb->r_prot, rpcb->r_port);
+ *p++ = htonl(rpcb->r_prog);
+ *p++ = htonl(rpcb->r_vers);
+ *p++ = htonl(rpcb->r_prot);
+ *p++ = htonl(rpcb->r_port);
+
+ req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
+ return 0;
+}
+
+static int xdr_decode_getport(struct rpc_rqst *req, __be32 *p, unsigned short *portp)
+{
+ *portp = (unsigned short) ntohl(*p++);
+ return 0;
+}
+
+static int xdr_decode_set(struct rpc_rqst *req, __be32 *p, unsigned int *boolp)
+{
+ *boolp = (unsigned int) ntohl(*p++);
+ return 0;
+}
+
+/*
+ * rpcbind version 3 XDR encode/decode routines
+ */
+static int xdr_encode_getaddr(struct rpc_rqst *req, __be32 *p, struct rpcbind_args *rpcb)
+{
+ dprintk("RPC: xdr_encode_getaddr(%u, %u, %s)\n",
+ rpcb->r_prog, rpcb->r_vers, rpcb->r_addr);
+ *p++ = htonl(rpcb->r_prog);
+ *p++ = htonl(rpcb->r_vers);
+
+ p = xdr_encode_string(p, rpcb->r_netid);
+ p = xdr_encode_string(p, rpcb->r_addr);
+ p = xdr_encode_string(p, rpcb->r_owner);
+
+ req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
+
+ return 0;
+}
+
+static int xdr_decode_getaddr(struct rpc_rqst *req, __be32 *p, unsigned short *portp)
+{
+ char *addr;
+ int addr_len, c, i, f, first, val;
+
+ *portp = 0;
+ addr_len = (unsigned int) ntohl(*p++);
+ addr = (char *)p;
+ val = 0;
+ first = 1;
+ f = 1;
+ for (i = addr_len - 1; i > 0; i--) {
+ c = addr[i];
+ if (c >= '0' && c <= '9') {
+ val += (c - '0') * f;
+ f *= 10;
+ } else if (c == '.') {
+ if (first) {
+ *portp = val;
+ val = first = 0;
+ f = 1;
+ } else {
+ *portp |= (val << 8);
+ break;
+ }
+ }
+ }
+ return 0;
+}
+
+static struct rpc_procinfo rpcb_procedures2[] = {
+ [RPCB_SET] = {
+ .p_proc = RPCB_SET,
+ .p_encode = (kxdrproc_t) xdr_encode_mapping,
+ .p_decode = (kxdrproc_t) xdr_decode_set,
+ .p_bufsiz = 4,
+ .p_count = 1,
+ },
+ [RPCB_UNSET] = {
+ .p_proc = RPCB_UNSET,
+ .p_encode = (kxdrproc_t) xdr_encode_mapping,
+ .p_decode = (kxdrproc_t) xdr_decode_set,
+ .p_bufsiz = 4,
+ .p_count = 1,
+ },
+ [RPCB_GETADDR] = {
+ .p_proc = RPCB_GETPORT,
+ .p_encode = (kxdrproc_t) xdr_encode_mapping,
+ .p_decode = (kxdrproc_t) xdr_decode_getport,
+ .p_bufsiz = 4,
+ .p_count = 1,
+ },
+};
+
+static struct rpc_procinfo rpcb_procedures3[] = {
+ [RPCB_SET] = {
+ .p_proc = RPCB_SET,
+ .p_encode = (kxdrproc_t) xdr_encode_mapping,
+ .p_decode = (kxdrproc_t) xdr_decode_set,
+ .p_bufsiz = 4,
+ .p_count = 1,
+ },
+ [RPCB_UNSET] = {
+ .p_proc = RPCB_UNSET,
+ .p_encode = (kxdrproc_t) xdr_encode_mapping,
+ .p_decode = (kxdrproc_t) xdr_decode_set,
+ .p_bufsiz = 4,
+ .p_count = 1,
+ },
+ [RPCB_GETADDR] = {
+ .p_proc = RPCB_GETADDR,
+ .p_encode = (kxdrproc_t) xdr_encode_getaddr,
+ .p_decode = (kxdrproc_t) xdr_decode_getaddr,
+ .p_bufsiz = 36,
+ .p_count = 1,
+ },
+};
+
+static struct rpc_procinfo rpcb_procedures4[] = {
+ [RPCB_GETVERSADDR] = {
+ .p_proc = RPCB_GETVERSADDR,
+ .p_encode = (kxdrproc_t) xdr_encode_getaddr,
+ .p_decode = (kxdrproc_t) xdr_decode_getaddr,
+ .p_bufsiz = 36,
+ .p_count = 1,
+ },
+};
+
+static struct rpcb_info rpcb_next_version[] = {
+#if defined(CONFIG_RPCBIND_VERSION4)
+ { 4, &rpcb_procedures4[RPCB_GETVERSADDR] },
+#endif
+#if defined(CONFIG_RPCBIND_VERSION3)
+ { 3, &rpcb_procedures3[RPCB_GETADDR] },
+#endif
+ { 2, &rpcb_procedures2[RPCB_GETPORT] },
+ { 0, NULL },
+};
+
+static struct rpc_version rpcb_version2 = {
+ .number = 2,
+ .nrprocs = 4,
+ .procs = rpcb_procedures2
+};
+
+static struct rpc_version rpcb_version3 = {
+ .number = 3,
+ .nrprocs = 4,
+ .procs = rpcb_procedures3
+};
+
+static struct rpc_version rpcb_version4 = {
+ .number = 4,
+ .nrprocs = 10,
+ .procs = rpcb_procedures4
+};
+
+static struct rpc_version *rpcb_version[] = {
+ NULL,
+ NULL,
+ &rpcb_version2,
+ &rpcb_version3,
+ &rpcb_version4
+};
+
+static struct rpc_stat rpcb_stats;
+
+struct rpc_program rpcb_program = {
+ .name = "rpcbind",
+ .number = RPC_BIND_PROGRAM,
+ .nrvers = ARRAY_SIZE(rpcb_version),
+ .version = rpcb_version,
+ .stats = &rpcb_stats,
+};
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 9f787ac..86181ac 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -928,6 +928,7 @@ struct rpc_xprt *xprt_create_transport(i
xprt->timer.data = (unsigned long) xprt;
xprt->last_used = jiffies;
xprt->cwnd = RPC_INITCWND;
+ xprt->bind_index = 0;
rpc_init_wait_queue(&xprt->binding, "xprt_binding");
rpc_init_wait_queue(&xprt->pending, "xprt_pending");
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 07/14] SUNRPC: switch socket-based RPC transports to use rpcbind
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
` (5 preceding siblings ...)
2007-01-18 23:30 ` [PATCH 06/14] SUNRPC: introduce rpcbind: replacement for in-kernel portmapper Chuck Lever
@ 2007-01-18 23:30 ` Chuck Lever
2007-01-18 23:30 ` [PATCH 08/14] SUNRPC: switch the RPC server to use the new rpcbind registration API Chuck Lever
` (6 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:30 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
Now that we have a version of the portmapper that supports versions 3 and 4
of the rpcbind protocol, use it for new RPC client connections over
sockets.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
net/sunrpc/xprtsock.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 64736b3..78d5494 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1477,7 +1477,7 @@ static struct rpc_xprt_ops xs_udp_ops =
.set_buffer_size = xs_udp_set_buffer_size,
.reserve_xprt = xprt_reserve_xprt_cong,
.release_xprt = xprt_release_xprt_cong,
- .rpcbind = rpc_getport,
+ .rpcbind = rpcb_getport,
.set_port = xs_set_port,
.connect = xs_connect,
.buf_alloc = rpc_malloc,
@@ -1494,7 +1494,7 @@ static struct rpc_xprt_ops xs_udp_ops =
static struct rpc_xprt_ops xs_tcp_ops = {
.reserve_xprt = xprt_reserve_xprt,
.release_xprt = xs_tcp_release_xprt,
- .rpcbind = rpc_getport,
+ .rpcbind = rpcb_getport,
.set_port = xs_set_port,
.connect = xs_connect,
.buf_alloc = rpc_malloc,
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 08/14] SUNRPC: switch the RPC server to use the new rpcbind registration API
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
` (6 preceding siblings ...)
2007-01-18 23:30 ` [PATCH 07/14] SUNRPC: switch socket-based RPC transports to use rpcbind Chuck Lever
@ 2007-01-18 23:30 ` Chuck Lever
2007-01-18 23:30 ` [PATCH 09/14] NFS: switch NFSROOT to use new rpcbind client Chuck Lever
` (5 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:30 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
Eventually this interface will support versions 3 and 4 of the rpcbind
protocol, which will allow the Linux RPC server to register services on
IPv6 addresses.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
net/sunrpc/svc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 6627759..d38d74a 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -666,7 +666,7 @@ svc_register(struct svc_serv *serv, int
if (progp->pg_vers[i]->vs_hidden)
continue;
- error = rpc_register(progp->pg_prog, i, proto, port, &dummy);
+ error = rpcb_register(progp->pg_prog, i, proto, port, &dummy);
if (error < 0)
break;
if (port && !dummy) {
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 09/14] NFS: switch NFSROOT to use new rpcbind client
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
` (7 preceding siblings ...)
2007-01-18 23:30 ` [PATCH 08/14] SUNRPC: switch the RPC server to use the new rpcbind registration API Chuck Lever
@ 2007-01-18 23:30 ` Chuck Lever
2007-01-18 23:30 ` [PATCH 10/14] SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options Chuck Lever
` (4 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:30 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
It is arguable whether NFSROOT will support IPv6, and thus whether the
rpcb_getport_external API needs to support rpcbind versions greater than 2.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfs/nfsroot.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index 75f819d..49d1008 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -428,7 +428,7 @@ static int __init root_nfs_getport(int p
printk(KERN_NOTICE "Looking up port of RPC %d/%d on %u.%u.%u.%u\n",
program, version, NIPQUAD(servaddr));
set_sockaddr(&sin, servaddr, 0);
- return rpc_getport_external(&sin, program, version, proto);
+ return rpcb_getport_external(&sin, program, version, proto);
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 10/14] SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
` (8 preceding siblings ...)
2007-01-18 23:30 ` [PATCH 09/14] NFS: switch NFSROOT to use new rpcbind client Chuck Lever
@ 2007-01-18 23:30 ` Chuck Lever
2007-01-19 0:11 ` Christoph Hellwig
2007-01-18 23:30 ` [PATCH 11/14] SUNRPC: remove old portmapper Chuck Lever
` (3 subsequent siblings)
13 siblings, 1 reply; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:30 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/Kconfig | 24 ++++++++++++++++++++++++
net/sunrpc/clnt.c | 8 +++++---
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/fs/Kconfig b/fs/Kconfig
index 8cd2417..b49d1b5 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1764,6 +1764,30 @@ config NFS_COMMON
config SUNRPC
tristate
+config RPCBIND_VERSION3
+ bool "Support for rpcbind version 3"
+ depends on SUNRPC && EXPERIMENTAL
+ default n
+ help
+ The in-kernel Linux RPC client already supports rpcbind version 2.
+ This option adds support to the Linux in-kernel RPC client for
+ rpcbind version 3.
+
+ Not all servers support rpcbind version 3, and the client support is
+ still experimental. If unsure, say N.
+
+config RPCBIND_VERSION4
+ bool "Support for rpcbind version 4"
+ depends on SUNRPC && EXPERIMENTAL && RPCBIND_VERSION3
+ default n
+ help
+ The in-kernel Linux RPC client already supports rpcbind version 2.
+ This option adds support to the Linux in-kernel RPC client for
+ rpcbind version 4.
+
+ Not all servers support rpcbind version 4, and the client support is
+ still experimental. If unsure, say N.
+
config SUNRPC_GSS
tristate
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 244cce4..493b950 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -894,9 +894,11 @@ call_bind_status(struct rpc_task *task)
task->tk_pid);
break;
case -EPROTONOSUPPORT:
- dprintk("RPC: %5u remote rpcbind version 2 unavailable\n",
- task->tk_pid);
- break;
+ dprintk("RPC: %5u remote rpcbind version unavailable, retrying\n",
+ task->tk_pid);
+ task->tk_status = 0;
+ task->tk_action = call_bind;
+ return;
default:
dprintk("RPC: %5u unrecognized rpcbind error (%d)\n",
task->tk_pid, -task->tk_status);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 11/14] SUNRPC: remove old portmapper
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
` (9 preceding siblings ...)
2007-01-18 23:30 ` [PATCH 10/14] SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options Chuck Lever
@ 2007-01-18 23:30 ` Chuck Lever
2007-01-18 23:30 ` [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large Chuck Lever
` (2 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:30 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
net/sunrpc/pmap_clnt.c has been replaced by net/sunrpc/rpcb_clnt.c.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
include/linux/sunrpc/clnt.h | 3
include/linux/sunrpc/debug.h | 1
include/linux/sunrpc/msg_prot.h | 4
net/sunrpc/Makefile | 2
net/sunrpc/pmap_clnt.c | 381 ---------------------------------------
5 files changed, 1 insertions(+), 390 deletions(-)
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 502e5ea..c78b913 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -119,8 +119,6 @@ struct rpc_clnt *rpc_clone_client(struct
int rpc_shutdown_client(struct rpc_clnt *);
int rpc_destroy_client(struct rpc_clnt *);
void rpc_release_client(struct rpc_clnt *);
-void rpc_getport(struct rpc_task *);
-int rpc_register(u32, u32, int, unsigned short, int *);
int rpcb_register(u32, u32, int, unsigned short, int *);
void rpcb_getport(struct rpc_task *);
@@ -144,7 +142,6 @@ char * rpc_peeraddr2str(struct rpc_clnt
/*
* Helper function for NFSroot support
*/
-int rpc_getport_external(struct sockaddr_in *, __u32, __u32, int);
int rpcb_getport_external(struct sockaddr_in *, __u32, __u32, int);
#endif /* __KERNEL__ */
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 7b11c74..a3754d9 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -17,7 +17,6 @@ #define RPCDBG_CALL 0x0002
#define RPCDBG_DEBUG 0x0004
#define RPCDBG_NFS 0x0008
#define RPCDBG_AUTH 0x0010
-#define RPCDBG_PMAP 0x0020
#define RPCDBG_BIND 0x0020
#define RPCDBG_SCHED 0x0040
#define RPCDBG_TRANS 0x0080
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index 606cb21..784d4c3 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -78,10 +78,6 @@ enum rpc_auth_stat {
RPCSEC_GSS_CTXPROBLEM = 14
};
-#define RPC_PMAP_PROGRAM 100000
-#define RPC_PMAP_VERSION 2
-#define RPC_PMAP_PORT 111
-
#define RPC_MAXNETNAMELEN 256
/*
diff --git a/net/sunrpc/Makefile b/net/sunrpc/Makefile
index 3417a1e..8ebfc4d 100644
--- a/net/sunrpc/Makefile
+++ b/net/sunrpc/Makefile
@@ -9,7 +9,7 @@ obj-$(CONFIG_SUNRPC_GSS) += auth_gss/
sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \
auth.o auth_null.o auth_unix.o \
svc.o svcsock.o svcauth.o svcauth_unix.o \
- pmap_clnt.o rpcb_clnt.o timer.o xdr.o \
+ rpcb_clnt.o timer.o xdr.o \
sunrpc_syms.o cache.o rpc_pipe.o
sunrpc-$(CONFIG_PROC_FS) += stats.o
sunrpc-$(CONFIG_SYSCTL) += sysctl.o
diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c
deleted file mode 100644
index 8d9e780..0000000
--- a/net/sunrpc/pmap_clnt.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * linux/net/sunrpc/pmap_clnt.c
- *
- * In-kernel RPC portmapper client.
- *
- * Portmapper supports version 2 of the rpcbind protocol (RFC 1833).
- *
- * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
- */
-
-#include <linux/types.h>
-#include <linux/socket.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/uio.h>
-#include <linux/in.h>
-#include <linux/sunrpc/clnt.h>
-#include <linux/sunrpc/sched.h>
-
-#ifdef RPC_DEBUG
-# define RPCDBG_FACILITY RPCDBG_PMAP
-#endif
-
-#define PMAP_SET 1
-#define PMAP_UNSET 2
-#define PMAP_GETPORT 3
-
-struct portmap_args {
- u32 pm_prog;
- u32 pm_vers;
- u32 pm_prot;
- unsigned short pm_port;
- struct rpc_xprt * pm_xprt;
-};
-
-static struct rpc_procinfo pmap_procedures[];
-static struct rpc_clnt * pmap_create(char *, struct sockaddr_in *, int, int);
-static void pmap_getport_done(struct rpc_task *, void *);
-static struct rpc_program pmap_program;
-
-static void pmap_getport_prepare(struct rpc_task *task, void *calldata)
-{
- struct portmap_args *map = calldata;
- struct rpc_message msg = {
- .rpc_proc = &pmap_procedures[PMAP_GETPORT],
- .rpc_argp = map,
- .rpc_resp = &map->pm_port,
- };
-
- rpc_call_setup(task, &msg, 0);
-}
-
-static inline struct portmap_args *pmap_map_alloc(void)
-{
- return kmalloc(sizeof(struct portmap_args), GFP_NOFS);
-}
-
-static inline void pmap_map_free(struct portmap_args *map)
-{
- kfree(map);
-}
-
-static void pmap_map_release(void *data)
-{
- pmap_map_free(data);
-}
-
-static const struct rpc_call_ops pmap_getport_ops = {
- .rpc_call_prepare = pmap_getport_prepare,
- .rpc_call_done = pmap_getport_done,
- .rpc_release = pmap_map_release,
-};
-
-static inline void pmap_wake_portmap_waiters(struct rpc_xprt *xprt, int status)
-{
- xprt_clear_binding(xprt);
- rpc_wake_up_status(&xprt->binding, status);
-}
-
-/**
- * rpc_getport - obtain the port for a given RPC service on a given host
- * @task: task that is waiting for portmapper request
- *
- * This one can be called for an ongoing RPC request, and can be used in
- * an async (rpciod) context.
- */
-void rpc_getport(struct rpc_task *task)
-{
- struct rpc_clnt *clnt = task->tk_client;
- struct rpc_xprt *xprt = task->tk_xprt;
- struct sockaddr_in addr;
- struct portmap_args *map;
- struct rpc_clnt *pmap_clnt;
- struct rpc_task *child;
- int status;
-
- dprintk("RPC: %5u rpc_getport(%s, %u, %u, %d)\n",
- task->tk_pid, clnt->cl_server,
- clnt->cl_prog, clnt->cl_vers, xprt->prot);
-
- /* Autobind on cloned rpc clients is discouraged */
- BUG_ON(clnt->cl_parent != clnt);
-
- status = -EACCES; /* tell caller to check again */
- if (xprt_test_and_set_binding(xprt))
- goto bailout_nowake;
-
- /* Put self on queue before sending rpcbind request, in case
- * pmap_getport_done completes before we return from rpc_run_task */
- rpc_sleep_on(&xprt->binding, task, NULL, NULL);
-
- /* Someone else may have bound if we slept */
- status = 0;
- if (xprt_bound(xprt))
- goto bailout_nofree;
-
- status = -ENOMEM;
- map = pmap_map_alloc();
- if (!map)
- goto bailout_nofree;
- map->pm_prog = clnt->cl_prog;
- map->pm_vers = clnt->cl_vers;
- map->pm_prot = xprt->prot;
- map->pm_port = 0;
- map->pm_xprt = xprt_get(xprt);
-
- rpc_peeraddr(clnt, (struct sockaddr *) &addr, sizeof(addr));
- pmap_clnt = pmap_create(clnt->cl_server, &addr, map->pm_prot, 0);
- status = PTR_ERR(pmap_clnt);
- if (IS_ERR(pmap_clnt))
- goto bailout;
-
- status = -EIO;
- child = rpc_run_task(pmap_clnt, RPC_TASK_ASYNC, &pmap_getport_ops, map);
- if (IS_ERR(child))
- goto bailout;
- rpc_put_task(child);
-
- task->tk_xprt->stat.bind_count++;
- return;
-
-bailout:
- pmap_map_free(map);
- xprt_put(xprt);
-bailout_nofree:
- pmap_wake_portmap_waiters(xprt, status);
-bailout_nowake:
- task->tk_status = status;
-}
-
-#ifdef CONFIG_ROOT_NFS
-/**
- * rpc_getport_external - obtain the port for a given RPC service on a given host
- * @sin: address of remote peer
- * @prog: RPC program number to bind
- * @vers: RPC version number to bind
- * @prot: transport protocol to use to make this request
- *
- * This one is called from outside the RPC client in a synchronous task context.
- */
-int rpc_getport_external(struct sockaddr_in *sin, __u32 prog, __u32 vers, int prot)
-{
- struct portmap_args map = {
- .pm_prog = prog,
- .pm_vers = vers,
- .pm_prot = prot,
- .pm_port = 0
- };
- struct rpc_message msg = {
- .rpc_proc = &pmap_procedures[PMAP_GETPORT],
- .rpc_argp = &map,
- .rpc_resp = &map.pm_port,
- };
- struct rpc_clnt *pmap_clnt;
- char hostname[32];
- int status;
-
- dprintk("RPC: rpc_getport_external(%u.%u.%u.%u, %u, %u, %d)\n",
- NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);
-
- sprintf(hostname, "%u.%u.%u.%u", NIPQUAD(sin->sin_addr.s_addr));
- pmap_clnt = pmap_create(hostname, sin, prot, 0);
- if (IS_ERR(pmap_clnt))
- return PTR_ERR(pmap_clnt);
-
- /* Setup the call info struct */
- status = rpc_call_sync(pmap_clnt, &msg, 0);
-
- if (status >= 0) {
- if (map.pm_port != 0)
- return map.pm_port;
- status = -EACCES;
- }
- return status;
-}
-#endif
-
-/*
- * Portmapper child task invokes this callback via tk_exit.
- */
-static void pmap_getport_done(struct rpc_task *child, void *data)
-{
- struct portmap_args *map = data;
- struct rpc_xprt *xprt = map->pm_xprt;
- int status = child->tk_status;
-
- if (status < 0) {
- /* Portmapper not available */
- xprt->ops->set_port(xprt, 0);
- } else if (map->pm_port == 0) {
- /* Requested RPC service wasn't registered */
- xprt->ops->set_port(xprt, 0);
- status = -EACCES;
- } else {
- /* Succeeded */
- xprt->ops->set_port(xprt, map->pm_port);
- xprt_set_bound(xprt);
- status = 0;
- }
-
- dprintk("RPC: %5u pmap_getport_done(status %d, port %u)\n",
- child->tk_pid, status, map->pm_port);
-
- pmap_wake_portmap_waiters(xprt, status);
- xprt_put(xprt);
-}
-
-/**
- * rpc_register - set or unset a port registration with the local portmapper
- * @prog: RPC program number to bind
- * @vers: RPC version number to bind
- * @prot: transport protocol to use to make this request
- * @port: port value to register
- * @okay: result code
- *
- * port == 0 means unregister, port != 0 means register.
- */
-int rpc_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay)
-{
- struct sockaddr_in sin = {
- .sin_family = AF_INET,
- .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
- };
- struct portmap_args map = {
- .pm_prog = prog,
- .pm_vers = vers,
- .pm_prot = prot,
- .pm_port = port,
- };
- struct rpc_message msg = {
- .rpc_proc = &pmap_procedures[port ? PMAP_SET : PMAP_UNSET],
- .rpc_argp = &map,
- .rpc_resp = okay,
- };
- struct rpc_clnt *pmap_clnt;
- int error = 0;
-
- dprintk("RPC: registering (%u, %u, %d, %u) with portmapper.\n",
- prog, vers, prot, port);
-
- pmap_clnt = pmap_create("localhost", &sin, IPPROTO_UDP, 1);
- if (IS_ERR(pmap_clnt)) {
- error = PTR_ERR(pmap_clnt);
- dprintk("RPC: couldn't create pmap client. Error = %d\n",
- error);
- return error;
- }
-
- error = rpc_call_sync(pmap_clnt, &msg, 0);
-
- if (error < 0) {
- printk(KERN_WARNING
- "RPC: failed to contact portmap (errno %d).\n",
- error);
- }
- dprintk("RPC: registration status %d/%d\n", error, *okay);
-
- /* Client deleted automatically because cl_oneshot == 1 */
- return error;
-}
-
-static struct rpc_clnt *pmap_create(char *hostname, struct sockaddr_in *srvaddr, int proto, int privileged)
-{
- struct rpc_create_args args = {
- .protocol = proto,
- .address = (struct sockaddr *)srvaddr,
- .addrsize = sizeof(*srvaddr),
- .servername = hostname,
- .program = &pmap_program,
- .version = RPC_PMAP_VERSION,
- .authflavor = RPC_AUTH_UNIX,
- .flags = (RPC_CLNT_CREATE_ONESHOT |
- RPC_CLNT_CREATE_NOPING),
- };
-
- srvaddr->sin_port = htons(RPC_PMAP_PORT);
- if (!privileged)
- args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
- return rpc_create(&args);
-}
-
-/*
- * XDR encode/decode functions for PMAP
- */
-static int xdr_encode_mapping(struct rpc_rqst *req, __be32 *p, struct portmap_args *map)
-{
- dprintk("RPC: xdr_encode_mapping(%u, %u, %u, %u)\n",
- map->pm_prog, map->pm_vers,
- map->pm_prot, map->pm_port);
- *p++ = htonl(map->pm_prog);
- *p++ = htonl(map->pm_vers);
- *p++ = htonl(map->pm_prot);
- *p++ = htonl(map->pm_port);
-
- req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
- return 0;
-}
-
-static int xdr_decode_port(struct rpc_rqst *req, __be32 *p, unsigned short *portp)
-{
- *portp = (unsigned short) ntohl(*p++);
- return 0;
-}
-
-static int xdr_decode_bool(struct rpc_rqst *req, __be32 *p, unsigned int *boolp)
-{
- *boolp = (unsigned int) ntohl(*p++);
- return 0;
-}
-
-static struct rpc_procinfo pmap_procedures[] = {
-[PMAP_SET] = {
- .p_proc = PMAP_SET,
- .p_encode = (kxdrproc_t) xdr_encode_mapping,
- .p_decode = (kxdrproc_t) xdr_decode_bool,
- .p_bufsiz = 4,
- .p_count = 1,
- .p_statidx = PMAP_SET,
- .p_name = "SET",
- },
-[PMAP_UNSET] = {
- .p_proc = PMAP_UNSET,
- .p_encode = (kxdrproc_t) xdr_encode_mapping,
- .p_decode = (kxdrproc_t) xdr_decode_bool,
- .p_bufsiz = 4,
- .p_count = 1,
- .p_statidx = PMAP_UNSET,
- .p_name = "UNSET",
- },
-[PMAP_GETPORT] = {
- .p_proc = PMAP_GETPORT,
- .p_encode = (kxdrproc_t) xdr_encode_mapping,
- .p_decode = (kxdrproc_t) xdr_decode_port,
- .p_bufsiz = 4,
- .p_count = 1,
- .p_statidx = PMAP_GETPORT,
- .p_name = "GETPORT",
- },
-};
-
-static struct rpc_version pmap_version2 = {
- .number = 2,
- .nrprocs = 4,
- .procs = pmap_procedures
-};
-
-static struct rpc_version * pmap_version[] = {
- NULL,
- NULL,
- &pmap_version2
-};
-
-static struct rpc_stat pmap_stats;
-
-static struct rpc_program pmap_program = {
- .name = "portmap",
- .number = RPC_PMAP_PROGRAM,
- .nrvers = ARRAY_SIZE(pmap_version),
- .version = pmap_version,
- .stats = &pmap_stats,
-};
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
` (10 preceding siblings ...)
2007-01-18 23:30 ` [PATCH 11/14] SUNRPC: remove old portmapper Chuck Lever
@ 2007-01-18 23:30 ` Chuck Lever
2007-01-18 23:49 ` J. Bruce Fields
2007-01-19 22:36 ` Trond Myklebust
2007-01-18 23:30 ` [PATCH 13/14] NLM: Shrink the maximum request size of NLM4 requests Chuck Lever
2007-01-18 23:31 ` [PATCH 14/14] SUNRPC: Debugging aid Chuck Lever
13 siblings, 2 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:30 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
The RPC buffer size estimation logic in net/sunrpc/clnt.c always
significantly overestimates the requirements for the buffer size.
A little instrumentation demonstrated that in fact rpc_malloc was never
allocating the buffer from the mempool, but almost always called kmalloc.
To compute the size of the RPC buffer more precisely, split p_bufsiz into
two fields; one for the argument size, and one for the result size. The
goal is to keep the size requirement for RPC buffers at or below 2KiB.
So now we will compute the sum of the exact call and reply header sizes,
and split the RPC buffer precisely between the two. That should keep all
RPCs within the 2KiB buffer mempool limit.
And, we can finally be rid of RPC_SLACK_SPACE!
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/mon.c | 10 +++----
fs/lockd/xdr.c | 7 +----
fs/lockd/xdr4.c | 7 +----
fs/nfs/mount_clnt.c | 7 +++--
fs/nfs/nfs2xdr.c | 7 +----
fs/nfs/nfs3xdr.c | 13 ++++-----
fs/nfs/nfs4xdr.c | 7 +----
fs/nfsd/nfs4callback.c | 7 +----
include/linux/sunrpc/clnt.h | 3 +-
include/linux/sunrpc/xprt.h | 3 +-
net/sunrpc/clnt.c | 64 ++++++++++++++++++++++++-------------------
net/sunrpc/rpcb_clnt.c | 21 +++++++++-----
net/sunrpc/xprt.c | 4 +--
13 files changed, 81 insertions(+), 79 deletions(-)
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index eb243ed..2102e2d 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -225,16 +225,13 @@ #define SM_mon_sz (SM_mon_id_sz+4)
#define SM_monres_sz 2
#define SM_unmonres_sz 1
-#ifndef MAX
-# define MAX(a, b) (((a) > (b))? (a) : (b))
-#endif
-
static struct rpc_procinfo nsm_procedures[] = {
[SM_MON] = {
.p_proc = SM_MON,
.p_encode = (kxdrproc_t) xdr_encode_mon,
.p_decode = (kxdrproc_t) xdr_decode_stat_res,
- .p_bufsiz = MAX(SM_mon_sz, SM_monres_sz) << 2,
+ .p_arglen = SM_mon_sz,
+ .p_replen = SM_monres_sz,
.p_statidx = SM_MON,
.p_name = "MONITOR",
},
@@ -242,7 +239,8 @@ static struct rpc_procinfo nsm_procedure
.p_proc = SM_UNMON,
.p_encode = (kxdrproc_t) xdr_encode_unmon,
.p_decode = (kxdrproc_t) xdr_decode_stat,
- .p_bufsiz = MAX(SM_mon_id_sz, SM_unmonres_sz) << 2,
+ .p_arglen = SM_mon_id_sz,
+ .p_replen = SM_unmonres_sz,
.p_statidx = SM_UNMON,
.p_name = "UNMONITOR",
},
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index 34dae5d..75dd023 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -531,10 +531,6 @@ #define NLM_testres_sz NLM_cookie_sz+1+
#define NLM_res_sz NLM_cookie_sz+1
#define NLM_norep_sz 0
-#ifndef MAX
-# define MAX(a, b) (((a) > (b))? (a) : (b))
-#endif
-
/*
* For NLM, a void procedure really returns nothing
*/
@@ -545,7 +541,8 @@ #define PROC(proc, argtype, restype) \
.p_proc = NLMPROC_##proc, \
.p_encode = (kxdrproc_t) nlmclt_encode_##argtype, \
.p_decode = (kxdrproc_t) nlmclt_decode_##restype, \
- .p_bufsiz = MAX(NLM_##argtype##_sz, NLM_##restype##_sz) << 2, \
+ .p_arglen = NLM_##argtype##_sz, \
+ .p_replen = NLM_##restype##_sz, \
.p_statidx = NLMPROC_##proc, \
.p_name = #proc, \
}
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index a782405..d354f3f 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -537,10 +537,6 @@ #define NLM4_testres_sz NLM4_cookie_sz+
#define NLM4_res_sz NLM4_cookie_sz+1
#define NLM4_norep_sz 0
-#ifndef MAX
-# define MAX(a,b) (((a) > (b))? (a) : (b))
-#endif
-
/*
* For NLM, a void procedure really returns nothing
*/
@@ -551,7 +547,8 @@ #define PROC(proc, argtype, restype)
.p_proc = NLMPROC_##proc, \
.p_encode = (kxdrproc_t) nlm4clt_encode_##argtype, \
.p_decode = (kxdrproc_t) nlm4clt_decode_##restype, \
- .p_bufsiz = MAX(NLM4_##argtype##_sz, NLM4_##restype##_sz) << 2, \
+ .p_arglen = NLM4_##argtype##_sz, \
+ .p_replen = NLM4_##restype##_sz, \
.p_statidx = NLMPROC_##proc, \
.p_name = #proc, \
}
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index f75fe72..ca5a266 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -133,13 +133,15 @@ xdr_decode_fhstatus3(struct rpc_rqst *re
#define MNT_dirpath_sz (1 + 256)
#define MNT_fhstatus_sz (1 + 8)
+#define MNT_fhstatus3_sz (1 + 16)
static struct rpc_procinfo mnt_procedures[] = {
[MNTPROC_MNT] = {
.p_proc = MNTPROC_MNT,
.p_encode = (kxdrproc_t) xdr_encode_dirpath,
.p_decode = (kxdrproc_t) xdr_decode_fhstatus,
- .p_bufsiz = MNT_dirpath_sz << 2,
+ .p_arglen = MNT_dirpath_sz,
+ .p_replen = MNT_fhstatus_sz,
.p_statidx = MNTPROC_MNT,
.p_name = "MOUNT",
},
@@ -150,7 +152,8 @@ static struct rpc_procinfo mnt3_procedur
.p_proc = MOUNTPROC3_MNT,
.p_encode = (kxdrproc_t) xdr_encode_dirpath,
.p_decode = (kxdrproc_t) xdr_decode_fhstatus3,
- .p_bufsiz = MNT_dirpath_sz << 2,
+ .p_arglen = MNT_dirpath_sz,
+ .p_replen = MNT_fhstatus3_sz,
.p_statidx = MOUNTPROC3_MNT,
.p_name = "MOUNT",
},
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index 3be4e72..abd9f8b 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -687,16 +687,13 @@ nfs_stat_to_errno(int stat)
return nfs_errtbl[i].errno;
}
-#ifndef MAX
-# define MAX(a, b) (((a) > (b))? (a) : (b))
-#endif
-
#define PROC(proc, argtype, restype, timer) \
[NFSPROC_##proc] = { \
.p_proc = NFSPROC_##proc, \
.p_encode = (kxdrproc_t) nfs_xdr_##argtype, \
.p_decode = (kxdrproc_t) nfs_xdr_##restype, \
- .p_bufsiz = MAX(NFS_##argtype##_sz,NFS_##restype##_sz) << 2, \
+ .p_arglen = NFS_##argtype##_sz, \
+ .p_replen = NFS_##restype##_sz, \
.p_timer = timer, \
.p_statidx = NFSPROC_##proc, \
.p_name = #proc, \
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index 0ace092..b51df8e 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -1102,16 +1102,13 @@ nfs3_xdr_setaclres(struct rpc_rqst *req,
}
#endif /* CONFIG_NFS_V3_ACL */
-#ifndef MAX
-# define MAX(a, b) (((a) > (b))? (a) : (b))
-#endif
-
#define PROC(proc, argtype, restype, timer) \
[NFS3PROC_##proc] = { \
.p_proc = NFS3PROC_##proc, \
.p_encode = (kxdrproc_t) nfs3_xdr_##argtype, \
.p_decode = (kxdrproc_t) nfs3_xdr_##restype, \
- .p_bufsiz = MAX(NFS3_##argtype##_sz,NFS3_##restype##_sz) << 2, \
+ .p_arglen = NFS3_##argtype##_sz, \
+ .p_replen = NFS3_##restype##_sz, \
.p_timer = timer, \
.p_statidx = NFS3PROC_##proc, \
.p_name = #proc, \
@@ -1153,7 +1150,8 @@ static struct rpc_procinfo nfs3_acl_proc
.p_proc = ACLPROC3_GETACL,
.p_encode = (kxdrproc_t) nfs3_xdr_getaclargs,
.p_decode = (kxdrproc_t) nfs3_xdr_getaclres,
- .p_bufsiz = MAX(ACL3_getaclargs_sz, ACL3_getaclres_sz) << 2,
+ .p_arglen = ACL3_getaclargs_sz,
+ .p_replen = ACL3_getaclres_sz,
.p_timer = 1,
.p_name = "GETACL",
},
@@ -1161,7 +1159,8 @@ static struct rpc_procinfo nfs3_acl_proc
.p_proc = ACLPROC3_SETACL,
.p_encode = (kxdrproc_t) nfs3_xdr_setaclargs,
.p_decode = (kxdrproc_t) nfs3_xdr_setaclres,
- .p_bufsiz = MAX(ACL3_setaclargs_sz, ACL3_setaclres_sz) << 2,
+ .p_arglen = ACL3_setaclargs_sz,
+ .p_replen = ACL3_setaclres_sz,
.p_timer = 0,
.p_name = "SETACL",
},
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 0cf3fa3..198f1b5 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -4544,16 +4544,13 @@ nfs4_stat_to_errno(int stat)
return stat;
}
-#ifndef MAX
-# define MAX(a, b) (((a) > (b))? (a) : (b))
-#endif
-
#define PROC(proc, argtype, restype) \
[NFSPROC4_CLNT_##proc] = { \
.p_proc = NFSPROC4_COMPOUND, \
.p_encode = (kxdrproc_t) nfs4_xdr_##argtype, \
.p_decode = (kxdrproc_t) nfs4_xdr_##restype, \
- .p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \
+ .p_arglen = NFS4_##argtype##_sz, \
+ .p_replen = NFS4_##restype##_sz, \
.p_statidx = NFSPROC4_CLNT_##proc, \
.p_name = #proc, \
}
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index f57655a..69a721a 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -315,16 +315,13 @@ out:
/*
* RPC procedure tables
*/
-#ifndef MAX
-# define MAX(a, b) (((a) > (b))? (a) : (b))
-#endif
-
#define PROC(proc, call, argtype, restype) \
[NFSPROC4_CLNT_##proc] = { \
.p_proc = NFSPROC4_CB_##call, \
.p_encode = (kxdrproc_t) nfs4_xdr_##argtype, \
.p_decode = (kxdrproc_t) nfs4_xdr_##restype, \
- .p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \
+ .p_arglen = NFS4_##argtype##_sz, \
+ .p_replen = NFS4_##restype##_sz, \
.p_statidx = NFSPROC4_CB_##call, \
.p_name = #proc, \
}
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index c78b913..5a8f9c2 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -83,7 +83,8 @@ struct rpc_procinfo {
u32 p_proc; /* RPC procedure number */
kxdrproc_t p_encode; /* XDR encode function */
kxdrproc_t p_decode; /* XDR decode function */
- unsigned int p_bufsiz; /* req. buffer size */
+ unsigned int p_arglen; /* argument hdr length (u32) */
+ unsigned int p_replen; /* reply hdr length (u32) */
unsigned int p_count; /* call count */
unsigned int p_timer; /* Which RTT timer to use */
u32 p_statidx; /* Which procedure to account */
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 6c035cb..192b74d 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -84,7 +84,8 @@ struct rpc_rqst {
struct list_head rq_list;
__u32 * rq_buffer; /* XDR encode buffer */
- size_t rq_bufsize;
+ size_t rq_callsize,
+ rq_rcvsize;
struct xdr_buf rq_private_buf; /* The receive buffer
* used in the softirq.
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 493b950..eafe045 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -36,8 +36,6 @@ #include <linux/sunrpc/rpc_pipe_fs.h>
#include <linux/sunrpc/metrics.h>
-#define RPC_SLACK_SPACE (1024) /* total overkill */
-
#ifdef RPC_DEBUG
# define RPCDBG_FACILITY RPCDBG_CALL
#endif
@@ -753,23 +751,33 @@ call_allocate(struct rpc_task *task)
{
struct rpc_rqst *req = task->tk_rqstp;
struct rpc_xprt *xprt = task->tk_xprt;
- unsigned int bufsiz;
dprint_status(task);
+ task->tk_status = 0;
task->tk_action = call_bind;
+
if (req->rq_buffer)
return;
- /* FIXME: compute buffer requirements more exactly using
- * auth->au_wslack */
- bufsiz = task->tk_msg.rpc_proc->p_bufsiz + RPC_SLACK_SPACE;
-
- req->rq_buffer = xprt->ops->buf_alloc(task, bufsiz << 1);
- if (req->rq_buffer != NULL) {
- req->rq_bufsize = bufsiz;
+ /*
+ * Calculate the size (in quads) of the RPC call
+ * and reply headers, and convert both values
+ * to byte sizes.
+ */
+ req->rq_callsize = RPC_CALLHDRSIZE +
+ (task->tk_auth->au_cslack << 1) +
+ task->tk_msg.rpc_proc->p_arglen;
+ req->rq_callsize <<= 2;
+ req->rq_rcvsize = RPC_REPHDRSIZE +
+ task->tk_auth->au_cslack +
+ task->tk_msg.rpc_proc->p_replen;
+ req->rq_rcvsize <<= 2;
+
+ req->rq_buffer = xprt->ops->buf_alloc(task,
+ req->rq_callsize + req->rq_rcvsize);
+ if (req->rq_buffer != NULL)
return;
- }
dprintk("RPC: %5u rpc_buffer allocation failed\n", task->tk_pid);
@@ -795,6 +803,17 @@ rpc_task_force_reencode(struct rpc_task
task->tk_rqstp->rq_snd_buf.len = 0;
}
+static inline void
+rpc_xdr_buf_init(struct xdr_buf *buf, void *start, size_t len)
+{
+ buf->head[0].iov_base = start;
+ buf->head[0].iov_len = len;
+ buf->tail[0].iov_len = 0;
+ buf->page_len = 0;
+ buf->len = 0;
+ buf->buflen = len;
+}
+
/*
* 3. Encode arguments of an RPC call
*/
@@ -802,28 +821,17 @@ static void
call_encode(struct rpc_task *task)
{
struct rpc_rqst *req = task->tk_rqstp;
- struct xdr_buf *sndbuf = &req->rq_snd_buf;
- struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
- unsigned int bufsiz;
kxdrproc_t encode;
__be32 *p;
dprint_status(task);
- /* Default buffer setup */
- bufsiz = req->rq_bufsize >> 1;
- sndbuf->head[0].iov_base = (void *)req->rq_buffer;
- sndbuf->head[0].iov_len = bufsiz;
- sndbuf->tail[0].iov_len = 0;
- sndbuf->page_len = 0;
- sndbuf->len = 0;
- sndbuf->buflen = bufsiz;
- rcvbuf->head[0].iov_base = (void *)((char *)req->rq_buffer + bufsiz);
- rcvbuf->head[0].iov_len = bufsiz;
- rcvbuf->tail[0].iov_len = 0;
- rcvbuf->page_len = 0;
- rcvbuf->len = 0;
- rcvbuf->buflen = bufsiz;
+ rpc_xdr_buf_init(&req->rq_snd_buf,
+ req->rq_buffer,
+ req->rq_callsize);
+ rpc_xdr_buf_init(&req->rq_rcv_buf,
+ (char *)req->rq_buffer + req->rq_callsize,
+ req->rq_rcvsize);
/* Encode header and provided arguments */
encode = task->tk_msg.rpc_proc->p_encode;
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 8f3e133..5a44079 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -438,21 +438,24 @@ static struct rpc_procinfo rpcb_procedur
.p_proc = RPCB_SET,
.p_encode = (kxdrproc_t) xdr_encode_mapping,
.p_decode = (kxdrproc_t) xdr_decode_set,
- .p_bufsiz = 4,
+ .p_arglen = 4,
+ .p_replen = 1,
.p_count = 1,
},
[RPCB_UNSET] = {
.p_proc = RPCB_UNSET,
.p_encode = (kxdrproc_t) xdr_encode_mapping,
.p_decode = (kxdrproc_t) xdr_decode_set,
- .p_bufsiz = 4,
+ .p_arglen = 4,
+ .p_replen = 1,
.p_count = 1,
},
[RPCB_GETADDR] = {
.p_proc = RPCB_GETPORT,
.p_encode = (kxdrproc_t) xdr_encode_mapping,
.p_decode = (kxdrproc_t) xdr_decode_getport,
- .p_bufsiz = 4,
+ .p_arglen = 4,
+ .p_replen = 1,
.p_count = 1,
},
};
@@ -462,21 +465,24 @@ static struct rpc_procinfo rpcb_procedur
.p_proc = RPCB_SET,
.p_encode = (kxdrproc_t) xdr_encode_mapping,
.p_decode = (kxdrproc_t) xdr_decode_set,
- .p_bufsiz = 4,
+ .p_arglen = 4,
+ .p_replen = 1,
.p_count = 1,
},
[RPCB_UNSET] = {
.p_proc = RPCB_UNSET,
.p_encode = (kxdrproc_t) xdr_encode_mapping,
.p_decode = (kxdrproc_t) xdr_decode_set,
- .p_bufsiz = 4,
+ .p_arglen = 4,
+ .p_replen = 1,
.p_count = 1,
},
[RPCB_GETADDR] = {
.p_proc = RPCB_GETADDR,
.p_encode = (kxdrproc_t) xdr_encode_getaddr,
.p_decode = (kxdrproc_t) xdr_decode_getaddr,
- .p_bufsiz = 36,
+ .p_arglen = 36,
+ .p_replen = 33,
.p_count = 1,
},
};
@@ -486,7 +492,8 @@ static struct rpc_procinfo rpcb_procedur
.p_proc = RPCB_GETVERSADDR,
.p_encode = (kxdrproc_t) xdr_encode_getaddr,
.p_decode = (kxdrproc_t) xdr_decode_getaddr,
- .p_bufsiz = 36,
+ .p_arglen = 36,
+ .p_replen = 33,
.p_count = 1,
},
};
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 86181ac..7725d63 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -823,7 +823,6 @@ static void xprt_request_init(struct rpc
req->rq_task = task;
req->rq_xprt = xprt;
req->rq_buffer = NULL;
- req->rq_bufsize = 0;
req->rq_xid = xprt_alloc_xid(xprt);
req->rq_release_snd_buf = NULL;
xprt_reset_majortimeo(req);
@@ -855,7 +854,8 @@ void xprt_release(struct rpc_task *task)
mod_timer(&xprt->timer,
xprt->last_used + xprt->idle_timeout);
spin_unlock_bh(&xprt->transport_lock);
- xprt->ops->buf_free(task, req->rq_buffer, req->rq_bufsize);
+ xprt->ops->buf_free(task, req->rq_buffer,
+ req->rq_callsize + req->rq_rcvsize);
task->tk_rqstp = NULL;
if (req->rq_release_snd_buf)
req->rq_release_snd_buf(req);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 13/14] NLM: Shrink the maximum request size of NLM4 requests
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
` (11 preceding siblings ...)
2007-01-18 23:30 ` [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large Chuck Lever
@ 2007-01-18 23:30 ` Chuck Lever
2007-01-19 0:13 ` Christoph Hellwig
2007-01-18 23:31 ` [PATCH 14/14] SUNRPC: Debugging aid Chuck Lever
13 siblings, 1 reply; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:30 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
NLM version 4 requests estimate the call and reply header sizes rather
conservatively, using the very maximum size allowed in the protocol even
though Linux always uses only a small fraction of the allowable space.
Reduce the size of caller and lock arguments to conserve RPC buffer space
while XDR encoding NLM4 arguments..
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/xdr.c | 13 +++++++++----
fs/lockd/xdr4.c | 16 +++++++++++-----
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index 75dd023..55796c3 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -510,17 +510,22 @@ nlmclt_decode_res(struct rpc_rqst *req,
return 0;
}
+#ifndef MIN
+# define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+
/*
* Buffer requirements for NLM
*/
#define NLM_void_sz 0
#define NLM_cookie_sz 1+XDR_QUADLEN(NLM_MAXCOOKIELEN)
#define NLM_caller_sz 1+XDR_QUADLEN(sizeof(utsname()->nodename))
-#define NLM_netobj_sz 1+XDR_QUADLEN(XDR_MAX_NETOBJ)
-/* #define NLM_owner_sz 1+XDR_QUADLEN(NLM_MAXOWNER) */
+/* #define NLM_netobj_sz 1+XDR_QUADLEN(XDR_MAX_NETOBJ) */
+#define NLM_owner_sz 1+XDR_QUADLEN(MIN((XDR_MAX_NETOBJ), \
+ NLMCLNT_OHSIZE))
#define NLM_fhandle_sz 1+XDR_QUADLEN(NFS2_FHSIZE)
-#define NLM_lock_sz 3+NLM_caller_sz+NLM_netobj_sz+NLM_fhandle_sz
-#define NLM_holder_sz 4+NLM_netobj_sz
+#define NLM_lock_sz 3+NLM_caller_sz+NLM_owner_sz+NLM_fhandle_sz
+#define NLM_holder_sz 4+NLM_owner_sz
#define NLM_testargs_sz NLM_cookie_sz+1+NLM_lock_sz
#define NLM_lockargs_sz NLM_cookie_sz+4+NLM_lock_sz
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index d354f3f..88c18a8 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -516,17 +516,23 @@ nlm4clt_decode_res(struct rpc_rqst *req,
return 0;
}
+#ifndef MIN
+# define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+
/*
* Buffer requirements for NLM
*/
#define NLM4_void_sz 0
#define NLM4_cookie_sz 1+XDR_QUADLEN(NLM_MAXCOOKIELEN)
-#define NLM4_caller_sz 1+XDR_QUADLEN(NLM_MAXSTRLEN)
-#define NLM4_netobj_sz 1+XDR_QUADLEN(XDR_MAX_NETOBJ)
-/* #define NLM4_owner_sz 1+XDR_QUADLEN(NLM4_MAXOWNER) */
+#define NLM4_caller_sz 1+XDR_QUADLEN(MIN((NLM_MAXSTRLEN), \
+ NLMCLNT_OHSIZE))
+/* #define NLM4_netobj_sz 1+XDR_QUADLEN(XDR_MAX_NETOBJ) */
+#define NLM4_owner_sz 1+XDR_QUADLEN(MIN((XDR_MAX_NETOBJ), \
+ NLMCLNT_OHSIZE))
#define NLM4_fhandle_sz 1+XDR_QUADLEN(NFS3_FHSIZE)
-#define NLM4_lock_sz 5+NLM4_caller_sz+NLM4_netobj_sz+NLM4_fhandle_sz
-#define NLM4_holder_sz 6+NLM4_netobj_sz
+#define NLM4_lock_sz 5+NLM4_caller_sz+NLM4_owner_sz+NLM4_fhandle_sz
+#define NLM4_holder_sz 6+NLM4_owner_sz
#define NLM4_testargs_sz NLM4_cookie_sz+1+NLM4_lock_sz
#define NLM4_lockargs_sz NLM4_cookie_sz+4+NLM4_lock_sz
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 14/14] SUNRPC: Debugging aid
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
` (12 preceding siblings ...)
2007-01-18 23:30 ` [PATCH 13/14] NLM: Shrink the maximum request size of NLM4 requests Chuck Lever
@ 2007-01-18 23:31 ` Chuck Lever
2007-01-19 22:28 ` Trond Myklebust
13 siblings, 1 reply; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:31 UTC (permalink / raw)
To: trond.myklybust; +Cc: nfs
Add helper functions for tracking the current FSM state for each RPC task.
The FSM state name is now displayed in rpc_show_task instead of the
absolute address of the FSM function.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
include/linux/sunrpc/sched.h | 13 ++++++++++++-
net/sunrpc/clnt.c | 35 ++++++++++++++++++++++++++++++++++-
net/sunrpc/sched.c | 11 ++++++++---
3 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 88e6e39..7732e80 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -95,7 +95,8 @@ #endif
long tk_rtt; /* round-trip time (jiffies) */
#ifdef RPC_DEBUG
- unsigned short tk_pid; /* debugging aid */
+ unsigned short tk_pid;
+ const char * tk_action_name;
#endif
};
#define tk_auth tk_client->cl_auth
@@ -292,6 +293,16 @@ static inline const char * rpc_qname(str
{
return ((q && q->name) ? q->name : "unknown");
}
+
+#define __rpc_new_task_state(t, n) \
+ do { \
+ t->tk_action_name = n ; \
+ } while (0)
+#else
+#define __rpc_new_task_state(t, n) do { } while (0)
#endif
+#define rpc_new_task_state() \
+ __rpc_new_task_state(task, __FUNCTION__)
+
#endif /* _LINUX_SUNRPC_SCHED_H_ */
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index eafe045..f4d2bc6 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -42,7 +42,7 @@ #endif
#define dprint_status(t) \
dprintk("RPC: %5u %s (status %d)\n", t->tk_pid, \
- __FUNCTION__, t->tk_status)
+ __FUNCTION__, t->tk_status) \
static DECLARE_WAIT_QUEUE_HEAD(destroy_wait);
@@ -552,6 +552,8 @@ out_release:
void
rpc_call_setup(struct rpc_task *task, struct rpc_message *msg, int flags)
{
+ rpc_new_task_state();
+
task->tk_msg = *msg;
task->tk_flags |= flags;
/* Bind the user cred */
@@ -662,6 +664,8 @@ call_start(struct rpc_task *task)
{
struct rpc_clnt *clnt = task->tk_client;
+ rpc_new_task_state();
+
dprintk("RPC: %5u call_start %s%d proc %d (%s)\n", task->tk_pid,
clnt->cl_protname, clnt->cl_vers,
task->tk_msg.rpc_proc->p_proc,
@@ -679,6 +683,8 @@ call_start(struct rpc_task *task)
static void
call_reserve(struct rpc_task *task)
{
+ rpc_new_task_state();
+
dprint_status(task);
if (!rpcauth_uptodatecred(task)) {
@@ -699,6 +705,8 @@ call_reserveresult(struct rpc_task *task
{
int status = task->tk_status;
+ rpc_new_task_state();
+
dprint_status(task);
/*
@@ -752,6 +760,8 @@ call_allocate(struct rpc_task *task)
struct rpc_rqst *req = task->tk_rqstp;
struct rpc_xprt *xprt = task->tk_xprt;
+ rpc_new_task_state();
+
dprint_status(task);
task->tk_status = 0;
@@ -862,6 +872,8 @@ call_bind(struct rpc_task *task)
{
struct rpc_xprt *xprt = task->tk_xprt;
+ rpc_new_task_state();
+
dprint_status(task);
task->tk_action = call_connect;
@@ -880,6 +892,8 @@ call_bind_status(struct rpc_task *task)
{
int status = -EACCES;
+ rpc_new_task_state();
+
if (task->tk_status >= 0) {
dprint_status(task);
task->tk_status = 0;
@@ -928,6 +942,8 @@ call_connect(struct rpc_task *task)
{
struct rpc_xprt *xprt = task->tk_xprt;
+ rpc_new_task_state();
+
dprintk("RPC: %5u call_connect xprt %p %s connected\n",
task->tk_pid, xprt,
(xprt_connected(xprt) ? "is" : "is not"));
@@ -950,6 +966,8 @@ call_connect_status(struct rpc_task *tas
struct rpc_clnt *clnt = task->tk_client;
int status = task->tk_status;
+ rpc_new_task_state();
+
dprint_status(task);
task->tk_status = 0;
@@ -982,6 +1000,8 @@ call_connect_status(struct rpc_task *tas
static void
call_transmit(struct rpc_task *task)
{
+ rpc_new_task_state();
+
dprint_status(task);
task->tk_action = call_status;
@@ -1019,7 +1039,10 @@ call_transmit(struct rpc_task *task)
static void
call_transmit_status(struct rpc_task *task)
{
+ rpc_new_task_state();
+
task->tk_action = call_status;
+
/*
* Special case: if we've been waiting on the socket's write_space()
* callback, then don't call xprt_end_transmit().
@@ -1040,6 +1063,8 @@ call_status(struct rpc_task *task)
struct rpc_rqst *req = task->tk_rqstp;
int status;
+ rpc_new_task_state();
+
if (req->rq_received > 0 && !req->rq_bytes_sent)
task->tk_status = req->rq_received;
@@ -1093,6 +1118,8 @@ call_timeout(struct rpc_task *task)
{
struct rpc_clnt *clnt = task->tk_client;
+ rpc_new_task_state();
+
if (xprt_adjust_timeout(task->tk_rqstp) == 0) {
dprintk("RPC: %5u call_timeout (minor)\n", task->tk_pid);
goto retry;
@@ -1132,6 +1159,8 @@ call_decode(struct rpc_task *task)
kxdrproc_t decode = task->tk_msg.rpc_proc->p_decode;
__be32 *p;
+ rpc_new_task_state();
+
dprintk("RPC: %5u call_decode (status %d)\n",
task->tk_pid, task->tk_status);
@@ -1194,6 +1223,8 @@ out_retry:
static void
call_refresh(struct rpc_task *task)
{
+ rpc_new_task_state();
+
dprint_status(task);
xprt_release(task); /* Must do to obtain new XID */
@@ -1211,6 +1242,8 @@ call_refreshresult(struct rpc_task *task
{
int status = task->tk_status;
+ rpc_new_task_state();
+
dprint_status(task);
task->tk_status = 0;
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index c689196..b712317 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -590,6 +590,8 @@ void rpc_delay(struct rpc_task *task, un
*/
static void rpc_prepare_task(struct rpc_task *task)
{
+ rpc_new_task_state();
+
lock_kernel();
task->tk_ops->rpc_call_prepare(task, task->tk_calldata);
unlock_kernel();
@@ -602,6 +604,7 @@ void rpc_exit_task(struct rpc_task *task
{
task->tk_action = NULL;
if (task->tk_ops->rpc_call_done != NULL) {
+ rpc_new_task_state();
lock_kernel();
task->tk_ops->rpc_call_done(task, task->tk_calldata);
unlock_kernel();
@@ -611,6 +614,7 @@ void rpc_exit_task(struct rpc_task *task
xprt_release(task);
}
}
+ __rpc_new_task_state(task, "done");
}
EXPORT_SYMBOL(rpc_exit_task);
@@ -785,6 +789,7 @@ void rpc_free(struct rpc_task *task, voi
void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, int flags, const struct rpc_call_ops *tk_ops, void *calldata)
{
memset(task, 0, sizeof(*task));
+ rpc_new_task_state();
init_timer(&task->tk_timer);
task->tk_timer.data = (unsigned long) task;
task->tk_timer.function = (void (*)(unsigned long)) rpc_run_timer;
@@ -1059,14 +1064,14 @@ void rpc_show_tasks(void)
return;
}
printk("-pid- proc flgs status -client- -prog- --rqstp- -timeout "
- "-rpcwait -action- ---ops--\n");
+ "---rpcwait-- ---ops-- -----action----- \n");
alltask_for_each(t, le, &all_tasks) {
const char *rpc_waitq = "none";
if (RPC_IS_QUEUED(t))
rpc_waitq = rpc_qname(t->u.tk_wait.rpc_waitq);
- printk("%5u %04d %04x %6d %8p %6d %8p %8ld %8s %8p %8p\n",
+ printk("%5u %04d %04x %6d %8p %6d %8p %8ld %12.12s %8p %16.16s\n",
t->tk_pid,
(t->tk_msg.rpc_proc ? t->tk_msg.rpc_proc->p_proc : -1),
t->tk_flags, t->tk_status,
@@ -1074,7 +1079,7 @@ void rpc_show_tasks(void)
(t->tk_client ? t->tk_client->cl_prog : 0),
t->tk_rqstp, t->tk_timeout,
rpc_waitq,
- t->tk_action, t->tk_ops);
+ t->tk_ops, t->tk_action_name);
}
spin_unlock(&rpc_sched_lock);
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large
2007-01-18 23:30 ` [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large Chuck Lever
@ 2007-01-18 23:49 ` J. Bruce Fields
2007-01-18 23:54 ` Chuck Lever
2007-01-19 22:36 ` Trond Myklebust
1 sibling, 1 reply; 35+ messages in thread
From: J. Bruce Fields @ 2007-01-18 23:49 UTC (permalink / raw)
To: Chuck Lever; +Cc: trond.myklybust, nfs
On Thu, Jan 18, 2007 at 06:30:53PM -0500, Chuck Lever wrote:
> The RPC buffer size estimation logic in net/sunrpc/clnt.c always
> significantly overestimates the requirements for the buffer size.
> A little instrumentation demonstrated that in fact rpc_malloc was never
> allocating the buffer from the mempool, but almost always called kmalloc.
>
> To compute the size of the RPC buffer more precisely, split p_bufsiz into
> two fields; one for the argument size, and one for the result size. The
> goal is to keep the size requirement for RPC buffers at or below 2KiB.
>
> So now we will compute the sum of the exact call and reply header sizes,
> and split the RPC buffer precisely between the two. That should keep all
> RPCs within the 2KiB buffer mempool limit.
>
> And, we can finally be rid of RPC_SLACK_SPACE!
I'm a little worried about krb5, and especially the integrity and
privacy code--I don't think this accounts for the space they need.
I'm not sure how best to estimate their requirements....
--b.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large
2007-01-18 23:49 ` J. Bruce Fields
@ 2007-01-18 23:54 ` Chuck Lever
2007-01-19 0:00 ` J. Bruce Fields
0 siblings, 1 reply; 35+ messages in thread
From: Chuck Lever @ 2007-01-18 23:54 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: trond.myklybust, nfs
[-- Attachment #1: Type: text/plain, Size: 1227 bytes --]
J. Bruce Fields wrote:
> On Thu, Jan 18, 2007 at 06:30:53PM -0500, Chuck Lever wrote:
>> The RPC buffer size estimation logic in net/sunrpc/clnt.c always
>> significantly overestimates the requirements for the buffer size.
>> A little instrumentation demonstrated that in fact rpc_malloc was never
>> allocating the buffer from the mempool, but almost always called kmalloc.
>>
>> To compute the size of the RPC buffer more precisely, split p_bufsiz into
>> two fields; one for the argument size, and one for the result size. The
>> goal is to keep the size requirement for RPC buffers at or below 2KiB.
>>
>> So now we will compute the sum of the exact call and reply header sizes,
>> and split the RPC buffer precisely between the two. That should keep all
>> RPCs within the 2KiB buffer mempool limit.
>>
>> And, we can finally be rid of RPC_SLACK_SPACE!
>
> I'm a little worried about krb5, and especially the integrity and
> privacy code--I don't think this accounts for the space they need.
>
> I'm not sure how best to estimate their requirements....
If the RPC header field size definitions are correct, the verifiers are
defined as 400 bytes (100 quads). There should be room enough for the
largest verifiers.
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 265 bytes --]
begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture Linux Projects Group
email;internet:chuck dot lever at nospam oracle dot com
title:Principle Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large
2007-01-18 23:54 ` Chuck Lever
@ 2007-01-19 0:00 ` J. Bruce Fields
2007-01-19 0:08 ` Chuck Lever
0 siblings, 1 reply; 35+ messages in thread
From: J. Bruce Fields @ 2007-01-19 0:00 UTC (permalink / raw)
To: Chuck Lever; +Cc: trond.myklybust, nfs
On Thu, Jan 18, 2007 at 06:54:48PM -0500, Chuck Lever wrote:
> J. Bruce Fields wrote:
> >I'm a little worried about krb5, and especially the integrity and
> >privacy code--I don't think this accounts for the space they need.
> >
> >I'm not sure how best to estimate their requirements....
>
> If the RPC header field size definitions are correct, the verifiers are
> defined as 400 bytes (100 quads). There should be room enough for the
> largest verifiers.
OK, so your code always assumes the worst case for the verifier?
The problem is that integrity protection also adds another 8 bytes
(length and sequence number) to the body of each rpc, and privacy in
addition adds some variable amount of mechanism-specific encryption
overhead (a few tens of bytes for krb5, I think).
But if you're always allowing 400 bytes for the verifier then in
practice we're not going to have any problems with the current
mechanisms.
--b.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 01/14] NFS: fix print format for tk_pid
2007-01-18 23:29 ` [PATCH 01/14] NFS: fix print format for tk_pid Chuck Lever
@ 2007-01-19 0:03 ` Christoph Hellwig
2007-01-19 0:10 ` Chuck Lever
0 siblings, 1 reply; 35+ messages in thread
From: Christoph Hellwig @ 2007-01-19 0:03 UTC (permalink / raw)
To: Chuck Lever; +Cc: trond.myklybust, nfs
On Thu, Jan 18, 2007 at 06:29:27PM -0500, Chuck Lever wrote:
> The tk_pid field is an unsigned short. The proper print format specifier for
> that type is %5u, not %4d.
>
> Also clean up some miscellaneous print formatting nits.
Once you cleanup all these printks please make sure to add line breaks
after at most 80 characters.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large
2007-01-19 0:00 ` J. Bruce Fields
@ 2007-01-19 0:08 ` Chuck Lever
0 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-19 0:08 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: trond.myklybust, nfs
[-- Attachment #1: Type: text/plain, Size: 755 bytes --]
J. Bruce Fields wrote:
> The problem is that integrity protection also adds another 8 bytes
> (length and sequence number) to the body of each rpc, and privacy in
> addition adds some variable amount of mechanism-specific encryption
> overhead (a few tens of bytes for krb5, I think).
tk_auth->au_cslack should account for this, right? It should provide
the largest number of bytes that could be required for the send and
receive buffers.
> But if you're always allowing 400 bytes for the verifier then in
> practice we're not going to have any problems with the current
> mechanisms.
In practice, yes. I would prefer we get this as right as possible now,
so we don't get bitten by it when someone invents a GSS flavor that
needs huge verifiers.
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 265 bytes --]
begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture Linux Projects Group
email;internet:chuck dot lever at nospam oracle dot com
title:Principle Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 06/14] SUNRPC: introduce rpcbind: replacement for in-kernel portmapper
2007-01-18 23:30 ` [PATCH 06/14] SUNRPC: introduce rpcbind: replacement for in-kernel portmapper Chuck Lever
@ 2007-01-19 0:09 ` Christoph Hellwig
2007-01-19 21:54 ` Chuck Lever
0 siblings, 1 reply; 35+ messages in thread
From: Christoph Hellwig @ 2007-01-19 0:09 UTC (permalink / raw)
To: Chuck Lever; +Cc: trond.myklybust, nfs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 1407 bytes --]
On Thu, Jan 18, 2007 at 06:30:12PM -0500, Chuck Lever wrote:
> Introduce a replacement for the in-kernel portmapper client that supports
> all 3 versions of the rpcbind protocol. This code is not used yet.
>
> Original code by Groupe Bull updated for the latest kernel, with multiple
> bug fixes.
>
> Note that rpcb_clnt.c does not yet support registering via versions 3 and
> 4 of the rpcbind protocol.
I don't quite like the way you introduce rcpbind. It exports the same
API as the old portmap service, just using the rpcb_ prefix instead
of rpc_. Why don't you transparæntly switch over the implementation to
the new model?
More comments on the actual code:
> --- /dev/null
> +++ b/net/sunrpc/rpcb_clnt.c
> @@ -0,0 +1,539 @@
> +/*
> + * linux/net/sunrpc/rpcb_clnt.c
Please don't mention the filename in the top of file comment. It's useless
and even worse easily gets out of sync and confuses people then.
> +static inline struct rpcbind_args *rpcb_map_alloc(void)
> +{
> + return kzalloc(sizeof(struct rpcbind_args), GFP_ATOMIC);
> +}
> +
> +static inline void rpcb_map_free(struct rpcbind_args *map)
> +{
> + kfree(map);
> +}
Please kill these useless wrappers.
> +static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, int proto, int version, int privileged)
Please make sure to properly break lines after 80 chars.
[-- Attachment #2: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #3: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 01/14] NFS: fix print format for tk_pid
2007-01-19 0:03 ` Christoph Hellwig
@ 2007-01-19 0:10 ` Chuck Lever
0 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-19 0:10 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: trond.myklybust, nfs
[-- Attachment #1: Type: text/plain, Size: 505 bytes --]
Christoph Hellwig wrote:
> On Thu, Jan 18, 2007 at 06:29:27PM -0500, Chuck Lever wrote:
>> The tk_pid field is an unsigned short. The proper print format specifier for
>> that type is %5u, not %4d.
>>
>> Also clean up some miscellaneous print formatting nits.
>
> Once you cleanup all these printks please make sure to add line breaks
> after at most 80 characters.
For the record, I think I was careful to do this, but I don't have a
neat little tool like Neil does to verify line length explicitly.
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 265 bytes --]
begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture Linux Projects Group
email;internet:chuck dot lever at nospam oracle dot com
title:Principle Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 10/14] SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options
2007-01-18 23:30 ` [PATCH 10/14] SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options Chuck Lever
@ 2007-01-19 0:11 ` Christoph Hellwig
2007-01-19 22:04 ` Chuck Lever
0 siblings, 1 reply; 35+ messages in thread
From: Christoph Hellwig @ 2007-01-19 0:11 UTC (permalink / raw)
To: Chuck Lever; +Cc: trond.myklybust, nfs
> +config RPCBIND_VERSION3
> + bool "Support for rpcbind version 3"
> + default n
default n is the default behaviour, you don't need to specify it.
> +config RPCBIND_VERSION4
> + bool "Support for rpcbind version 4"
Do we really need two config options for this?
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 13/14] NLM: Shrink the maximum request size of NLM4 requests
2007-01-18 23:30 ` [PATCH 13/14] NLM: Shrink the maximum request size of NLM4 requests Chuck Lever
@ 2007-01-19 0:13 ` Christoph Hellwig
2007-01-19 22:27 ` Chuck Lever
0 siblings, 1 reply; 35+ messages in thread
From: Christoph Hellwig @ 2007-01-19 0:13 UTC (permalink / raw)
To: Chuck Lever; +Cc: trond.myklybust, nfs
On Thu, Jan 18, 2007 at 06:30:56PM -0500, Chuck Lever wrote:
> NLM version 4 requests estimate the call and reply header sizes rather
> conservatively, using the very maximum size allowed in the protocol even
> though Linux always uses only a small fraction of the allowable space.
>
> Reduce the size of caller and lock arguments to conserve RPC buffer space
> while XDR encoding NLM4 arguments..
> +#ifndef MIN
> +# define MIN(a, b) (((a) < (b)) ? (a) : (b))
> +#endif
please use the kernel min or min_t macros instead.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 06/14] SUNRPC: introduce rpcbind: replacement for in-kernel portmapper
2007-01-19 0:09 ` Christoph Hellwig
@ 2007-01-19 21:54 ` Chuck Lever
0 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-19 21:54 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: trond.myklybust, nfs
[-- Attachment #1: Type: text/plain, Size: 2218 bytes --]
Christoph Hellwig wrote:
> On Thu, Jan 18, 2007 at 06:30:12PM -0500, Chuck Lever wrote:
>> Introduce a replacement for the in-kernel portmapper client that supports
>> all 3 versions of the rpcbind protocol. This code is not used yet.
>>
>> Original code by Groupe Bull updated for the latest kernel, with multiple
>> bug fixes.
>>
>> Note that rpcb_clnt.c does not yet support registering via versions 3 and
>> 4 of the rpcbind protocol.
>
> I don't quite like the way you introduce rcpbind. It exports the same
> API as the old portmap service, just using the rpcb_ prefix instead
> of rpc_. Why don't you transpar�ntly switch over the implementation to
> the new model?
Using a different name means both the old and new implementation can
coexist in the kernel until we're sure the new one is working correctly.
This is a widely-used change management technique.
In addition, the new naming echoes the API naming scheme used in user space.
> More comments on the actual code:
>
>> --- /dev/null
>> +++ b/net/sunrpc/rpcb_clnt.c
>> @@ -0,0 +1,539 @@
>> +/*
>> + * linux/net/sunrpc/rpcb_clnt.c
>
> Please don't mention the filename in the top of file comment. It's useless
> and even worse easily gets out of sync and confuses people then.
Done.
>> +static inline struct rpcbind_args *rpcb_map_alloc(void)
>> +{
>> + return kzalloc(sizeof(struct rpcbind_args), GFP_ATOMIC);
>> +}
>> +
>> +static inline void rpcb_map_free(struct rpcbind_args *map)
>> +{
>> + kfree(map);
>> +}
>
> Please kill these useless wrappers.
I don't agree that these are useless. This is a common defensive
programming technique that is used throughout the Linux NFS and RPC
implementation. Placing these two functions next to each other
documents in 9 lines of code which memory pool is used for rpcb_maps,
and ensures that if the memory pool is changed, every instance of
allocation and release is affected. It also enforces the pointer types
automatically.
>> +static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, int proto, int version, int privileged)
>
> Please make sure to properly break lines after 80 chars.
Done.
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 276 bytes --]
begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture Linux Projects Group
email;internet:chuck dot lever at nospam oracle dot com
title:Principle Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 10/14] SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options
2007-01-19 0:11 ` Christoph Hellwig
@ 2007-01-19 22:04 ` Chuck Lever
2007-01-19 22:10 ` Trond Myklebust
0 siblings, 1 reply; 35+ messages in thread
From: Chuck Lever @ 2007-01-19 22:04 UTC (permalink / raw)
To: Trond Myklebust; +Cc: Christoph Hellwig, nfs
[-- Attachment #1: Type: text/plain, Size: 311 bytes --]
Christoph Hellwig wrote:
>> +config RPCBIND_VERSION4
>> + bool "Support for rpcbind version 4"
>
> Do we really need two config options for this?
I can easily combine these into a single option, but actually, do we
need any config option at all? Trond, why not leave versions 3 and 4
enabled all the time?
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 265 bytes --]
begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture Linux Projects Group
email;internet:chuck dot lever at nospam oracle dot com
title:Principle Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 10/14] SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options
2007-01-19 22:04 ` Chuck Lever
@ 2007-01-19 22:10 ` Trond Myklebust
0 siblings, 0 replies; 35+ messages in thread
From: Trond Myklebust @ 2007-01-19 22:10 UTC (permalink / raw)
To: chuck.lever; +Cc: Christoph Hellwig, nfs
On Fri, 2007-01-19 at 17:04 -0500, Chuck Lever wrote:
> Christoph Hellwig wrote:
> >> +config RPCBIND_VERSION4
> >> + bool "Support for rpcbind version 4"
> >
> > Do we really need two config options for this?
>
> I can easily combine these into a single option, but actually, do we
> need any config option at all? Trond, why not leave versions 3 and 4
> enabled all the time?
Fine by me.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 13/14] NLM: Shrink the maximum request size of NLM4 requests
2007-01-19 0:13 ` Christoph Hellwig
@ 2007-01-19 22:27 ` Chuck Lever
2007-01-20 9:26 ` Christoph Hellwig
0 siblings, 1 reply; 35+ messages in thread
From: Chuck Lever @ 2007-01-19 22:27 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: nfs, Trond Myklebust
[-- Attachment #1: Type: text/plain, Size: 676 bytes --]
Christoph Hellwig wrote:
> On Thu, Jan 18, 2007 at 06:30:56PM -0500, Chuck Lever wrote:
>> NLM version 4 requests estimate the call and reply header sizes rather
>> conservatively, using the very maximum size allowed in the protocol even
>> though Linux always uses only a small fraction of the allowable space.
>>
>> Reduce the size of caller and lock arguments to conserve RPC buffer space
>> while XDR encoding NLM4 arguments..
>
>> +#ifndef MIN
>> +# define MIN(a, b) (((a) < (b)) ? (a) : (b))
>> +#endif
>
> please use the kernel min or min_t macros instead.
min/min_t don't work for integer constants, which is what I'm using
MIN() for. What should I use instead?
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 265 bytes --]
begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture Linux Projects Group
email;internet:chuck dot lever at nospam oracle dot com
title:Principle Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 14/14] SUNRPC: Debugging aid
2007-01-18 23:31 ` [PATCH 14/14] SUNRPC: Debugging aid Chuck Lever
@ 2007-01-19 22:28 ` Trond Myklebust
2007-01-19 22:38 ` Chuck Lever
0 siblings, 1 reply; 35+ messages in thread
From: Trond Myklebust @ 2007-01-19 22:28 UTC (permalink / raw)
To: Chuck Lever; +Cc: nfs
On Thu, 2007-01-18 at 18:31 -0500, Chuck Lever wrote:
> Add helper functions for tracking the current FSM state for each RPC task.
> The FSM state name is now displayed in rpc_show_task instead of the
> absolute address of the FSM function.
>
Urgh. When are we ever going to need this information?
We already have the tk_action pointer and the rpc_queue. This doesn't
provide us with any more information.
Trond
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large
2007-01-18 23:30 ` [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large Chuck Lever
2007-01-18 23:49 ` J. Bruce Fields
@ 2007-01-19 22:36 ` Trond Myklebust
2007-01-19 22:46 ` Chuck Lever
1 sibling, 1 reply; 35+ messages in thread
From: Trond Myklebust @ 2007-01-19 22:36 UTC (permalink / raw)
To: Chuck Lever; +Cc: nfs
On Thu, 2007-01-18 at 18:30 -0500, Chuck Lever wrote:
> The RPC buffer size estimation logic in net/sunrpc/clnt.c always
> significantly overestimates the requirements for the buffer size.
> A little instrumentation demonstrated that in fact rpc_malloc was never
> allocating the buffer from the mempool, but almost always called kmalloc.
>
> To compute the size of the RPC buffer more precisely, split p_bufsiz into
> two fields; one for the argument size, and one for the result size. The
> goal is to keep the size requirement for RPC buffers at or below 2KiB.
>
> So now we will compute the sum of the exact call and reply header sizes,
> and split the RPC buffer precisely between the two. That should keep all
> RPCs within the 2KiB buffer mempool limit.
How about adding a temporary BUG_ON() into call_allocate to ensure
task->tk_msg.rpc_proc->p_arglen is always non-zero. We also want to
check for non-zero values of task->tk_msg.rpc_proc->p_replen when
task->tk_msg.rpc_proc->p_decode is non-null.
Finally, what is the purpose of req->rq_callsize and req->rq_rcvsize?
They don't appear to be used anywhere.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 14/14] SUNRPC: Debugging aid
2007-01-19 22:28 ` Trond Myklebust
@ 2007-01-19 22:38 ` Chuck Lever
0 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-19 22:38 UTC (permalink / raw)
To: Trond Myklebust; +Cc: nfs
[-- Attachment #1: Type: text/plain, Size: 981 bytes --]
Trond Myklebust wrote:
> On Thu, 2007-01-18 at 18:31 -0500, Chuck Lever wrote:
>> Add helper functions for tracking the current FSM state for each RPC task.
>> The FSM state name is now displayed in rpc_show_task instead of the
>> absolute address of the FSM function.
>>
>
> Urgh. When are we ever going to need this information?
>
> We already have the tk_action pointer and the rpc_queue.
The tk_action pointer is useless in cases where we don't have a symbol
map. I've actually run into this problem in the field.
In rpc_show_tasks, I was going to do a ksymbol mapping of tk_action, and
print the symbol name instead of the function pointer. Unfortunately
the ksymbol stuff just doesn't work when sunrpc is loaded as a module.
I considered your idea of replacing "tk_action = call_yada;" with a
function or macro that would also update tk_action_name, but I think we
get more accurate information by setting tk_action_name right at the top
of each state function.
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 276 bytes --]
begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture Linux Projects Group
email;internet:chuck dot lever at nospam oracle dot com
title:Principle Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large
2007-01-19 22:36 ` Trond Myklebust
@ 2007-01-19 22:46 ` Chuck Lever
2007-01-19 23:12 ` Trond Myklebust
0 siblings, 1 reply; 35+ messages in thread
From: Chuck Lever @ 2007-01-19 22:46 UTC (permalink / raw)
To: Trond Myklebust; +Cc: nfs
[-- Attachment #1: Type: text/plain, Size: 1554 bytes --]
Trond Myklebust wrote:
> On Thu, 2007-01-18 at 18:30 -0500, Chuck Lever wrote:
>> The RPC buffer size estimation logic in net/sunrpc/clnt.c always
>> significantly overestimates the requirements for the buffer size.
>> A little instrumentation demonstrated that in fact rpc_malloc was never
>> allocating the buffer from the mempool, but almost always called kmalloc.
>>
>> To compute the size of the RPC buffer more precisely, split p_bufsiz into
>> two fields; one for the argument size, and one for the result size. The
>> goal is to keep the size requirement for RPC buffers at or below 2KiB.
>>
>> So now we will compute the sum of the exact call and reply header sizes,
>> and split the RPC buffer precisely between the two. That should keep all
>> RPCs within the 2KiB buffer mempool limit.
>
> How about adding a temporary BUG_ON() into call_allocate to ensure
> task->tk_msg.rpc_proc->p_arglen is always non-zero. We also want to
> check for non-zero values of task->tk_msg.rpc_proc->p_replen when
> task->tk_msg.rpc_proc->p_decode is non-null.
Hmmm. A sanity check is reasonable, but do we really want a runtime
check for values that are fixed at compile time? I'm also not in love
with BUG_ON() -- maybe something like aborting the task and printing a
console warning would be less disruptive.
> Finally, what is the purpose of req->rq_callsize and req->rq_rcvsize?
> They don't appear to be used anywhere.
In my code, they are used in call_encode and xprt_release in addition to
call_allocate. They basically replace rq_bufsize.
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 276 bytes --]
begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture Linux Projects Group
email;internet:chuck dot lever at nospam oracle dot com
title:Principle Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large
2007-01-19 22:46 ` Chuck Lever
@ 2007-01-19 23:12 ` Trond Myklebust
2007-01-23 16:04 ` Chuck Lever
0 siblings, 1 reply; 35+ messages in thread
From: Trond Myklebust @ 2007-01-19 23:12 UTC (permalink / raw)
To: chuck.lever; +Cc: nfs
On Fri, 2007-01-19 at 17:46 -0500, Chuck Lever wrote:
> Trond Myklebust wrote:
> > On Thu, 2007-01-18 at 18:30 -0500, Chuck Lever wrote:
> >> The RPC buffer size estimation logic in net/sunrpc/clnt.c always
> >> significantly overestimates the requirements for the buffer size.
> >> A little instrumentation demonstrated that in fact rpc_malloc was never
> >> allocating the buffer from the mempool, but almost always called kmalloc.
> >>
> >> To compute the size of the RPC buffer more precisely, split p_bufsiz into
> >> two fields; one for the argument size, and one for the result size. The
> >> goal is to keep the size requirement for RPC buffers at or below 2KiB.
> >>
> >> So now we will compute the sum of the exact call and reply header sizes,
> >> and split the RPC buffer precisely between the two. That should keep all
> >> RPCs within the 2KiB buffer mempool limit.
> >
> > How about adding a temporary BUG_ON() into call_allocate to ensure
> > task->tk_msg.rpc_proc->p_arglen is always non-zero. We also want to
> > check for non-zero values of task->tk_msg.rpc_proc->p_replen when
> > task->tk_msg.rpc_proc->p_decode is non-null.
>
> Hmmm. A sanity check is reasonable, but do we really want a runtime
> check for values that are fixed at compile time? I'm also not in love
> with BUG_ON() -- maybe something like aborting the task and printing a
> console warning would be less disruptive.
How is that less disruptive? A bug by any other name....
The point is just to make sure that all existing structures have been
converted and that we haven't missed anything. Feel free to queue up a
patch for the release after this patch has been merged in order to
remove it.
> > Finally, what is the purpose of req->rq_callsize and req->rq_rcvsize?
> > They don't appear to be used anywhere.
>
> In my code, they are used in call_encode and xprt_release in addition to
> call_allocate. They basically replace rq_bufsize.
In that case, why not just add them in the patch that contains the code
that uses them?
Cheers,
Trond
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 13/14] NLM: Shrink the maximum request size of NLM4 requests
2007-01-19 22:27 ` Chuck Lever
@ 2007-01-20 9:26 ` Christoph Hellwig
0 siblings, 0 replies; 35+ messages in thread
From: Christoph Hellwig @ 2007-01-20 9:26 UTC (permalink / raw)
To: Chuck Lever; +Cc: Christoph Hellwig, nfs, Trond Myklebust
On Fri, Jan 19, 2007 at 05:27:13PM -0500, Chuck Lever wrote:
> Christoph Hellwig wrote:
> >On Thu, Jan 18, 2007 at 06:30:56PM -0500, Chuck Lever wrote:
> >>NLM version 4 requests estimate the call and reply header sizes rather
> >>conservatively, using the very maximum size allowed in the protocol even
> >>though Linux always uses only a small fraction of the allowable space.
> >>
> >>Reduce the size of caller and lock arguments to conserve RPC buffer space
> >>while XDR encoding NLM4 arguments..
> >
> >>+#ifndef MIN
> >>+# define MIN(a, b) (((a) < (b)) ? (a) : (b))
> >>+#endif
> >
> >please use the kernel min or min_t macros instead.
>
> min/min_t don't work for integer constants, which is what I'm using
> MIN() for. What should I use instead?
I suspect the right thing is to fix min/max/min_t/max_t for it using gcc
hackery like __builtin_constant_p. Then again I don't understand enough
of that nor do I expect you to know this deep magic. So Let's keep one
MIN/MAX in some central sunrpc header for now and add a block comment
describing why you need it.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large
2007-01-19 23:12 ` Trond Myklebust
@ 2007-01-23 16:04 ` Chuck Lever
0 siblings, 0 replies; 35+ messages in thread
From: Chuck Lever @ 2007-01-23 16:04 UTC (permalink / raw)
To: Trond Myklebust; +Cc: nfs
[-- Attachment #1: Type: text/plain, Size: 2443 bytes --]
Trond Myklebust wrote:
> On Fri, 2007-01-19 at 17:46 -0500, Chuck Lever wrote:
>> Trond Myklebust wrote:
>>> On Thu, 2007-01-18 at 18:30 -0500, Chuck Lever wrote:
>>>> The RPC buffer size estimation logic in net/sunrpc/clnt.c always
>>>> significantly overestimates the requirements for the buffer size.
>>>> A little instrumentation demonstrated that in fact rpc_malloc was never
>>>> allocating the buffer from the mempool, but almost always called kmalloc.
>>>>
>>>> To compute the size of the RPC buffer more precisely, split p_bufsiz into
>>>> two fields; one for the argument size, and one for the result size. The
>>>> goal is to keep the size requirement for RPC buffers at or below 2KiB.
>>>>
>>>> So now we will compute the sum of the exact call and reply header sizes,
>>>> and split the RPC buffer precisely between the two. That should keep all
>>>> RPCs within the 2KiB buffer mempool limit.
>>> How about adding a temporary BUG_ON() into call_allocate to ensure
>>> task->tk_msg.rpc_proc->p_arglen is always non-zero. We also want to
>>> check for non-zero values of task->tk_msg.rpc_proc->p_replen when
>>> task->tk_msg.rpc_proc->p_decode is non-null.
>> Hmmm. A sanity check is reasonable, but do we really want a runtime
>> check for values that are fixed at compile time? I'm also not in love
>> with BUG_ON() -- maybe something like aborting the task and printing a
>> console warning would be less disruptive.
>
> How is that less disruptive? A bug by any other name....
Depending on what locks or semaphores are held at the time the bug
trips, it could freeze up the whole system. If we cleanly abort the
faulty RPC, that localizes the failure without affecting the rest of the
system.
> The point is just to make sure that all existing structures have been
> converted and that we haven't missed anything. Feel free to queue up a
> patch for the release after this patch has been merged in order to
> remove it.
OK.
>>> Finally, what is the purpose of req->rq_callsize and req->rq_rcvsize?
>>> They don't appear to be used anywhere.
>> In my code, they are used in call_encode and xprt_release in addition to
>> call_allocate. They basically replace rq_bufsize.
>
> In that case, why not just add them in the patch that contains the code
> that uses them?
I'm not sure why you don't have those hunks. They should be in the same
patch. I'm going to resend these patches sometime today or tomorrow.
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 276 bytes --]
begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture Linux Projects Group
email;internet:chuck dot lever at nospam oracle dot com
title:Principle Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 35+ messages in thread
end of thread, other threads:[~2007-01-23 16:06 UTC | newest]
Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-18 23:23 [PATCH 00/14] NFS/RPC client patches for 2.6.21 Chuck Lever
2007-01-18 23:29 ` [PATCH 01/14] NFS: fix print format for tk_pid Chuck Lever
2007-01-19 0:03 ` Christoph Hellwig
2007-01-19 0:10 ` Chuck Lever
2007-01-18 23:29 ` [PATCH 02/14] SUNRPC: fix print format for tk_pid in auth_gss support Chuck Lever
2007-01-18 23:29 ` [PATCH 03/14] SUNRPC: fix print format for tk_pid Chuck Lever
2007-01-18 23:29 ` [PATCH 04/14] SUNRPC: Eliminate side effects from rpc_malloc Chuck Lever
2007-01-18 23:30 ` [PATCH 05/14] SUNRPC: Make rpc_free API more generic Chuck Lever
2007-01-18 23:30 ` [PATCH 06/14] SUNRPC: introduce rpcbind: replacement for in-kernel portmapper Chuck Lever
2007-01-19 0:09 ` Christoph Hellwig
2007-01-19 21:54 ` Chuck Lever
2007-01-18 23:30 ` [PATCH 07/14] SUNRPC: switch socket-based RPC transports to use rpcbind Chuck Lever
2007-01-18 23:30 ` [PATCH 08/14] SUNRPC: switch the RPC server to use the new rpcbind registration API Chuck Lever
2007-01-18 23:30 ` [PATCH 09/14] NFS: switch NFSROOT to use new rpcbind client Chuck Lever
2007-01-18 23:30 ` [PATCH 10/14] SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options Chuck Lever
2007-01-19 0:11 ` Christoph Hellwig
2007-01-19 22:04 ` Chuck Lever
2007-01-19 22:10 ` Trond Myklebust
2007-01-18 23:30 ` [PATCH 11/14] SUNRPC: remove old portmapper Chuck Lever
2007-01-18 23:30 ` [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large Chuck Lever
2007-01-18 23:49 ` J. Bruce Fields
2007-01-18 23:54 ` Chuck Lever
2007-01-19 0:00 ` J. Bruce Fields
2007-01-19 0:08 ` Chuck Lever
2007-01-19 22:36 ` Trond Myklebust
2007-01-19 22:46 ` Chuck Lever
2007-01-19 23:12 ` Trond Myklebust
2007-01-23 16:04 ` Chuck Lever
2007-01-18 23:30 ` [PATCH 13/14] NLM: Shrink the maximum request size of NLM4 requests Chuck Lever
2007-01-19 0:13 ` Christoph Hellwig
2007-01-19 22:27 ` Chuck Lever
2007-01-20 9:26 ` Christoph Hellwig
2007-01-18 23:31 ` [PATCH 14/14] SUNRPC: Debugging aid Chuck Lever
2007-01-19 22:28 ` Trond Myklebust
2007-01-19 22:38 ` Chuck Lever
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.