Execing '$tdir/sleep' with & doesn't guarantee the file is
actually open before returning, so it is sometimes losing
the race with truncate, resulting in errors like this:
/usr/lib64/lustre/tests/sanity.sh: line 4172:
/mnt/lustre/d43b.sanity/sleep: Text file busy
Where $tdir/sleep gets ETXTBSY, instead of truncate as
expected.
A 1 second delay should be enough to guarantee exec wins
the race vs truncate.
Test-Parameters: trivial
Test-Parameters: testgroup=review-ldiskfs-arm
Test-Parameters: testgroup=review-ldiskfs
Test-Parameters: testgroup=review-ldiskfs-arm
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: Ice6f4567805e64c3be755b6c684b6a086a348dd8
Reviewed-on: https://review.whamcloud.com/34791
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
cp -p $(which sleep) $DIR/$tdir/sleep || error "can't copy"
$DIR/$tdir/sleep 60 &
SLEEP_PID=$!
cp -p $(which sleep) $DIR/$tdir/sleep || error "can't copy"
$DIR/$tdir/sleep 60 &
SLEEP_PID=$!
+ # Make sure exec of $tdir/sleep wins race with truncate
+ sleep 1
$MULTIOP $DIR/$tdir/sleep Oc && error "expected error, got success"
kill $SLEEP_PID
}
$MULTIOP $DIR/$tdir/sleep Oc && error "expected error, got success"
kill $SLEEP_PID
}
cp -p $(which sleep) $DIR/$tdir/sleep || error "can't copy"
$DIR/$tdir/sleep 60 &
SLEEP_PID=$!
cp -p $(which sleep) $DIR/$tdir/sleep || error "can't copy"
$DIR/$tdir/sleep 60 &
SLEEP_PID=$!
+ # Make sure exec of $tdir/sleep wins race with truncate
+ sleep 1
$TRUNCATE $DIR/$tdir/sleep 0 && error "expected error, got success"
kill $SLEEP_PID
}
$TRUNCATE $DIR/$tdir/sleep 0 && error "expected error, got success"
kill $SLEEP_PID
}