Skip to contentSkip to conversation

NFS/RPC client patches for 2.6.21

PATCH In review Chuck Lever 4 participants 35 messages Jan 18, 2007 – Jan 23, 2007

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover NFS/RPC client patches for 2.6.21

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.

Signature · 10 lines
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  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
#1 lore raw

PATCH 1/14 NFS: fix print format for tk_pid

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.

---

 fs/nfs/direct.c |    6 +++---
 fs/nfs/read.c   |    4 ++--
 fs/nfs/write.c  |    8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)
fs/nfs/direct.c +3 -3
index bd21d7f..7c02dc7 100644
@@ -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);
fs/nfs/read.c +2 -2
index a9c2652..47f5e56 100644
@@ -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);
fs/nfs/write.c +4 -4
index 345492e..0ab8435 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#2 lore raw

Re: [PATCH 01/14] NFS: fix print format for tk_pid

Quoted 4 lines · Chuck Lever

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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#3 lore raw

Re: [PATCH 01/14] NFS: fix print format for tk_pid

Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Chuck Lever

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.

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

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#4 lore raw

PATCH 2/14 SUNRPC: fix print format for tk_pid in auth_gss support

In reply to Chuck Lever

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.

---

 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(-)
net/sunrpc/auth_gss/auth_gss.c +27 -25
index e1a104a..2fe8e91 100644
@@ -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;
 }
net/sunrpc/auth_gss/gss_krb5_crypto.c +4 -4
index d926cda..cd64efd 100644
@@ -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;
 }
 
net/sunrpc/auth_gss/gss_krb5_mech.c +2 -1
index 05d4bee..7b19432 100644
@@ -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:
net/sunrpc/auth_gss/gss_krb5_seal.c +1 -1
index d0bb506..a0d9faa 100644
@@ -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();
 
net/sunrpc/auth_gss/gss_krb5_seqnum.c +1 -1
index c604baf..2f0b112 100644
@@ -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;
net/sunrpc/auth_gss/gss_krb5_unseal.c +1 -1
index 87f8977..e30a993 100644
@@ -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))
net/sunrpc/auth_gss/gss_krb5_wrap.c +2 -2
index fe25b3d..42b3220 100644
@@ -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,
net/sunrpc/auth_gss/gss_mech_switch.c +3 -3
index 3db7453..c7681db 100644
@@ -113,7 +113,7 @@ gss_mech_register(struct gss_api_mech *g
 	spin_lock(&registered_mechs_lock);
 	list_add(&gm->gm_list, &registered_mechs);
 	spin_unlock(&registered_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(&registered_mechs_lock);
 	list_del(&gm->gm_list);
 	spin_unlock(&registered_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)
net/sunrpc/auth_gss/gss_spkm3_mech.c +5 -4
index 8ef3f1c..7e15aa6 100644
@@ -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;
 }
 
net/sunrpc/auth_gss/gss_spkm3_seal.c +8 -6
index b179d58..104cbf4 100644
@@ -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;
 	}
net/sunrpc/auth_gss/gss_spkm3_token.c +8 -6
index 35188b6..156413a 100644
@@ -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 */
net/sunrpc/auth_gss/gss_spkm3_unseal.c +5 -4
index e54581c..ac1ad6b 100644
@@ -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;
 	}
 
net/sunrpc/auth_gss/svcauth_gss.c +6 -5
index 066c64a..8944cab 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#5 lore raw

PATCH 3/14 SUNRPC: fix print format for tk_pid

In reply to Chuck Lever

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.

---

 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(-)
net/sunrpc/auth.c +13 -12
index 993ff1a..5752f29 100644
@@ -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)
net/sunrpc/auth_unix.c +5 -4
index f7f990c..4e7733a 100644
@@ -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);
net/sunrpc/cache.c +2 -1
index 1427449..9e72223 100644
@@ -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:
net/sunrpc/clnt.c +69 -60

356 lines not on this page · raw message

net/sunrpc/pmap_clnt.c +10 -8
index 3946ec3..8d9e780 100644
@@ -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);
net/sunrpc/sched.c +35 -31

223 lines not on this page · raw message

net/sunrpc/stats.c +3 -3
index bd98124..d19cd9e 100644
@@ -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);
net/sunrpc/svc.c +3 -3
index f3001f3..6627759 100644
@@ -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,
net/sunrpc/xprt.c +31 -26

