- bug fix for mtab check. - bug fix for zero length nis key. - update for ifc buffer handling. - bug fix for kernel automount handling. - warning: I found a bunch of patches that were present but not being applied.
60 lines
1.4 KiB
Diff
60 lines
1.4 KiB
Diff
autofs-5.0.3 - fix ifc buff size fix 2
|
|
|
|
From: Ian Kent <raven@themaw.net>
|
|
|
|
For the case of a large number of interfaces there can be
|
|
a lot of malloc(3)s for every mount which could slow things
|
|
down. So we remember the maximum allocation size and use it
|
|
in subsequent allocations.
|
|
---
|
|
|
|
modules/replicated.c | 12 ++++++++++--
|
|
1 files changed, 10 insertions(+), 2 deletions(-)
|
|
|
|
|
|
diff --git a/modules/replicated.c b/modules/replicated.c
|
|
index 35a6675..b435f4b 100644
|
|
--- a/modules/replicated.c
|
|
+++ b/modules/replicated.c
|
|
@@ -62,7 +62,10 @@
|
|
#ifndef MAX_ERR_BUF
|
|
#define MAX_ERR_BUF 512
|
|
#endif
|
|
+
|
|
#define MAX_IFC_BUF 2048
|
|
+static int volatile ifc_buf_len = MAX_IFC_BUF;
|
|
+static int volatile ifc_last_len = 0;
|
|
|
|
#define MASK_A 0x7F000000
|
|
#define MASK_B 0xBFFF0000
|
|
@@ -97,7 +100,7 @@ void seed_random(void)
|
|
|
|
static int alloc_ifreq(struct ifconf *ifc, int sock)
|
|
{
|
|
- int ret, lastlen = 0, len = MAX_IFC_BUF;
|
|
+ int ret, lastlen = ifc_last_len, len = ifc_buf_len;
|
|
char err_buf[MAX_ERR_BUF], *buf;
|
|
|
|
while (1) {
|
|
@@ -119,7 +122,7 @@ static int alloc_ifreq(struct ifconf *ifc, int sock)
|
|
return 0;
|
|
}
|
|
|
|
- if (ifc->ifc_len == lastlen)
|
|
+ if (ifc->ifc_len <= lastlen)
|
|
break;
|
|
|
|
lastlen = ifc->ifc_len;
|
|
@@ -127,6 +130,11 @@ static int alloc_ifreq(struct ifconf *ifc, int sock)
|
|
free(buf);
|
|
}
|
|
|
|
+ if (lastlen != ifc_last_len) {
|
|
+ ifc_last_len = lastlen;
|
|
+ ifc_buf_len = len;
|
|
+ }
|
|
+
|
|
return 1;
|
|
}
|
|
|