summaryrefslogtreecommitdiffstats
path: root/utils/gssd
diff options
context:
space:
mode:
authorSean Finney <sean.finney@sonyericsson.com>2011-04-19 11:04:35 -0400
committerSteve Dickson <steved@redhat.com>2011-04-19 12:30:34 -0400
commit5604b35a61e22930873ffc4e9971002f578e7978 (patch)
tree814c7c116b757e194e1d62a185eaf8faccf9ec74 /utils/gssd
parent9274e94db85bac04e170414cb8e0f4be271cde90 (diff)
downloadnfs-utils-5604b35a61e22930873ffc4e9971002f578e7978.tar.gz
nfs-utils-5604b35a61e22930873ffc4e9971002f578e7978.tar.xz
nfs-utils-5604b35a61e22930873ffc4e9971002f578e7978.zip
nfs-utils: Increase the stdio file buffer size for procfs files
Previously, when writing to /proc/net/rpc/*/channel, if a cache line were larger than the default buffer size (likely 1024 bytes), mountd and svcgssd would split writes into a number of buffer-sized writes. Each of these writes would get an EINVAL error back from the kernel procfs handle (it expects line-oriented input and does not account for multiple/split writes), and no cache update would occur. When such behavior occurs, NFS clients depending on mountd to finish the cache operation would block/hang, or receive EPERM, depending on the context of the operation. This is likely to happen if a user is a member of a large (~100-200) number of groups. Instead, every fopen() on the procfs files in question is followed by a call to setvbuf(), using a per-file dedicated buffer of RPC_CHAN_BUF_SIZE length. Really, mountd should not be using stdio-style buffered file operations on files in /proc to begin with. A better solution would be to use internally managed buffers and calls to write() instead of these stdio calls, but that would be a more extensive change; so this is proposed as a quick and not-so-dirty fix in the meantime. Signed-off-by: Sean Finney <sean.finney@sonyericsson.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/gssd')
-rw-r--r--utils/gssd/svcgssd_proc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/utils/gssd/svcgssd_proc.c b/utils/gssd/svcgssd_proc.c
index 7a916d7..c714d99 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"
#include "gss_oids.h"
#include "svcgssd_krb5.h"
@@ -71,6 +72,7 @@ struct svc_cred {
int cr_ngroups;
gid_t cr_groups[NGROUPS];
};
+static char vbuf[RPC_CHAN_BUF_SIZE];
static int
do_svc_downcall(gss_buffer_desc *out_handle, struct svc_cred *cred,
@@ -92,6 +94,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 */