bumped_running accessed without lock
Multiple threads man increment shared_data->running until
the setting of bumped_running becomes visible.
Also, use "bool" -- First released in Issue 6 of POSIX spec:
included for alignment with the ISO/IEC 9899:1999 standard
When inserting #include <stdbool.h>, it was noticed that stdio.h was
included twice. Collected and ordered system headers so that
won't happen again.
Signed-off-by: Bruce Korb <bruce_korb@xyratex.com>
Change-Id: I45891e125221d29f72efee38580a56888c3a266f
Reviewed-on: http://review.whamcloud.com/1749
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: wangdi <di.wang@whamcloud.com>
* Author: Robert Read <rread@clusterfs.com>
*/
* Author: Robert Read <rread@clusterfs.com>
*/
+#include <sys/stat.h>
+#include <sys/time.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <signal.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
#include "obdctl.h"
#include <obd.h> /* for struct lov_stripe_md */
#include <lustre/lustre_build_version.h>
#include "obdctl.h"
#include <obd.h> /* for struct lov_stripe_md */
#include <lustre/lustre_build_version.h>
-#include <unistd.h>
-#include <sys/un.h>
-#include <time.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <string.h>
-
#include <obd_class.h>
#include <lnet/lnetctl.h>
#include <libcfs/libcfsutil.h>
#include <obd_class.h>
#include <lnet/lnetctl.h>
#include <libcfs/libcfsutil.h>
#include <lustre/liblustreapi.h>
#define MAX_STRING_SIZE 128
#include <lustre/liblustreapi.h>
#define MAX_STRING_SIZE 128
static inline void shmem_bump(void)
{
static inline void shmem_bump(void)
{
- static int bumped_running;
+ static bool running_not_bumped = true;
if (shared_data == NULL || thread <= 0 || thread > MAX_THREADS)
return;
shmem_lock();
shared_data->counters[thread - 1]++;
if (shared_data == NULL || thread <= 0 || thread > MAX_THREADS)
return;
shmem_lock();
shared_data->counters[thread - 1]++;
+ if (running_not_bumped) {
+ running_not_bumped = false;
+ }
}
static void shmem_snap(int total_threads, int live_threads)
}
static void shmem_snap(int total_threads, int live_threads)