FS/XFS testing framework
 help / color / mirror / Atom feed
From: stsp <stsp2@yandex.ru>
To: Murphy Zhou <xzhou@redhat.com>, Jeff Layton <jlayton@kernel.org>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] t_ofd_locks: fix initialization sequence
Date: Thu, 6 Jul 2023 13:54:24 +0500	[thread overview]
Message-ID: <332cedf4-3580-86f8-3fd6-de32b67f155e@yandex.ru> (raw)
In-Reply-To: <CALWRkkjb9hMmoHf3xa93mAEJBFM3hjB5K4dkWL+659dSGa0qsA@mail.gmail.com>


06.07.2023 13:41, Murphy Zhou пишет:
> Signed-off-by: Stas Sergeev <stsp2@yandex.ru>
> ---
>   src/t_ofd_locks.c | 73 ++++++++++++++++++++++++++++++-----------------
>   1 file changed, 47 insertions(+), 26 deletions(-)
>
> diff --git a/src/t_ofd_locks.c b/src/t_ofd_locks.c
> index e77f2659..daa6f96c 100644
> --- a/src/t_ofd_locks.c
> +++ b/src/t_ofd_locks.c
> @@ -297,6 +297,7 @@ int main(int argc, char **argv)
>                        semid = semget(semkey, 2, IPC_CREAT|IPC_EXCL);
>                        if (semid < 0 && errno == EEXIST) {
>                                /* remove sem set after one round of test */
> +                             semid = semget(semkey, 2, IPC_CREAT);
>                                if (semctl(semid, 2, IPC_RMID, semu) == -1)
> Good catch. This RMID is useless unless we have got the existing
> semaphore. According to SEMGET(2), seems should be:
>
>      semid = semget(semkey, 2, 0);
>
> to obtain an existing semaphore?

Yes, I just wanted to avoid the purely
theoretical condition when someone
else removed this sem right before we
did second semget(). So I added IPC_CREAT
just as a safety measure.
Should I remove it?

> The while loop makes sure we get the semaphore before continuing
> the test. It's been some time, I'm not sure but now I really can't see
> this really hurts.
What while loop do you mean and what
doesn't hurt? Does the rest of the patch
look ok?

  reply	other threads:[~2023-07-06  8:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30  9:40 [PATCH] t_ofd_locks: fix initialization sequence Stas Sergeev
2023-07-05 12:26 ` Jeff Layton
2023-07-06  8:41   ` Murphy Zhou
2023-07-06  8:54     ` stsp [this message]
2023-07-09  9:17       ` stsp
2023-07-10  4:27       ` Murphy Zhou
2023-07-10  6:18         ` stsp
2023-07-31 11:34         ` stsp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=332cedf4-3580-86f8-3fd6-de32b67f155e@yandex.ru \
    --to=stsp2@yandex.ru \
    --cc=fstests@vger.kernel.org \
    --cc=jlayton@kernel.org \
    --cc=xzhou@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox