From patchwork Tue Mar 29 07:54:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Finney X-Patchwork-Id: 678711 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2V9bBJR009504 for ; Thu, 31 Mar 2011 09:37:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933501Ab1CaJhJ (ORCPT ); Thu, 31 Mar 2011 05:37:09 -0400 Received: from seldrel01.sonyericsson.com ([212.209.106.2]:11432 "EHLO seldrel01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933435Ab1CaJhI (ORCPT ); Thu, 31 Mar 2011 05:37:08 -0400 Message-ID: From: Sean Finney Date: Tue, 29 Mar 2011 09:54:03 +0200 Subject: [PATCH] Increase the default buffer size for cachelist channel files. To: linux-nfs@vger.kernel.org MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 31 Mar 2011 09:37:11 +0000 (UTC) diff --git a/support/include/misc.h b/support/include/misc.h index 9a1b25d..7e3874e 100644 --- a/support/include/misc.h +++ b/support/include/misc.h @@ -24,4 +24,7 @@ struct hostent *get_reliable_hostbyaddr(const char *addr, int len, int type); extern int is_mountpoint(char *path); +/* size of the file pointer buffers for rpc procfs files */ +#define RPC_CHAN_BUF_SIZE 32768 + #endif /* MISC_H */ diff --git a/utils/gssd/svcgssd_proc.c b/utils/gssd/svcgssd_proc.c index 6f2ba61..8f6548e 100644 --- a/utils/gssd/svcgssd_proc.c +++ b/utils/gssd/svcgssd_proc.c @@ -56,6 +56,7 @@ #include "gss_util.h" #include "err_util.h" #include "context.h" +#include "misc.h" extern char * mech2file(gss_OID mech); #define SVCGSSD_CONTEXT_CHANNEL "/proc/net/rpc/auth.rpcsec.context/channel" @@ -78,6 +79,7 @@ do_svc_downcall(gss_buffer_desc *out_handle, struct svc_cred *cred, FILE *f; int i; char *fname = NULL; + char vbuf[RPC_CHAN_BUF_SIZE]; int err; printerr(1, "doing downcall\n"); @@ -90,6 +92,7 @@ do_svc_downcall(gss_buffer_desc *out_handle, struct svc_cred *cred, SVCGSSD_CONTEXT_CHANNEL, strerror(errno)); goto out_err; } + setvbuf(f, vbuf, _IOLBF, RPC_CHAN_BUF_SIZE); qword_printhex(f, out_handle->value, out_handle->length); /* XXX are types OK for the rest of this? */ /* For context cache, use the actual context endtime */ diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 75a1052..b4bd6cf 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -729,6 +729,7 @@ struct { char *cache_name; void (*cache_handle)(FILE *f); FILE *f; + char vbuf[RPC_CHAN_BUF_SIZE]; } cachelist[] = { { "auth.unix.ip", auth_unix_ip}, { "auth.unix.gid", auth_unix_gid}, @@ -747,6 +748,7 @@ void cache_open(void) continue; sprintf(path, "/proc/net/rpc/%s/channel", cachelist[i].cache_name); cachelist[i].f = fopen(path, "r+"); + setvbuf(cachelist[i].f, cachelist[i].vbuf, _IOLBF, RPC_CHAN_BUF_SIZE); } }