184 lines not on this page · raw message

net/sunrpc/xprtsock.c +57 -50

337 lines not on this page · raw message

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#6 lore raw

PATCH 4/14 SUNRPC: Eliminate side effects from rpc_malloc

In reply to Chuck Lever

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.

---

 net/sunrpc/clnt.c  |    5 ++++-
 net/sunrpc/sched.c |   14 +++-----------
 2 files changed, 7 insertions(+), 12 deletions(-)
net/sunrpc/clnt.c +4 -1
index f837335..244cce4 100644
@@ -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);
 
net/sunrpc/sched.c +3 -11
index cb0c5f4..08104dd 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#7 lore raw

PATCH 5/14 SUNRPC: Make rpc_free API more generic

In reply to Chuck Lever

Don't diddle with rq_buffer and rq_bufsize inside of rpc_free.

---

 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(-)
include/linux/sunrpc/sched.h +1 -1
index 97c7616..88e6e39 100644
@@ -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 *));
include/linux/sunrpc/xprt.h +1 -1
index f780e72..51c3660 100644
@@ -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);
net/sunrpc/sched.c +7 -8
index 08104dd..c689196 100644
@@ -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);
 	}
 }
 
net/sunrpc/xprt.c +1 -1
index cf59f7d..9f787ac 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#8 lore raw

PATCH 6/14 SUNRPC: introduce rpcbind: replacement for in-kernel portmapper

In reply to Chuck Lever

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.

---

 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(-)
include/linux/sunrpc/clnt.h +3 -0
index a1be89d..502e5ea 100644
@@ -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 */
include/linux/sunrpc/debug.h +1 -0
index 60fce3c..7b11c74 100644
@@ -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
include/linux/sunrpc/xprt.h +1 -0
index 51c3660..6c035cb 100644
@@ -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
net/sunrpc/Makefile +1 -1
index cdcab9c..3417a1e 100644
@@ -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
net/sunrpc/rpcb_clnt.c new file +539 -0

539 lines not on this page · raw message

net/sunrpc/xprt.c +1 -0
index 9f787ac..86181ac 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#9 lore raw

Re: [PATCH 06/14] SUNRPC: introduce rpcbind: replacement for in-kernel portmapper

Quoted 8 lines · Chuck Lever

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:

net/sunrpc/rpcb_clnt.c line 2

Quoted 5 lines
net/sunrpc/rpcb_clnt.c new file +2 -0
@@ -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.

net/sunrpc/rpcb_clnt.c line 82

Quoted 9 lines
net/sunrpc/rpcb_clnt.c new file +9 -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);
+}

Please kill these useless wrappers.

net/sunrpc/rpcb_clnt.c line 101

Quoted 1 line
net/sunrpc/rpcb_clnt.c new file +1 -0
+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.

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#10 lore raw

Re: [PATCH 06/14] SUNRPC: introduce rpcbind: replacement for in-kernel portmapper

Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Chuck Lever

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.

Quoted 7 lines
Quoted 2 lines

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.

Quoted 10 lines

More comments on the actual code:

net/sunrpc/rpcb_clnt.c line 2

Quoted 5 lines
net/sunrpc/rpcb_clnt.c new file +2 -0
@@ -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.

Quoted 11 lines

net/sunrpc/rpcb_clnt.c line 82

Quoted 9 lines
net/sunrpc/rpcb_clnt.c new file +9 -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);
+}

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.

Quoted 3 lines

net/sunrpc/rpcb_clnt.c line 101

Quoted 1 line
net/sunrpc/rpcb_clnt.c new file +1 -0
+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.

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

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#11 lore raw

PATCH 7/14 SUNRPC: switch socket-based RPC transports to use rpcbind

In reply to Chuck Lever

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.

---

 net/sunrpc/xprtsock.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/xprtsock.c +2 -2
index 64736b3..78d5494 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#12 lore raw

PATCH 8/14 SUNRPC: switch the RPC server to use the new rpcbind registration API

In reply to Chuck Lever

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.

---

 net/sunrpc/svc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/sunrpc/svc.c +1 -1
index 6627759..d38d74a 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#13 lore raw

PATCH 9/14 NFS: switch NFSROOT to use new rpcbind client

In reply to Chuck Lever

It is arguable whether NFSROOT will support IPv6, and thus whether the rpcb_getport_external API needs to support rpcbind versions greater than 2.

