All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/copy_file_range02.c: Compatible with new and old kernels
Date: Fri, 31 May 2019 13:01:22 +0200	[thread overview]
Message-ID: <20190531110122.GA8819@rei.lan> (raw)
In-Reply-To: <1559292243-2882-1-git-send-email-huangjh.jy@cn.fujitsu.com>

Hi!
> The patch as follows:
> commit 11cbfb10775a ("vfs: deny copy_file_range() for non regular files")
> 
> Signed-off-by: Jinhui huang <huangjh.jy@cn.fujitsu.com>
> ---
>  .../syscalls/copy_file_range/copy_file_range02.c   | 33 +++++++++++++++-------
>  1 file changed, 23 insertions(+), 10 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
> index 07c0207..9e6356c 100644
> --- a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
> +++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
> @@ -54,19 +54,32 @@ static void verify_copy_file_range(unsigned int n)
>  	TEST(sys_copy_file_range(fd_src, 0, *tc->copy_to_fd,
>  				0, CONTSIZE, tc->flags));
>  
> -	if (TST_RET == -1) {
> -		if (tc->exp_err == TST_ERR) {
> +	if (TST_RET != -1) {
> +		tst_res(TFAIL,
> +			"copy_file_range returned wrong value: %ld", TST_RET);
> +		return;
> +	}
> +
> +	if (tc->exp_err == TST_ERR) {
> +		tst_res(TPASS | TTERRNO,
> +			"copy_file_range failed as expected");
> +	} else {
> +		/* copy_file_range() returned EISDIR when copyed contents to
> +		 * directory on new kernels, but on old kernels, it returned
> +		 * EBADF.
> +		 *
> +		 * the patch as follws:
> +		 * commit 11cbfb10775a ("vfs: deny copy_file_range() for non regular files")
> +		 */
> +		if (tc->exp_err == EISDIR && TST_ERR == EBADF) {
>  			tst_res(TPASS | TTERRNO,
> -					"copy_file_range failed as expected");

If nothing else this should be guarded by kernel version check because
if new kernel starts to return EBADFD again, that would be regression.

So we should check the kernel version in test setup and set a flag that
would be checked here as well.

-- 
Cyril Hrubis
chrubis@suse.cz

  parent reply	other threads:[~2019-05-31 11:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31  8:44 [LTP] [PATCH] syscalls/copy_file_range02.c: Compatible with new and old kernels Jinhui huang
2019-05-31 10:02 ` Li Wang
2019-05-31 10:15 ` Xiao Yang
2019-05-31 12:03   ` Li Wang
2019-05-31 12:26     ` Cyril Hrubis
2019-05-31 12:46       ` Li Wang
2019-05-31 13:02     ` Amir Goldstein
2019-06-27  8:03       ` Yang Xu
2019-06-27  8:39         ` Amir Goldstein
2019-07-04 10:35           ` Yang Xu
2019-07-04 11:15             ` Amir Goldstein
2019-05-31 11:01 ` Cyril Hrubis [this message]
2019-05-31 11:47   ` Li Wang
2019-05-31 12:00     ` 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=20190531110122.GA8819@rei.lan \
    --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 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.