@@ -6,6 +6,7 @@
#include <stdarg.h>
#include <pthread.h>
#include <sys/mman.h>
+#include <limits.h>
#include <memory.h>
@@ -61,6 +62,7 @@
void log_thread_start (void)
{
+ size_t stacksize = 64 * 1024;
pthread_attr_t attr;
logdbg(stderr,"enter log_thread_start\n");
@@ -74,7 +76,9 @@
pthread_cond_init(logev_cond, NULL);
pthread_attr_init(&attr);
- pthread_attr_setstacksize(&attr, 64 * 1024);
+ if (stacksize < PTHREAD_STACK_MIN)
+ stacksize = PTHREAD_STACK_MIN;
+ pthread_attr_setstacksize(&attr, stacksize);
if (log_init("multipathd", 0)) {
fprintf(stderr,"can't initialize log buffer\n");
@@ -199,6 +199,7 @@
int start_waiter_thread (struct multipath *mpp, struct vectors *vecs)
{
+ size_t stacksize = 32 * 1024;
pthread_attr_t attr;
struct event_thread *wp;
@@ -208,7 +209,9 @@
if (pthread_attr_init(&attr))
goto out;
- pthread_attr_setstacksize(&attr, 32 * 1024);
+ if (stacksize < PTHREAD_STACK_MIN)
+ stacksize = PTHREAD_STACK_MIN;
+ pthread_attr_setstacksize(&attr, stacksize);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
wp = alloc_waiter();
@@ -362,6 +362,7 @@
struct path * pp;
char empty_buff[WWID_SIZE] = {0};
int ret;
+ int retrys = 10;
ret = device_ok_to_add(devname);
if (ret < 0)
@@ -439,9 +440,10 @@
/*
* deal with asynchronous uevents :((
*/
- if (mpp->action == ACT_RELOAD) {
+ if (mpp->action == ACT_RELOAD & retrys > 0) {
condlog(0, "%s: uev_add_path sleep", mpp->alias);
sleep(1);
+ retrys--;
update_mpp_paths(mpp, vecs->pathvec);
goto rescan;
}
@@ -1243,7 +1245,6 @@
static int
unmount_extra_devs(void)
{
- int ret;
char buf[LINE_MAX];
FILE *file;
@@ -1276,7 +1277,7 @@
}
}
fclose(file);
- return ret;
+ return 0;
}
@@ -1514,6 +1515,7 @@
static int
child (void * param)
{
+ size_t stacksize = 64 * 1024;
pthread_t check_thr, uevent_thr, uxlsnr_thr;
pthread_attr_t attr;
struct vectors * vecs;
@@ -1594,7 +1596,9 @@
* start threads
*/
pthread_attr_init(&attr);
- pthread_attr_setstacksize(&attr, 64 * 1024);
+ if (stacksize < PTHREAD_STACK_MIN)
+ stacksize = PTHREAD_STACK_MIN;
+ pthread_attr_setstacksize(&attr, stacksize);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_create(&check_thr, &attr, checkerloop, vecs);