---

 fs/nfs/nfsroot.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/nfsroot.c +1 -1
index 75f819d..49d1008 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#14 lore raw

PATCH 10/14 SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options

In reply to Chuck Lever

---

 fs/Kconfig        |   24 ++++++++++++++++++++++++
 net/sunrpc/clnt.c |    8 +++++---
 2 files changed, 29 insertions(+), 3 deletions(-)
fs/Kconfig +24 -0
index 8cd2417..b49d1b5 100644
@@ -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
 
net/sunrpc/clnt.c +5 -3
index 244cce4..493b950 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#15 lore raw

Re: [PATCH 10/14] SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options

fs/Kconfig config NFS_COMMON · line 1770

Quoted 3 lines
fs/Kconfig +3 -0
+config RPCBIND_VERSION3
+	bool "Support for rpcbind version 3"
+	default n

default n is the default behaviour, you don't need to specify it.

fs/Kconfig config NFS_COMMON · line 1780

Quoted 2 lines
fs/Kconfig +2 -0
+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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#16 lore raw

Re: [PATCH 10/14] SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options

Quoted 4 lines · Christoph Hellwig

fs/Kconfig config NFS_COMMON · line 1780

Quoted 2 lines
fs/Kconfig +2 -0
+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?

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

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#17 lore raw

Re: [PATCH 10/14] SUNRPC: Enable support for rpcbind versions 3 and 4 via CONFIG options

Quoted 9 lines · Chuck Lever
Quoted 4 lines · Christoph Hellwig

fs/Kconfig config NFS_COMMON · line 1780

Quoted 2 lines
fs/Kconfig +2 -0
+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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#18 lore raw

PATCH 11/14 SUNRPC: remove old portmapper

In reply to Chuck Lever

net/sunrpc/pmap_clnt.c has been replaced by net/sunrpc/rpcb_clnt.c.

---

 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(-)
include/linux/sunrpc/clnt.h +0 -3
index 502e5ea..c78b913 100644
@@ -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__ */
include/linux/sunrpc/debug.h +0 -1
index 7b11c74..a3754d9 100644
@@ -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
include/linux/sunrpc/msg_prot.h +0 -4
index 606cb21..784d4c3 100644
@@ -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
 
 /*
net/sunrpc/Makefile +1 -1
index 3417a1e..8ebfc4d 100644
@@ -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
net/sunrpc/pmap_clnt.c deleted +0 -381

381 lines not on this page · raw message

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#19 lore raw

PATCH 12/14 SUNRPC: RPC buffer size estimates are too large

In reply to Chuck Lever

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!

---

 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(-)
fs/lockd/mon.c +4 -6
index eb243ed..2102e2d 100644
@@ -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",
 	},
fs/lockd/xdr.c +2 -5
index 34dae5d..75dd023 100644
@@ -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,						\
 	}
fs/lockd/xdr4.c +2 -5
index a782405..d354f3f 100644
@@ -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,						\
 	}
fs/nfs/mount_clnt.c +5 -2
index f75fe72..ca5a266 100644
@@ -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",
 	},
fs/nfs/nfs2xdr.c +2 -5
index 3be4e72..abd9f8b 100644
@@ -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,						\
fs/nfs/nfs3xdr.c +6 -7
index 0ace092..b51df8e 100644
@@ -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",
 	},
fs/nfs/nfs4xdr.c +2 -5
index 0cf3fa3..198f1b5 100644
@@ -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,					\
     }
fs/nfsd/nfs4callback.c +2 -5
index f57655a..69a721a 100644
@@ -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,                                              \
 }
include/linux/sunrpc/clnt.h +2 -1
index c78b913..5a8f9c2 100644
@@ -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 */
include/linux/sunrpc/xprt.h +2 -1
index 6c035cb..192b74d 100644
@@ -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.
net/sunrpc/clnt.c +36 -28

101 lines not on this page · raw message

net/sunrpc/rpcb_clnt.c +14 -7
index 8f3e133..5a44079 100644
@@ -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,
 	},
 };
net/sunrpc/xprt.c +2 -2
index 86181ac..7725d63 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#20 lore raw

Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large

Quoted 9 lines · Chuck Lever

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.

Quoted 5 lines

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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#21 lore raw

Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large

Quoted 14 lines · J. Bruce Fields
Quoted 13 lines · Chuck Lever

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.

