The following changes since commit b921e2e2ff27d9aebc616e77afc4699c036682fe: Close iolog file if reading version string fails (2011-01-05 11:02:30 +0100) are available in the git repository at: git://git.kernel.dk/fio.git master Stefan Hajnoczi (2): Document that write_iolog is unsafe for concurrent jobs setgid first, setuid second HOWTO | 3 ++- README | 4 +++- fio.1 | 4 +++- fio.c | 12 ++++++++---- 4 files changed, 16 insertions(+), 7 deletions(-) --- Diff of recent changes: diff --git a/HOWTO b/HOWTO index dc21afc..7c94329 100644 --- a/HOWTO +++ b/HOWTO @@ -988,7 +988,8 @@ zoneskip=int Skip the specified number of bytes when zonesize data has io on zones of a file. write_iolog=str Write the issued io patterns to the specified file. See - read_iolog. + read_iolog. Specify a separate file for each job, otherwise + the iologs will be interspersed and the file may be corrupt. read_iolog=str Open an iolog with the specified file name and replay the io patterns it contains. This can be used to store a diff --git a/README b/README index 0f91c66..de06fb1 100644 --- a/README +++ b/README @@ -274,7 +274,9 @@ The job file parameters are: and length entries being in bytes. write_iolog=x Write an iolog to file 'x' in the same format as iolog. The iolog options are exclusive, if both given the - read iolog will be performed. + read iolog will be performed. Specify a separate file + for each job, otherwise the iologs will be interspersed + and the file may be corrupt. write_bw_log Write a bandwidth log. write_lat_log Write a latency log. lockmem=x Lock down x amount of memory on the machine, to diff --git a/fio.1 b/fio.1 index eaa1c40..1f1116c 100644 --- a/fio.1 +++ b/fio.1 @@ -743,7 +743,9 @@ Skip the specified number of bytes when \fBzonesize\fR bytes of data have been read. .TP .BI write_iolog \fR=\fPstr -Write the issued I/O patterns to the specified file. +Write the issued I/O patterns to the specified file. Specify a separate file +for each job, otherwise the iologs will be interspersed and the file may be +corrupt. .TP .BI read_iolog \fR=\fPstr Replay the I/O patterns contained in the specified file generated by diff --git a/fio.c b/fio.c index 8dff813..8cc8fcf 100644 --- a/fio.c +++ b/fio.c @@ -1068,14 +1068,18 @@ static void *thread_main(void *data) */ fio_mutex_remove(td->mutex); - if (td->o.uid != -1U && setuid(td->o.uid)) { - td_verror(td, errno, "setuid"); - goto err; - } + /* + * A new gid requires privilege, so we need to do this before setting + * the uid. + */ if (td->o.gid != -1U && setgid(td->o.gid)) { td_verror(td, errno, "setgid"); goto err; } + if (td->o.uid != -1U && setuid(td->o.uid)) { + td_verror(td, errno, "setuid"); + goto err; + } /* * May alter parameters that init_io_u() will use, so we need to -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html