]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
t_ofd_locks: fix sem initialization sequence
authorStas Sergeev <stsp2@yandex.ru>
Tue, 1 Aug 2023 17:52:20 +0000 (22:52 +0500)
committerZorro Lang <zlang@kernel.org>
Fri, 18 Aug 2023 18:44:54 +0000 (02:44 +0800)
commitae154c192b954f9bfacf2704a2f546149cd52c4e
tree09defffcaa0e72fd9da781b94d88fbbb17da6543
parent857c18868a0e34ca140e3162bccc44024c649e12
t_ofd_locks: fix sem initialization sequence

The locker was waiting for sem_otime on sem0 to became non-zero after
incrementing sem0 himself. So sem_otime was never 0 at the time of
checking it, so the check was redundant/wrong.

This patch:
- moves the increment of sem1 to the lock-tester site
- lock-setter waits for that sem1 event, for which this patch replaces
  the wait loop on sem_otime with GETVAL loop, adding a small sleep
- increment of sem0 to 2 moved past that sem1 event. That sem0 event
  is currently not used/waited.

This guarantees that the lock-setter is working only after lock-getter
is fully initialized.

CC: fstests@vger.kernel.org
CC: Murphy Zhou <xzhou@redhat.com>
CC: Jeff Layton <jlayton@kernel.org>
CC: Zorro Lang <zlang@redhat.com>
Signed-off-by: Stas Sergeev <stsp2@yandex.ru>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
src/t_ofd_locks.c