public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Matthew Bobrowski <mbobrowski@mbobrowski.org>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v4 1/3] syscalls/fanotify13: new test to verify FAN_REPORT_FID functionality
Date: Wed, 19 Jun 2019 12:35:14 +1000	[thread overview]
Message-ID: <20190619023512.GA25967@neo> (raw)
In-Reply-To: <CAOQ4uxgzA83i=rdQX+076_vZ2LE0Vihv1Fc0MXyXS4r-U4a93Q@mail.gmail.com>

On Wed, Jun 19, 2019 at 12:23:34AM +0300, Amir Goldstein wrote:
> > +static void do_test(unsigned int number)
> > +{
> > +       unsigned int i;
> > +       int len, fds[ARRAY_SIZE(objects)];
> > +
> > +       struct file_handle *event_file_handle;
> > +       struct fanotify_event_metadata *metadata;
> > +       struct fanotify_event_info_fid *event_fid;
> > +       struct test_case_t *tc = &test_cases[number];
> > +       struct fanotify_mark_type *mark = &tc->mark;
> > +
> > +       tst_res(TINFO,
> > +               "Test #%d: FAN_REPORT_FID with mark flag: %s",
> > +               number, mark->name);
> > +
> > +       fanotify_fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_FID, O_RDONLY);
> > +       if (fanotify_fd == -1) {
> > +               if (errno == EINVAL) {
> > +                       tst_res(TCONF,
> > +                               "FAN_REPORT_FID not supported by kernel");
> > +                       return;
> > +               }
> > +               tst_brk(TBROK | TERRNO,
> > +                       "fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_FID, "
> > +                       "O_RDONLY) failed");
> > +       }
> > +
> > +       /* Place marks on a set of objects and setup the expected masks
> > +        * for each event that is expected to be generated
> > +        */
> > +       if (setup_marks(fanotify_fd, tc) != 0)
> > +               return;
> > +
> 
> Sorry, just notices a test bug.
> fanotify_fd needs to be closed before returning from this function,
> because next test case is going to overwrite fanotify_fd.
> do_cleanup() is called only at end of entire test or on tst_brk().
> 
> This needs to be fixed for fanotify14 and fanotify15 as well.

Ah, yes. Thank you Amir and good spotting. I've also updated
TST_TEST_CONF() to TST_TEST_TCONF(). The branch containing these updates
can be found here:
	- https://github.com/matthewbobrowski/ltp/commits/fanotify_dirent	

Please check.
 
> Also, please see my fanotify_dentry branch on github for an extra
> patch to fanotify13 to cover a bug reported by syzbot:
> 
> https://lore.kernel.org/linux-fsdevel/CAOQ4uxhsnOXXVCuOT4p4c_koBMFfprWwdtCPGNGhzprFaJZwRA@mail.gmail.com/T/#t
> 
> Please include this extra patch in your next series posting.

No problem. Applied on top of my fanotify_dirent branch (above).

-- 
Matthew Bobrowski

  reply	other threads:[~2019-06-19  2:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 10:34 [LTP] [PATCH v4 0/3] syscalls/fanotify: FAN_REPORT_FID and Directory Modification Events Matthew Bobrowski
2019-06-17 10:35 ` [LTP] [PATCH v4 1/3] syscalls/fanotify13: new test to verify FAN_REPORT_FID functionality Matthew Bobrowski
2019-06-18 21:23   ` Amir Goldstein
2019-06-19  2:35     ` Matthew Bobrowski [this message]
2019-06-19  5:53       ` Amir Goldstein
2019-06-17 10:35 ` [LTP] [PATCH v4 2/3] syscalls/fanotify14: new test to validate FAN_REPORT_FID interface return values Matthew Bobrowski
2019-06-17 10:35 ` [LTP] [PATCH v4 3/3] syscalls/fanotify15: verify fid for dirent events Matthew Bobrowski

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=20190619023512.GA25967@neo \
    --to=mbobrowski@mbobrowski.org \
    --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