From: zhanghc Date: Thu, 26 Nov 2009 11:22:49 +0000 (+0000) Subject: b=19069 X-Git-Tag: v1_8_2_06~1^2~17 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b95a67cc10bfdef969148b00e85e789843094f21;p=fs%2Flustre-release.git b=19069 save the string returned from libcfs_nid2str into a local alloced buffer, then to avoid problem caused by the buffer storing the string is modified during proc_mkdir. i=johann@sun.com i=zhen.liang@sun.com --- diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 20d010d..a1f3eb1 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -1663,6 +1663,7 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int reconnect, struct nid_stat *new_stat, *old_stat; struct obd_device *obd; cfs_proc_dir_entry_t *entry; + char *buffer = NULL; ENTRY; *newnid = 0; @@ -1710,8 +1711,14 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int reconnect, } /* not found - create */ - new_stat->nid_proc = proc_mkdir(libcfs_nid2str(*nid), - obd->obd_proc_exports_entry); + OBD_ALLOC(buffer, LNET_NIDSTR_SIZE); + if (buffer == NULL) + GOTO(destroy_new_ns, rc = -ENOMEM); + + memcpy(buffer, libcfs_nid2str(*nid), LNET_NIDSTR_SIZE); + new_stat->nid_proc = proc_mkdir(buffer, obd->obd_proc_exports_entry); + OBD_FREE(buffer, LNET_NIDSTR_SIZE); + if (!new_stat->nid_proc) { CERROR("Error making export directory for" " nid %s\n", libcfs_nid2str(*nid));