Use the reentrant getmntent_r instead of getmntent
authorZhu Yanhai <zhu.yanhai@gmail.com>
Tue, 22 Nov 2011 08:35:29 +0000 (09:35 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 22 Nov 2011 08:35:29 +0000 (09:35 +0100)
commit599e72b74ed2c44fd846b95160c5037c16438994
treea41c51b7a4887663acc2fca2429b94fc3c2c3268
parent8a3220572e1016ea011bd9dcf61a5bfb731c1a43
Use the reentrant getmntent_r instead of getmntent

The function find_cgroup_mnt() could be called under multithread scenario, so
we should use the reentrant edition getmntent_r() instead of getmntent().

E.g, without this fix the output for below job file is wrong.

[root@localhost blkio-test]# cat small-read-file
[global]
ioengine=sync
direct=1
rw=read
bs=4k
filename=/dev/sdb
time_based
runtime=60
cgroup=small
cgroup_weight=500
numjobs=32
group_reporting
thread

[file1]

Then fio randomly says:
[cut here]
Starting 32 threads
fio: cgroup blkio does not appear to be mounted
fio: cgroup blkio does not appear to be mounted
fio: cgroup blkio does not appear to be mounted

Signed-off-by: Jens Axboe <axboe@kernel.dk>
cgroup.c