Skip to contentSkip to conversation

patches for 2.6.21

PATCH In review Chuck Lever 2 participants 26 messages Jan 24, 2007

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

cover patches for 2.6.21

Hi Trond-

I've responded to review comments with this new set of patches. One old patch is added back to provide compliance with RFC 3530.

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/15 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 |    8 +++++---
 fs/nfs/read.c   |    4 ++--
 fs/nfs/write.c  |    9 +++++----
 3 files changed, 12 insertions(+), 9 deletions(-)
fs/nfs/direct.c +5 -3
index bd21d7f..b1c98ea 100644
@@ -309,7 +309,8 @@ 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 +640,8 @@ 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 +799,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 +5 -4
index 345492e..649b1de 100644
@@ -852,7 +852,8 @@ 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 +1135,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 +1251,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 +1292,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

PATCH 2/15 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

#3 lore raw

PATCH 3/15 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

#4 lore raw

PATCH 4/15 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

#5 lore raw

PATCH 5/15 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

#6 lore raw

PATCH 6/15 NFS: disconnect before retrying NFSv4 requests over TCP

In reply to Chuck Lever

RFC3530 section 3.1.1 states an NFSv4 client MUST NOT send a request twice on the same connection unless it is the NULL procedure. Section 3.1.1 suggests that the client should disconnect and reconnect if it wants to retry a request.

Implement this by adding an rpc_clnt flag that an ULP can use to specify that the underlying transport should be disconnected on a major timeout. The NFSv4 client asserts this new flag, and requests no retries after a minor retransmit timeout.

Note that disconnecting on a retransmit is in general not safe to do if the RPC client does not reuse the TCP port number when reconnecting.

See http://bugzilla.linux-nfs.org/show_bug.cgi?id=6

---

 fs/nfs/client.c             |    9 ++++++---
 include/linux/sunrpc/clnt.h |    2 ++
 net/sunrpc/clnt.c           |    2 ++
 net/sunrpc/xprt.c           |   10 ++++++++++
 4 files changed, 20 insertions(+), 3 deletions(-)
fs/nfs/client.c +6 -3
index 23ab145..a514599 100644
@@ -394,7 +394,8 @@ static void nfs_init_timeout_values(stru
 static int nfs_create_rpc_client(struct nfs_client *clp, int proto,
 						unsigned int timeo,
 						unsigned int retrans,
-						rpc_authflavor_t flavor)
+						rpc_authflavor_t flavor,
+						int flags)
 {
 	struct rpc_timeout	timeparms;
 	struct rpc_clnt		*clnt = NULL;
@@ -407,6 +408,7 @@ static int nfs_create_rpc_client(struct 
 		.program	= &nfs_program,
 		.version	= clp->rpc_ops->version,
 		.authflavor	= flavor,
+		.flags		= flags,
 	};
 
 	if (!IS_ERR(clp->cl_rpcclient))
@@ -548,7 +550,7 @@ #endif
 	 * - RFC 2623, sec 2.3.2
 	 */
 	error = nfs_create_rpc_client(clp, proto, data->timeo, data->retrans,
-			RPC_AUTH_UNIX);
+					RPC_AUTH_UNIX, 0);
 	if (error < 0)
 		goto error;
 	nfs_mark_client_ready(clp, NFS_CS_READY);
@@ -868,7 +870,8 @@ static int nfs4_init_client(struct nfs_c
 	/* Check NFS protocol revision and initialize RPC op vector */
 	clp->rpc_ops = &nfs_v4_clientops;
 
-	error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour);
+	error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour,
+					RPC_CLNT_CREATE_DISCRTRY);
 	if (error < 0)
 		goto error;
 	memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