Quoted 6 lines
Quoted 1 line

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.

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

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#22 lore raw

Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large

Quoted 9 lines · Chuck Lever
Quoted 4 lines · J. Bruce Fields

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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#23 lore raw

Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large

Quoted 4 lines · J. Bruce Fields

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.

Quoted 3 lines

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.

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

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#24 lore raw

Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large

In reply to Chuck Lever
Quoted 5 lines · Chuck Lever

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.

Quoted 7 lines

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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#25 lore raw

Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large

Quoted 10 lines · Trond Myklebust
Quoted 9 lines · Chuck Lever

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.

Quoted 8 lines
Quoted 3 lines

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.

Quoted 2 lines

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.

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

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#26 lore raw

Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large

Quoted 20 lines · Chuck Lever
Quoted 10 lines · Trond Myklebust
Quoted 9 lines · Chuck Lever

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.

Quoted 8 lines
Quoted 3 lines

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.

Quoted 4 lines

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.

Quoted 5 lines
Quoted 2 lines

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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#27 lore raw

Re: [PATCH 12/14] SUNRPC: RPC buffer size estimates are too large

Quoted 15 lines · Trond Myklebust
Quoted 14 lines · Chuck Lever
Quoted 13 lines · Trond Myklebust
Quoted 12 lines · Chuck Lever

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.

Quoted 7 lines
Quoted 5 lines
Quoted 4 lines

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.

Quoted 4 lines

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.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

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.

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

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#28 lore raw

PATCH 13/14 NLM: Shrink the maximum request size of NLM4 requests

In reply to Chuck Lever

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..

---

 fs/lockd/xdr.c  |   13 +++++++++----
 fs/lockd/xdr4.c |   16 +++++++++++-----
 2 files changed, 20 insertions(+), 9 deletions(-)
fs/lockd/xdr.c +9 -4
index 75dd023..55796c3 100644
@@ -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
fs/lockd/xdr4.c +11 -5
index d354f3f..88c18a8 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#29 lore raw

Re: [PATCH 13/14] NLM: Shrink the maximum request size of NLM4 requests

fs/lockd/xdr.c nlmclt_decode_res(struct rpc_rqst *req, · line 515

Quoted 10 lines · Chuck Lever

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..

fs/lockd/xdr.c +3 -0
+#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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#30 lore raw

Re: [PATCH 13/14] NLM: Shrink the maximum request size of NLM4 requests

Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Chuck Lever

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.

Quoted 8 lines

fs/lockd/xdr.c nlmclt_decode_res(struct rpc_rqst *req, · line 515

Quoted 6 lines

Reduce the size of caller and lock arguments to conserve RPC buffer space while XDR encoding NLM4 arguments..

fs/lockd/xdr.c +3 -0
+#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?

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

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#31 lore raw

Re: [PATCH 13/14] NLM: Shrink the maximum request size of NLM4 requests

Quoted 9 lines · Chuck Lever
Quoted 8 lines · Christoph Hellwig
Quoted 6 lines · Chuck Lever

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..

Quoted 8 lines
Quoted 5 lines

fs/lockd/xdr.c nlmclt_decode_res(struct rpc_rqst *req, · line 515

Quoted 3 lines
fs/lockd/xdr.c +3 -0
+#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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#32 lore raw

PATCH 14/14 SUNRPC: Debugging aid

In reply to Chuck Lever

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.

---

 include/linux/sunrpc/sched.h |   13 ++++++++++++-
 net/sunrpc/clnt.c            |   35 ++++++++++++++++++++++++++++++++++-
 net/sunrpc/sched.c           |   11 ++++++++---
 3 files changed, 54 insertions(+), 5 deletions(-)
include/linux/sunrpc/sched.h +12 -1
index 88e6e39..7732e80 100644
@@ -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_ */
net/sunrpc/clnt.c +34 -1
index eafe045..f4d2bc6 100644
@@ -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;
net/sunrpc/sched.c +8 -3
index c689196..b712317 100644
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#33 lore raw

Re: [PATCH 14/14] SUNRPC: Debugging aid

Quoted 4 lines · Chuck Lever

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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#34 lore raw

Re: [PATCH 14/14] SUNRPC: Debugging aid

Quoted 9 lines · Trond Myklebust
Quoted 4 lines · Chuck Lever

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.

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

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs