public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Jan Kara <jack@suse.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] inotify: Add test for inotify mark destruction race
Date: Thu, 30 Jul 2015 14:57:03 +0200	[thread overview]
Message-ID: <20150730125703.GE18339@rei.suse.de> (raw)
In-Reply-To: <1438016307-28805-1-git-send-email-jack@suse.com>

Hi!
> +	for (lc = 0; TEST_LOOPING(lc); lc++) {
> +		pid = fork();
> +		if (pid == 0) {
> +			while (1) {
> +				for (i = 0; i < FILES; i++) {
> +					fd = SAFE_OPEN(cleanup, names[i],
> +						       O_CREAT | O_RDWR, 0600);
> +					SAFE_CLOSE(cleanup, fd);
> +				}
> +				for (i = 0; i < FILES; i++)
> +					SAFE_UNLINK(cleanup, names[i]);
> +			}
> +		} else if (pid == -1)
> +			tst_brkm(TBROK | TERRNO, cleanup, "fork() failed");
> +
> +		start = time(NULL);
> +		while (time(NULL) - start < DURATION) {

Using time() for measuring how long something has been executed is not a
good idea for several reasons. Can't we settle for large enough number
of iterations instead?

> +			inotify_fd = syscall(__NR_inotify_init1, O_NONBLOCK);
> +			if (inotify_fd < 0) {
> +				if (errno == ENOSYS) {
> +					tst_brkm(TCONF, cleanup,
> +					 	 "inotify is not configured in this "
> +						 "kernel.");
> +				} else {
> +					tst_brkm(TBROK | TERRNO, cleanup,
> +						 "inotify_init failed");
> +				}
> +			}

The rest looks good to me.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

      parent reply	other threads:[~2015-07-30 12:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1438016307-28805-1-git-send-email-jack@suse.com>
2015-07-28  6:47 ` [LTP] [PATCH] inotify: Add test for inotify mark destruction race Jan Stancek
2015-07-28  8:49   ` Jan Kara
2015-07-30 12:57 ` Cyril Hrubis [this message]

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=20150730125703.GE18339@rei.suse.de \
    --to=chrubis@suse.cz \
    --cc=jack@suse.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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