include/linux/sunrpc/clnt.h +2 -0
index a1be89d..c7a78ee 100644
@@ -40,6 +40,7 @@ struct rpc_clnt {
 
 	unsigned int		cl_softrtry : 1,/* soft timeouts */
 				cl_intr     : 1,/* interruptible */
+				cl_discrtry : 1,/* disconnect before retry */
 				cl_autobind : 1,/* use getport() */
 				cl_oneshot  : 1,/* dispose after use */
 				cl_dead     : 1;/* abandoned */
@@ -111,6 +112,7 @@ #define RPC_CLNT_CREATE_AUTOBIND	(1UL <<
 #define RPC_CLNT_CREATE_ONESHOT		(1UL << 3)
 #define RPC_CLNT_CREATE_NONPRIVPORT	(1UL << 4)
 #define RPC_CLNT_CREATE_NOPING		(1UL << 5)
+#define RPC_CLNT_CREATE_DISCRTRY	(1UL << 6)
 
 struct rpc_clnt *rpc_create(struct rpc_create_args *args);
 struct rpc_clnt	*rpc_bind_new_program(struct rpc_clnt *,
net/sunrpc/clnt.c +2 -0
index 244cce4..a5ce924 100644
@@ -249,6 +249,8 @@ struct rpc_clnt *rpc_create(struct rpc_c
 		clnt->cl_autobind = 1;
 	if (args->flags & RPC_CLNT_CREATE_ONESHOT)
 		clnt->cl_oneshot = 1;
+	if (args->flags & RPC_CLNT_CREATE_DISCRTRY)
+		clnt->cl_discrtry = 1;
 
 	return clnt;
 }
net/sunrpc/xprt.c +10 -0
index 9f787ac..815addd 100644
@@ -735,6 +735,16 @@ void xprt_transmit(struct rpc_task *task
 			xprt_reset_majortimeo(req);
 			/* Turn off autodisconnect */
 			del_singleshot_timer_sync(&xprt->timer);
+		} else {
+			/* If all request bytes have been sent,
+			 * then we must be retransmitting this one */
+			if (!req->rq_bytes_sent) {
+				if (task->tk_client->cl_discrtry) {
+					xprt_disconnect(xprt);
+					task->tk_status = -ENOTCONN;
+					return;
+				}
+			}
 		}
 	} else if (!req->rq_bytes_sent)
 		return;

-------------------------------------------------------------------------
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 7/15 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       |  531 ++++++++++++++++++++++++++++++++++++++++++
 net/sunrpc/xprt.c            |    1 
 6 files changed, 538 insertions(+), 1 deletions(-)
include/linux/sunrpc/clnt.h +3 -0
index c7a78ee..702baef 100644
@@ -123,6 +123,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);
 
@@ -145,6 +147,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 +531 -0

531 lines not on this page · raw message

net/sunrpc/xprt.c +1 -0
index 815addd..5261774 100644
@@ -938,6 +938,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

#8 lore raw

PATCH 8/15 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

#9 lore raw

PATCH 9/15 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

#10 lore raw

PATCH 10/15 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

#11 lore raw

PATCH 11/15 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 702baef..a34737a 100644
@@ -121,8 +121,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 *);
 
@@ -146,7 +144,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

#12 lore raw

PATCH 12/15 SUNRPC: RPC client should retry with different versions of rpcbind

In reply to Chuck Lever

---

 net/sunrpc/clnt.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
net/sunrpc/clnt.c +5 -3
index a5ce924..606b397 100644
@@ -896,9 +896,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

#13 lore raw

PATCH 13/15 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.

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 almost all RPC buffers 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           |   66 +++++++++++++++++++++++++------------------
 net/sunrpc/rpcb_clnt.c      |   21 +++++++++-----
 net/sunrpc/xprt.c           |    4 +--
 13 files changed, 84 insertions(+), 78 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 a34737a..6661142 100644
@@ -84,7 +84,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 +39 -27

106 lines not on this page · raw message

net/sunrpc/rpcb_clnt.c +14 -7
index 28e0a76..f920345 100644
@@ -434,21 +434,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,
 	},
 };
@@ -458,21 +461,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,
 	},
 };
@@ -482,7 +488,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 5261774..639d18d 100644
@@ -833,7 +833,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);
@@ -865,7 +864,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

#14 lore raw

Re: [PATCH 13/15] SUNRPC: RPC buffer size estimates are too large

