* larger temp buffer for cfs_get_environ(), then
* truncating the string at some separator to fit into
* the specified jobid_len. Fix later if needed. */
- LCONSOLE_ERROR_MSG(0x16b,
- "jobid: '%s' value too large (%d)\n",
- obd_jobid_var, *jobid_len);
+ LCONSOLE_WARN("jobid: '%s' value too large (%d)\n",
+ obd_jobid_var, *jobid_len);
printed = true;
rc = 0;
}
pidmap->jp_jobid[0] = '\0';
spin_lock_init(&pidmap->jp_lock);
INIT_HLIST_NODE(&pidmap->jp_hash);
+ /*
+ * @pidmap might be reclaimed just after it is added into
+ * hash list, init @jp_refcount as 1 to make sure memory
+ * could be not freed during access.
+ */
+ atomic_set(&pidmap->jp_refcount, 1);
/*
* Add the newly created map to the hash, on key collision we
pid);
OBD_FREE_PTR(pidmap);
pidmap = pidmap2;
- } else {
- cfs_hash_get(jobid_hash, &pidmap->jp_hash);
}
}