* [LTP] [PATCH] fcntl36: make sure write threads complete at least 1 loop
@ 2019-02-22 19:01 Jan Stancek
2019-02-23 10:16 ` Murphy Zhou
0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2019-02-22 19:01 UTC (permalink / raw)
To: ltp
A failure has been reported while this test ran on a 1 CPU KVM guest
with 4.20 kernel:
...
fcntl36.c:303: INFO: OFD r/w lock vs POSIX read lock
fcntl36.c:360: FAIL: Unexpected data offset 3072 value 1
I wasn't able to reproduce it, to test the theory that
one of write threads was given time on CPU only after
loop_flag changed. Which means it wasn't able to complete
a single iteration.
This patch makes sure that write threads make at least
one iteration.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/syscalls/fcntl/fcntl36.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/syscalls/fcntl/fcntl36.c b/testcases/kernel/syscalls/fcntl/fcntl36.c
index 2942e4e6adc2..58a37e7bc562 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl36.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl36.c
@@ -95,7 +95,7 @@ static void *fn_ofd_w(void *arg)
.l_pid = 0,
};
- while (loop_flag) {
+ do {
memset(buf, wt, pa->length);
@@ -113,7 +113,7 @@ static void *fn_ofd_w(void *arg)
wt = pa->cnt;
sched_yield();
- }
+ } while (loop_flag);
pthread_barrier_wait(&barrier);
SAFE_CLOSE(fd);
@@ -134,7 +134,7 @@ static void *fn_posix_w(void *arg)
.l_len = pa->length,
};
- while (loop_flag) {
+ do {
memset(buf, wt, pa->length);
@@ -152,7 +152,7 @@ static void *fn_posix_w(void *arg)
wt = pa->cnt;
sched_yield();
- }
+ } while (loop_flag);
pthread_barrier_wait(&barrier);
SAFE_CLOSE(fd);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH] fcntl36: make sure write threads complete at least 1 loop
2019-02-22 19:01 [LTP] [PATCH] fcntl36: make sure write threads complete at least 1 loop Jan Stancek
@ 2019-02-23 10:16 ` Murphy Zhou
2019-02-25 7:24 ` Jan Stancek
0 siblings, 1 reply; 3+ messages in thread
From: Murphy Zhou @ 2019-02-23 10:16 UTC (permalink / raw)
To: ltp
On Fri, Feb 22, 2019 at 08:01:11PM +0100, Jan Stancek wrote:
> A failure has been reported while this test ran on a 1 CPU KVM guest
> with 4.20 kernel:
> ...
> fcntl36.c:303: INFO: OFD r/w lock vs POSIX read lock
> fcntl36.c:360: FAIL: Unexpected data offset 3072 value 1
>
> I wasn't able to reproduce it, to test the theory that
> one of write threads was given time on CPU only after
> loop_flag changed. Which means it wasn't able to complete
> a single iteration.
Ack. Thanks!
>
> This patch makes sure that write threads make at least
> one iteration.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
> testcases/kernel/syscalls/fcntl/fcntl36.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/fcntl/fcntl36.c b/testcases/kernel/syscalls/fcntl/fcntl36.c
> index 2942e4e6adc2..58a37e7bc562 100644
> --- a/testcases/kernel/syscalls/fcntl/fcntl36.c
> +++ b/testcases/kernel/syscalls/fcntl/fcntl36.c
> @@ -95,7 +95,7 @@ static void *fn_ofd_w(void *arg)
> .l_pid = 0,
> };
>
> - while (loop_flag) {
> + do {
>
> memset(buf, wt, pa->length);
>
> @@ -113,7 +113,7 @@ static void *fn_ofd_w(void *arg)
> wt = pa->cnt;
>
> sched_yield();
> - }
> + } while (loop_flag);
>
> pthread_barrier_wait(&barrier);
> SAFE_CLOSE(fd);
> @@ -134,7 +134,7 @@ static void *fn_posix_w(void *arg)
> .l_len = pa->length,
> };
>
> - while (loop_flag) {
> + do {
>
> memset(buf, wt, pa->length);
>
> @@ -152,7 +152,7 @@ static void *fn_posix_w(void *arg)
> wt = pa->cnt;
>
> sched_yield();
> - }
> + } while (loop_flag);
>
> pthread_barrier_wait(&barrier);
> SAFE_CLOSE(fd);
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] fcntl36: make sure write threads complete at least 1 loop
2019-02-23 10:16 ` Murphy Zhou
@ 2019-02-25 7:24 ` Jan Stancek
0 siblings, 0 replies; 3+ messages in thread
From: Jan Stancek @ 2019-02-25 7:24 UTC (permalink / raw)
To: ltp
----- Original Message -----
> On Fri, Feb 22, 2019 at 08:01:11PM +0100, Jan Stancek wrote:
> > A failure has been reported while this test ran on a 1 CPU KVM guest
> > with 4.20 kernel:
> > ...
> > fcntl36.c:303: INFO: OFD r/w lock vs POSIX read lock
> > fcntl36.c:360: FAIL: Unexpected data offset 3072 value 1
> >
> > I wasn't able to reproduce it, to test the theory that
> > one of write threads was given time on CPU only after
> > loop_flag changed. Which means it wasn't able to complete
> > a single iteration.
>
> Ack. Thanks!
>
Pushed.
Regards,
Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-25 7:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22 19:01 [LTP] [PATCH] fcntl36: make sure write threads complete at least 1 loop Jan Stancek
2019-02-23 10:16 ` Murphy Zhou
2019-02-25 7:24 ` Jan Stancek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.