public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] fs_fill: switch the SAFE MACROs back to ordinary syscall
Date: Wed, 22 Nov 2017 07:51:29 -0500 (EST)	[thread overview]
Message-ID: <1410675646.43959033.1511355089017.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1075630177.43956420.1511354910460.JavaMail.zimbra@redhat.com>



----- Original Message -----
> 
> ----- Original Message -----
> > Hi!
> > > > But I can always change that in a follow up patch...
> > > 
> > > How about this following change:
> > > 
> > > --- a/testcases/kernel/fs/fs_fill/fs_fill.c
> > > +++ b/testcases/kernel/fs/fs_fill/fs_fill.c
> > > @@ -41,21 +41,11 @@ struct worker {
> > > 
> > >  static void *worker(void *p)
> > >  {
> > > -       int ret;
> > >         struct worker *w = p;
> > >         DIR *d;
> > >         struct dirent *ent;
> > >         char file[PATH_MAX];
> > > 
> > > -       ret = mkdir(w->dir, 0700);
> > > -       if (ret == -1) {
> > > -               if (errno != ENOSPC)
> > > -                       tst_brk(TBROK | TERRNO, "mkdir()");
> > > -
> > > -               tst_res(TINFO | TERRNO, "mkdir()");
> > > -               return NULL;
> > > -       }
> > > -
> > >         while (run) {
> > >                 tst_fill_fs(w->dir, 0);
> > > 
> > > @@ -92,6 +82,10 @@ static void testrun(void)
> > >         for (i = 0; i < nthreads; i++) {
> > >                 snprintf(workers[i].dir, sizeof(workers[i].dir),
> > >                          MNTPOINT "/thread%i", i + 1);
> > > +               SAFE_MKDIR(workers[i].dir, 0700);
> > > +       }
> > > +
> > > +       for (i = 0; i < nthreads; i++) {
> > >                 SAFE_PTHREAD_CREATE(&threads[i], NULL, worker,
> > >                 &workers[i]);
> > >         }
> > 
> > This one looks cleaner to me.
> 
> But perhaps this should go to setup(), otherwise with "-i 2"
> it hits TBROK on mkdir.
> 
> I tried adding RMDIR after join, but unlink doesn't seem to remove
> everything:
> safe_macros.c:184: BROK: fs_fill.c:108: rmdir(mntpoint/thread4) failed:
> ENOTEMPTY

I see, there's "break" in loop that does unlink. Which is likely by design,
so we hit ENOSPC sooner.

> 
> Regards,
> Jan
> 
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
> 

  reply	other threads:[~2017-11-22 12:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 11:15 [LTP] [PATCH] fs_fill: switch the SAFE MACROs back to ordinary syscall Li Wang
2017-11-20 11:18 ` Jan Stancek
2017-11-20 13:19   ` Cyril Hrubis
2017-11-21  4:14     ` Li Wang
2017-11-21  9:44       ` Cyril Hrubis
2017-11-22 12:48         ` Jan Stancek
2017-11-22 12:51           ` Jan Stancek [this message]
2017-11-22 13:29             ` Cyril Hrubis
2017-11-22 13:27           ` Cyril Hrubis

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=1410675646.43959033.1511355089017.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --cc=ltp@lists.linux.it \
    /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