From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v1] Test statx() with flag AT_NO_AUTOMOUNT.
Date: Fri, 5 Oct 2018 15:04:15 +0200 [thread overview]
Message-ID: <20181005130415.GA5299@rei> (raw)
In-Reply-To: <4bce235b57e880880c53fc56c6b8c20f.squirrel@pike.zilogic.com>
Hi!
> >> + pid = SAFE_FORK();
> >> + if (!pid) {
> >> + setpgrp();
> >
> > Why do you do this?
>
> * Parent is getting the autofs notification message only by setting
> the process group ID of the child process to it's process ID.
Ah, right, I remember that now, kernel checks that the process is in a
different process group before it attempts to send the event. Maybe we
should include the comment I had in the example code here so that it's
clear why it's needed.
> >> + TEST(statx(AT_FDCWD, MNTPOINT,
> >> + (automount) ? 0 : AT_NO_AUTOMOUNT,
> >> + 0, &file_info)
> >> + );
> >> +
> >> + if (TST_RET == -1) {
> >> + /* 1 -> statx() fail*/
> >> + value = 1;
> >> + SAFE_WRITE(1, ev_fd, &value, sizeof(value));
> >> +
> >> + exit(1);
> >> + }
> >> +
> >> + /* 2 -> statx() pass*/
> >> + value = 2;
> >> + SAFE_WRITE(1, ev_fd, &value, sizeof(value));
> >
> > There is no need to propagate anything from the child process, if you
> > call tst_res(TPASS, ...) in the child process the result will be
> > propagated automatically to the parent. So there is no need for the
> > eventfd at all.
>
> * Parent won't get any autofs request from child if,
> ** statx fails
> ** statx with AT_NO_AUTOMOUNT flag
>
> We tried using event_fd() in order to identify between these two
> scenarios and read from pipe only if statx passed.
> Breaking the test from the child if statx fails is not affecting the
> parent.
You can still do tst_brk(TBROK | TERRNO, "statx() failed"); in the child
which will propagate to the parent and fail the test eventually. The
only difference that this will happen once the parent test process
exists after it prints PASS message since the select timeouted as we
didn't get any notification.
So the output will looks like:
PASS: statx() succeeded
PASS: Got notification without AT_NO_AUTOMOUNT
BROK: statx() failed: EIVAL
PASS: Didn't get notification with AT_NO_AUTOMOUNT
BROK: Reported by child (3243)
and the exit value will non-zero since the test have been failed by the
child process.
--
Cyril Hrubis
chrubis@suse.cz
prev parent reply other threads:[~2018-10-05 13:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 11:27 [LTP] [PATCH v1] Test statx() with flag AT_NO_AUTOMOUNT Vishnu K
2018-10-04 10:41 ` Cyril Hrubis
2018-10-05 12:35 ` vishnu
2018-10-05 13:04 ` 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=20181005130415.GA5299@rei \
--to=chrubis@suse.cz \
--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