in lprocfs_exp_setup, save the nid string gotten from
libcfs_nid2str into a temporary buffer before calling
lprocfs_register to create proc directory, then to
avoid the race on the internal nid string buffer.
i=johann@sun.com
i=zhen.liang@sun.com
* between getting its string and using it.
*/
* between getting its string and using it.
*/
-#define LNET_NIDSTR_COUNT 128 /* # of nidstrings */
-#define LNET_NIDSTR_SIZE 32 /* size of each one (see below for usage) */
-
static char libcfs_nidstrings[LNET_NIDSTR_COUNT][LNET_NIDSTR_SIZE];
static int libcfs_nidstring_idx = 0;
static char libcfs_nidstrings[LNET_NIDSTR_COUNT][LNET_NIDSTR_SIZE];
static int libcfs_nidstring_idx = 0;
#include <lnet/types.h>
#include <lnet/api.h>
#include <lnet/types.h>
#include <lnet/api.h>
+#define LNET_NIDSTR_COUNT 1024 /* # of nidstrings */
+#define LNET_NIDSTR_SIZE 32 /* size of each one (see below for usage) */
+
struct nid_stat *new_stat, *old_stat;
struct obd_device *obd = NULL;
cfs_proc_dir_entry_t *entry;
struct nid_stat *new_stat, *old_stat;
struct obd_device *obd = NULL;
cfs_proc_dir_entry_t *entry;
GOTO(destroy_new, rc = -EALREADY);
}
/* not found - create */
GOTO(destroy_new, rc = -EALREADY);
}
/* not found - create */
- new_stat->nid_proc = lprocfs_register(libcfs_nid2str(*nid),
+ OBD_ALLOC(buffer, LNET_NIDSTR_SIZE);
+ if (buffer == NULL)
+ GOTO(destroy_new, rc = -ENOMEM);
+
+ memcpy(buffer, libcfs_nid2str(*nid), LNET_NIDSTR_SIZE);
+ new_stat->nid_proc = lprocfs_register(buffer,
obd->obd_proc_exports_entry,
NULL, NULL);
obd->obd_proc_exports_entry,
NULL, NULL);
+ OBD_FREE(buffer, LNET_NIDSTR_SIZE);
+
if (new_stat->nid_proc == NULL) {
CERROR("Error making export directory for nid %s\n",
libcfs_nid2str(*nid));
if (new_stat->nid_proc == NULL) {
CERROR("Error making export directory for nid %s\n",
libcfs_nid2str(*nid));