setgid first, setuid second

Setting a new effective gid requires privileges.  We must set the gid
while we potentially still have superuser privileges.  Otherwise
setgid(2) fails because we've already changed to an unprivileged uid.

Here is a test case:
[global]
rw=read
directory=tmp
size=512m
buffered=0

[file1]
uid=1000
gid=1000

Without this patch fio will fail when invoked by root.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
1 file changed