From: Jens Axboe Date: Thu, 13 Mar 2014 14:49:28 +0000 (-0600) Subject: Disable status file updates on error X-Git-Tag: fio-2.1.7~12 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=77d9967586f9cc8d445056510e25be4eeded2689 Disable status file updates on error If fio doesn't have permission to unlink() the status file, it'll continually dump status updates. If this happens, stop doing status updates and log an error indicating why. Signed-off-by: Jens Axboe --- diff --git a/stat.c b/stat.c index f018f33d..c2c717b5 100644 --- a/stat.c +++ b/stat.c @@ -1479,6 +1479,7 @@ void show_running_run_stats(void) static int status_interval_init; static struct timeval status_time; +static int status_file_disabled; #define FIO_STATUS_FILE "fio-dump-status" @@ -1488,6 +1489,9 @@ static int check_status_file(void) const char *temp_dir; char fio_status_file_path[PATH_MAX]; + if (status_file_disabled) + return 0; + temp_dir = getenv("TMPDIR"); if (temp_dir == NULL) temp_dir = getenv("TEMP"); @@ -1499,7 +1503,13 @@ static int check_status_file(void) if (stat(fio_status_file_path, &sb)) return 0; - unlink(fio_status_file_path); + if (unlink(fio_status_file_path) < 0) { + log_err("fio: failed to unlink %s: %s\n", fio_status_file_path, + strerror(errno)); + log_err("fio: disabling status file updates\n"); + status_file_disabled = 1; + } + return 1; }