Quoted 29 lines · Chuck Lever
net/sunrpc/clnt.c +9 -6
@@ -753,25 +751,39 @@ call_reserveresult(struct rpc_task *task
 static void
 call_allocate(struct rpc_task *task)
 {
+	unsigned int slack = task->tk_auth->au_cslack;
 	struct rpc_rqst *req = task->tk_rqstp;
 	struct rpc_xprt *xprt = task->tk_xprt;
-	unsigned int	bufsiz;
+	struct rpc_procinfo *proc = task->tk_msg.rpc_proc;
 
 	dprint_status(task);
 
+	task->tk_status = 0;
 	task->tk_action = call_bind;
+
 	if (req->rq_buffer)
 		return;
 
-	/* FIXME: compute buffer requirements more exactly using
-	 * auth->au_wslack */
-	bufsiz = task->tk_msg.rpc_proc->p_bufsiz + RPC_SLACK_SPACE;
+	if (proc->p_proc != 0) {
+		BUG_ON(proc->p_arglen == 0);
+		if (proc->p_decode != NULL)
+			BUG_ON(proc->p_replen == 0);
+	}
 
-	req->rq_buffer = xprt->ops->buf_alloc(task, bufsiz << 1);
-	if (req->rq_buffer != NULL) {

net/sunrpc/clnt.c call_reserveresult(struct rpc_task *task · line 781

Quoted 10 lines
net/sunrpc/clnt.c +9 -1
-		req->rq_bufsize = bufsiz;
+	/*
+	 * Calculate the size (in quads) of the RPC call
+	 * and reply headers, and convert both values
+	 * to byte sizes.
+	 */
+ 	req->rq_callsize = RPC_CALLHDRSIZE + (slack << 1) + proc->p_arglen;
+ 	req->rq_callsize <<= 2;
+ 	req->rq_rcvsize = RPC_REPHDRSIZE + slack + proc->p_replen;
+ 	req->rq_rcvsize <<= 2;

What happened to rslack? The callsize calculation should be using cslack and the rcvsize calculation rslack, I think, right?

In the krb5p case there's an extra annoyance: rslack is used to decide where to expect page data to start, so it can only take into account extra space needed at the beginning. But krb5p has to add padding, for example, to the end of each request.

We could deal with that by setting rslack high enough to take into account the padding at the end, and then shifting the data back as we decode, to ensure that the start of the plaintext page data ends up exactly where rslack would predict it should.

Currently, though, the krb5p code just decrypts in place, and it might take a little work to get it to do the simultaneous moving and decoding.

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

#15 lore raw

Re: [PATCH 13/15] SUNRPC: RPC buffer size estimates are too large

Quoted 28 lines · J. Bruce Fields
Quoted 27 lines · Chuck Lever
net/sunrpc/clnt.c +9 -4
@@ -753,25 +751,39 @@ call_reserveresult(struct rpc_task *task
 static void
 call_allocate(struct rpc_task *task)
 {
+	unsigned int slack = task->tk_auth->au_cslack;
 	struct rpc_rqst *req = task->tk_rqstp;
 	struct rpc_xprt *xprt = task->tk_xprt;
-	unsigned int	bufsiz;
+	struct rpc_procinfo *proc = task->tk_msg.rpc_proc;
 
 	dprint_status(task);
 
+	task->tk_status = 0;
 	task->tk_action = call_bind;
+
 	if (req->rq_buffer)
 		return;
 
-	/* FIXME: compute buffer requirements more exactly using
-	 * auth->au_wslack */
-	bufsiz = task->tk_msg.rpc_proc->p_bufsiz + RPC_SLACK_SPACE;
+	if (proc->p_proc != 0) {
+		BUG_ON(proc->p_arglen == 0);
+		if (proc->p_decode != NULL)
+			BUG_ON(proc->p_replen == 0);
+	}
 
Quoted 15 lines

net/sunrpc/clnt.c call_reserveresult(struct rpc_task *task · line 781

Quoted 12 lines
net/sunrpc/clnt.c +9 -3
-	req->rq_buffer = xprt->ops->buf_alloc(task, bufsiz << 1);
-	if (req->rq_buffer != NULL) {
-		req->rq_bufsize = bufsiz;
+	/*
+	 * Calculate the size (in quads) of the RPC call
+	 * and reply headers, and convert both values
+	 * to byte sizes.
+	 */
+ 	req->rq_callsize = RPC_CALLHDRSIZE + (slack << 1) + proc->p_arglen;
+ 	req->rq_callsize <<= 2;
+ 	req->rq_rcvsize = RPC_REPHDRSIZE + slack + proc->p_replen;
+ 	req->rq_rcvsize <<= 2;

What happened to rslack? The callsize calculation should be using cslack and the rcvsize calculation rslack, I think, right?

As far as I understood it, cslack is the size of the authentication verifier for that flavor. Shouldn't that be the same for calls and replies?

Quoted 4 lines

In the krb5p case there's an extra annoyance: rslack is used to decide where to expect page data to start, so it can only take into account extra space needed at the beginning. But krb5p has to add padding, for example, to the end of each request.

That padding has to follow XDR rules, though, correct?

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

#16 lore raw

Re: [PATCH 13/15] SUNRPC: RPC buffer size estimates are too large

Quoted 7 lines · Chuck Lever
Quoted 6 lines · J. Bruce Fields
Quoted 4 lines · Chuck Lever
net/sunrpc/clnt.c +4 -0
+ 	req->rq_callsize = RPC_CALLHDRSIZE + (slack << 1) + proc->p_arglen;
+ 	req->rq_callsize <<= 2;
+ 	req->rq_rcvsize = RPC_REPHDRSIZE + slack + proc->p_replen;
+ 	req->rq_rcvsize <<= 2;
Quoted 5 lines
Quoted 2 lines

What happened to rslack? The callsize calculation should be using cslack and the rcvsize calculation rslack, I think, right?

As far as I understood it, cslack is the size of the authentication verifier for that flavor. Shouldn't that be the same for calls and replies?

No--it can even vary from one call or reply to the next, and we can't necessarily exactly predict the size of the reply verifier (though we should be able to give a fairly tight upper bound). Also the call has a credential in addition to the verifier, and the credential size also depends on the security flavor.

Quoted 6 lines
Quoted 4 lines

In the krb5p case there's an extra annoyance: rslack is used to decide where to expect page data to start, so it can only take into account extra space needed at the beginning. But krb5p has to add padding, for example, to the end of each request.

That padding has to follow XDR rules, though, correct?

This is padding at a different level--the plaintext usually has to be padded to the nearest block size (at least 8 bytes) before encryption.

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

#17 lore raw

Re: [PATCH 13/15] SUNRPC: RPC buffer size estimates are too large

Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · Chuck Lever
Quoted 5 lines · J. Bruce Fields
Quoted 4 lines · Chuck Lever
net/sunrpc/clnt.c +4 -0
+ 	req->rq_callsize = RPC_CALLHDRSIZE + (slack << 1) + proc->p_arglen;
+ 	req->rq_callsize <<= 2;
+ 	req->rq_rcvsize = RPC_REPHDRSIZE + slack + proc->p_replen;
+ 	req->rq_rcvsize <<= 2;
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

What happened to rslack? The callsize calculation should be using cslack and the rcvsize calculation rslack, I think, right?

As far as I understood it, cslack is the size of the authentication verifier for that flavor. Shouldn't that be the same for calls and replies?

No--it can even vary from one call or reply to the next, and we can't necessarily exactly predict the size of the reply verifier (though we should be able to give a fairly tight upper bound).

I assume that cslack is the maximum size of any possible verifier or credential. For calls, I reserve 2 * cslack bytes in the send buffer (to account for the credential and verifier), and for replies I reserve cslack bytes for the receive buffer.

Quoted 3 lines

Also the call has a
credential in addition to the verifier, and the credential size also depends on the security flavor.

These values are just for estimating the largest size the buffers will need to be for this call and reply. Alignment issues need to be handled
somewhere else.

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

In the krb5p case there's an extra annoyance: rslack is used to decide where to expect page data to start, so it can only take into account extra space needed at the beginning. But krb5p has to add padding, for example, to the end of each request.

That padding has to follow XDR rules, though, correct?

This is padding at a different level--the plaintext usually has to be padded to the nearest block size (at least 8 bytes) before encryption.

That doesn't sound like XDR at all. I don't see how RPC buffer allocation could be concerned about this...

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

#18 lore raw

Re: [PATCH 13/15] SUNRPC: RPC buffer size estimates are too large

Quoted 3 lines · Chuck Lever

These values are just for estimating the largest size the buffers will need to be for this call and reply. Alignment issues need to be handled
somewhere else.

OK, I'm an idiot--so cslack is just for calculating the maximum size, rslack is for placing the data correctly. So now I understand what you're doing, and don't see any more problem with it.

Quoted 5 lines
Quoted 2 lines

This is padding at a different level--the plaintext usually has to be padded to the nearest block size (at least 8 bytes) before encryption.

That doesn't sound like XDR at all. I don't see how RPC buffer allocation could be concerned about this...

The encrypted data is encapsulated in xdr and the RPC buffers need to be large enough to hold them.

But all we need to do is make gss's au_cslack value big enough for the worst case and we're fine, OK.

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

#19 lore raw

Re: [PATCH 13/15] SUNRPC: RPC buffer size estimates are too large

Quoted 7 lines · J. Bruce Fields
Quoted 2 lines · Chuck Lever

These values are just for estimating the largest size the buffers will need to be for this call and reply. Alignment issues need to be handled
somewhere else.

OK, I'm an idiot--so cslack is just for calculating the maximum size, rslack is for placing the data correctly. So now I understand what you're doing, and don't see any more problem with it.

Well, it might do to rename au_cslack and au_rslack so that the confusion isn't spread further ;-)

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

#20 lore raw

Re: [PATCH 13/15] SUNRPC: RPC buffer size estimates are too large

In reply to Chuck Lever
Quoted 11 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.

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 almost all RPC buffers within the 2KiB buffer mempool limit.

One other worry: after this patch, as I understand it, a small mistake in any of the definitions of the *_sz macros could allow a buffer overflow that RPC_SLACK_SPACE previously prevented.

Those definitions are all handwritten, and I'd be suprised if there aren't at least a few minor errors.

I'd certainly rather have these calculations be exact than depend on this big RPC_SLACK_SPACE fudge factor, but is there some way we could verify those macros first?

--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 13/15] SUNRPC: RPC buffer size estimates are too large

Quoted 17 lines · J. Bruce Fields
Quoted 11 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.

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 almost all RPC buffers within the 2KiB buffer mempool limit.

One other worry: after this patch, as I understand it, a small mistake in any of the definitions of the *_sz macros could allow a buffer overflow that RPC_SLACK_SPACE previously prevented.

Quoted 6 lines

Those definitions are all handwritten, and I'd be suprised if there aren't at least a few minor errors.

I'd certainly rather have these calculations be exact than depend on this big RPC_SLACK_SPACE fudge factor, but is there some way we could verify those macros first?

I've been running Connectathon and fsx-odirect with hundreds of thousands of ops on a kernel that has all the slab debugging options enabled. I haven't hit a problem yet.

And besides, the RPC buffers are all a fixed size (2kiB), and much larger than required already. The slack is "built in" to the buffer size.

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 13/15] SUNRPC: RPC buffer size estimates are too large

Quoted 3 lines · Chuck Lever

I've been running Connectathon and fsx-odirect with hundreds of thousands of ops on a kernel that has all the slab debugging options enabled. I haven't hit a problem yet.

That's not going to exercise all the possible buffer calculations--it probably doesn't perform any ACL operations, for example.

I wonder if it would be possible to generate those buffer sizes directly from the .x files or something?

Quoted 2 lines

And besides, the RPC buffers are all a fixed size (2kiB), and much larger than required already. The slack is "built in" to the buffer size.

OK. Do we know of any calls or replies that are close to that limit?

--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 13/15] SUNRPC: RPC buffer size estimates are too large

Quoted 6 lines · J. Bruce Fields
Quoted 1 line · Chuck Lever

I've been running Connectathon and fsx-odirect with hundreds of thousands of ops on a kernel that has all the slab debugging options enabled. I haven't hit a problem yet.

That's not going to exercise all the possible buffer calculations--it probably doesn't perform any ACL operations, for example.

Quoted 6 lines

I wonder if it would be possible to generate those buffer sizes directly from the .x files or something?

Quoted 1 line

And besides, the RPC buffers are all a fixed size (2kiB), and much larger than required already. The slack is "built in" to the buffer size.

OK. Do we know of any calls or replies that are close to that limit?

In general the big piece of the call and reply headers are the credentials and verifiers. Every NFS operation that sends or receives a large call or reply does so by using the page cache, ACLs included.

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

PATCH 14/15 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. Add compile-time checks to ensure the hostname string won't overflow NLM protocol maximums.

---

 fs/lockd/xdr.c              |   13 ++++++++-----
 fs/lockd/xdr4.c             |   17 ++++++++++++-----
 include/linux/lockd/lockd.h |    2 +-
 3 files changed, 21 insertions(+), 11 deletions(-)
fs/lockd/xdr.c +8 -5
index 75dd023..1644248 100644
@@ -510,17 +510,20 @@ nlmclt_decode_res(struct rpc_rqst *req, 
 	return 0;
 }
 
+#if (NLMCLNT_OHSIZE > XDR_MAX_NETOBJ)
+#  error "NLM host name can be larger than XDR_MAX_NETOBJ!"
+#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_caller_sz		1+XDR_QUADLEN(NLMCLNT_OHSIZE)
+#define NLM_owner_sz		1+XDR_QUADLEN(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 +12 -5
index d354f3f..3d7baa6 100644
@@ -516,17 +516,24 @@ nlm4clt_decode_res(struct rpc_rqst *req,
 	return 0;
 }
 
+#if (NLMCLNT_OHSIZE > XDR_MAX_NETOBJ)
+#  error "NLM host name can be larger than XDR_MAX_NETOBJ!"
+#endif
+
+#if (NLMCLNT_OHSIZE > NLM_MAXSTRLEN)
+#  error "NLM host name can be larger than NLM's maximum string length!"
+#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(NLMCLNT_OHSIZE)
+#define NLM4_owner_sz		1+XDR_QUADLEN(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
include/linux/lockd/lockd.h +1 -1
index ac25b56..f6a81e0 100644
@@ -88,7 +88,7 @@ struct nlm_wait;
 /*
  * Memory chunk for NLM client RPC request.
  */
-#define NLMCLNT_OHSIZE		(sizeof(utsname()->nodename)+10)
+#define NLMCLNT_OHSIZE		((__NEW_UTS_LEN) + 10u)
 struct nlm_rqst {
 	unsigned int		a_flags;	/* initial RPC task flags */
 	struct nlm_host *	a_host;		/* host handle */

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

PATCH 15/15 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 e885ae5..423c905 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);
 
@@ -554,6 +554,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 */
@@ -664,6 +666,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,
@@ -681,6 +685,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)) {
@@ -701,6 +707,8 @@ call_reserveresult(struct rpc_task *task
 {
 	int status = task->tk_status;
 
+	rpc_new_task_state();
+
 	dprint_status(task);
 
 	/*
@@ -756,6 +764,8 @@ call_allocate(struct rpc_task *task)
 	struct rpc_xprt *xprt = task->tk_xprt;
 	struct rpc_procinfo *proc = task->tk_msg.rpc_proc;
 
+	rpc_new_task_state();
+
 	dprint_status(task);
 
 	task->tk_status = 0;
@@ -868,6 +878,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;
@@ -886,6 +898,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;
@@ -934,6 +948,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"));
@@ -956,6 +972,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;
@@ -988,6 +1006,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;
@@ -1025,7 +1045,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().
@@ -1046,6 +1069,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;
 
@@ -1099,6 +1124,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;
@@ -1138,6 +1165,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);
 
@@ -1200,6 +1229,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 */
@@ -1217,6 +1248,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