From: Jens Axboe Date: Mon, 23 Jul 2007 12:36:00 +0000 (+0200) Subject: Only do the root warning once per thread X-Git-Tag: fio-1.17~58 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=7172cfe8e0e918cc279eb501986f6ec78cc7aad9 Only do the root warning once per thread Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index 7a9a2afe..b742f825 100644 --- a/filesetup.c +++ b/filesetup.c @@ -9,6 +9,8 @@ #include "fio.h" +static int root_warn; + static int extend_file(struct thread_data *td, struct fio_file *f) { int r, new_layout = 0, unlink_file = 0, flags; @@ -178,7 +180,10 @@ int file_invalidate_cache(struct thread_data *td, struct fio_file *f) else if (f->filetype == FIO_TYPE_BD) { ret = blockdev_invalidate_cache(f->fd); if (ret < 0 && errno == EACCES && geteuid()) { - log_err("fio: only root may flush block devices. Cache flush bypassed!\n"); + if (!root_warn) { + log_err("fio: only root may flush block devices. Cache flush bypassed!\n"); + root_warn = 1; + } ret = 0; } } else if (f->filetype == FIO_TYPE_CHAR || f->filetype == FIO_TYPE_PIPE)