[LTP] [PATCH] fs_fill: switch the SAFE MACROs back to ordinary syscall

Jan Stancek jstancek@redhat.com
Wed Nov 22 13:48:30 CET 2017


----- 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

Regards,
Jan


More information about the ltp mailing list