X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fofd_access_log_reader.c;h=44986f6dccde0c9f6b4130fee5d360c8e12606f7;hb=37fd0f145e2410f7a8091e58804dccad43b04afd;hp=75d5a593ecf3d2c75dce1782de37bc96b32b3c15;hpb=6f5d22c9207cc58e5647a5afc576f739727edb2e;p=fs%2Flustre-release.git diff --git a/lustre/utils/ofd_access_log_reader.c b/lustre/utils/ofd_access_log_reader.c index 75d5a59..44986f6 100644 --- a/lustre/utils/ofd_access_log_reader.c +++ b/lustre/utils/ofd_access_log_reader.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -127,6 +128,7 @@ static unsigned int oal_log_major; static unsigned int oal_log_minor_max; static struct alr_batch *alr_batch; static FILE *alr_batch_file; +static pthread_mutex_t alr_batch_file_mutex = PTHREAD_MUTEX_INITIALIZER; static const char *alr_batch_file_path; static int alr_print_fraction = 100; @@ -499,15 +501,8 @@ static int alr_batch_timer_io(int epoll_fd, struct alr_dev *td, unsigned int mas DEBUG_U(expire_count); - rc = alr_batch_print(alr_batch, alr_batch_file, alr_print_fraction); - if (rc < 0) { - ERROR("cannot write to '%s': %s\n", - alr_batch_file_path, strerror(errno)); - goto out; - } - - /* FIXME: blocking write to batch file. */ - rc = fflush(alr_batch_file); + rc = alr_batch_print(alr_batch, alr_batch_file, &alr_batch_file_mutex, + alr_print_fraction); if (rc < 0) { ERROR("cannot write to '%s': %s\n", alr_batch_file_path, strerror(errno));