static int ptlrpcd_init(void)
{
- int nthreads = num_online_cpus();
- char name[16];
- int size, i = -1, j, rc = 0;
+ int nthreads = num_online_cpus();
+ char name[16];
+ int size, i = -1, j, rc = 0;
ENTRY;
#ifdef __KERNEL__
ptlrpcds = NULL;
}
- RETURN(0);
+ RETURN(rc);
}
int ptlrpcd_addref(void)
ENTRY;
mutex_lock(&ptlrpcd_mutex);
- if (++ptlrpcd_users == 1)
- rc = ptlrpcd_init();
+ if (++ptlrpcd_users == 1) {
+ rc = ptlrpcd_init();
+ if (rc < 0)
+ ptlrpcd_users--;
+ }
mutex_unlock(&ptlrpcd_mutex);
RETURN(rc);
}