generic/233,270: unlimit the max locked memory size for io_uring
authorZorro Lang <zlang@redhat.com>
Tue, 30 Mar 2021 00:59:42 +0000 (08:59 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 11 Apr 2021 08:05:35 +0000 (16:05 +0800)
The ltp/fsstress always fails on io_uring_queue_init() by returnning
ENOMEM. Due to io_uring accounts memory it needs under the rlimit
memlocked option, which can be quite low on some setups, especially
on 64K pagesize machine. root isn't under this restriction, but
regular users are. So only g/233 and g/270 which use $qa_user to run
fsstress are failed.

To avoid this failure, set max locked memory to unlimited before
doing fsstress, then restore it after test done.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/233
tests/generic/270

index 7eda5774430c625a3a3190b2f9ce526dba553c5a..cc794c7917302b88008f0e9404c77a0deac9c4c1 100755 (executable)
@@ -43,6 +43,12 @@ _fsstress()
 -f rename=10 -f fsync=2 -f write=15 -f dwrite=15 \
 -n $count -d $out -p 7`
 
 -f rename=10 -f fsync=2 -f write=15 -f dwrite=15 \
 -n $count -d $out -p 7`
 
+       # io_uring accounts memory it needs under the rlimit memlocked option,
+       # which can be quite low on some setups (especially 64K pagesize). root
+       # isn't under this restriction, but regular users are. To avoid the
+       # io_uring_queue_init fail on ENOMEM, set max locked memory to unlimited
+       # temporarily.
+       ulimit -l unlimited
        echo "fsstress $args" >> $seqres.full
        if ! su $qa_user -c "$FSSTRESS_PROG $args" | tee -a $seqres.full | _filter_num
        then
        echo "fsstress $args" >> $seqres.full
        if ! su $qa_user -c "$FSSTRESS_PROG $args" | tee -a $seqres.full | _filter_num
        then
index 3d8656d4c950c4356a3ba955e2c5e5f531cde371..e93940ef911f0822c3102bc4f5d2884844db9578 100755 (executable)
@@ -37,6 +37,12 @@ _workout()
        cp $FSSTRESS_PROG  $tmp.fsstress.bin
        $SETCAP_PROG cap_chown=epi  $tmp.fsstress.bin
 
        cp $FSSTRESS_PROG  $tmp.fsstress.bin
        $SETCAP_PROG cap_chown=epi  $tmp.fsstress.bin
 
+       # io_uring accounts memory it needs under the rlimit memlocked option,
+       # which can be quite low on some setups (especially 64K pagesize). root
+       # isn't under this restriction, but regular users are. To avoid the
+       # io_uring_queue_init fail on ENOMEM, set max locked memory to unlimited
+       # temporarily.
+       ulimit -l unlimited
        (su $qa_user -c "$tmp.fsstress.bin $args" &) > /dev/null 2>&1
 
        echo "Run dd writers in parallel"
        (su $qa_user -c "$tmp.fsstress.bin $args" &) > /dev/null 2>&1
 
        echo "Run dd writers in parallel"