From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/ioctl_loop05: Ensure do zero offset in kernel always
Date: Fri, 8 May 2020 17:00:13 +0800 [thread overview]
Message-ID: <5EB51F9D.6080404@cn.fujitsu.com> (raw)
In-Reply-To: <1588918535-4682-1-git-send-email-xuyang2018.jy@cn.fujitsu.com>
On 2020/5/8 14:15, Yang Xu wrote:
> Currently, we use return instead of zero_offset. I debug this code
> (early return, ext4 filesystem)as below:
> ---------------------------------------
> TEST(ioctl(dev_fd, LOOP_SET_DIRECT_IO, 1));
> if (TST_RET == 0) {
> tst_res(TPASS, "LOOP_SET_DIRECT_IO succeeded unexpectedly");
> SAFE_IOCTL(dev_fd, LOOP_SET_DIRECT_IO, 0);
> }
> return;
> ---------------------------------------
> this case will broke when using i parameter,
> ioctl_loop05.c:62: BROK: ioctl(3,LOOP_SET_DIRECT_IO,...) failed: EINVAL (22)
>
> It seems the last test affected this test, so I think we should use
> goto instead of return. Also including a typo, updata->update.
>
> Signed-off-by: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
> ---
> testcases/kernel/syscalls/ioctl/ioctl_loop05.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c b/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
> index 6cf701f47..a103aaa94 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
> @@ -5,7 +5,7 @@
> *
> * This is a basic ioctl test about loopdevice.
> *
> - * It is designed to test LOOP_SET_DIRECT_IO can updata a live
> + * It is designed to test LOOP_SET_DIRECT_IO can update a live
Hi Xu,
What does the line changes?
> * loop device dio mode. It needs the backing file also supports
> * dio mode and the lo_offset is aligned with the logical block size.
> *
> @@ -85,13 +85,14 @@ static void verify_ioctl_loop(void)
> if (TST_RET == 0) {
> tst_res(TPASS, "LOOP_SET_DIRECT_IO succeeded");
> SAFE_IOCTL(dev_fd, LOOP_SET_DIRECT_IO, 0);
> - return;
> + goto zero_offset;
> }
> if (TST_ERR == EINVAL)
> tst_res(TPASS | TTERRNO, "LOOP_SET_DIRECT_IO failed as expected");
> else
> tst_res(TFAIL | TTERRNO, "LOOP_SET_DIRECT_IO failed expected EINVAL got");
>
> +zero_offset:
> loopinfo.lo_offset = 0;
> TST_RETRY_FUNC(ioctl(dev_fd, LOOP_SET_STATUS,&loopinfo), TST_RETVAL_EQ0);
You have cleared the struct loopinfo at the beginning of
verify_ioctl_loop(), so could we just drop loopinfo.lo_offset = 0 and
move 'TST_RETRY_FUNC(ioctl(dev_fd, LOOP_SET_STATUS,&loopinfo),
TST_RETVAL_EQ0);' to the beginning?
Thanks,
Xiao Yang
> }
next prev parent reply other threads:[~2020-05-08 9:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-08 6:15 [LTP] [PATCH] syscalls/ioctl_loop05: Ensure do zero offset in kernel always Yang Xu
2020-05-08 9:00 ` Xiao Yang [this message]
2020-05-08 9:23 ` Yang Xu
2020-05-11 7:55 ` Xiao Yang
2020-05-12 1:41 ` Yang Xu
2020-05-12 2:43 ` Xiao Yang
2020-05-12 3:22 ` Yang Xu
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=5EB51F9D.6080404@cn.fujitsu.com \
--to=yangx.jy@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.