public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: fstests@vger.kernel.org, neilb@suse.com
Subject: Re: [PATCH] fsync-err: write to different offset on each fd
Date: Thu, 14 Sep 2017 14:24:54 +0800	[thread overview]
Message-ID: <20170914062454.GG8034@eguan.usersys.redhat.com> (raw)
In-Reply-To: <20170913130624.24028-1-jlayton@kernel.org>

On Wed, Sep 13, 2017 at 09:06:24AM -0400, Jeff Layton wrote:
> From: Jeff Layton <jlayton@redhat.com>
> 
> NFS currently has slightly different semantics from other fs' and
> fails this test due to the fact that the same range is overwritten
> via each fd.

generic/441 and generic/442 require the SCRATCH_DEV to be a real block
device, tests should be skipped as _notrun on NFS, and I didn't expect a
test failure on NFS..

> 
> Change it so that each fd overwrites a different region, which is
> more representative of a real workload anyway.
> 
> Reported-by: Neil Brown <neilb@suse.com>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>

But the change looks fine to me.

Thanks,
Eryu
> ---
>  src/fsync-err.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/fsync-err.c b/src/fsync-err.c
> index 4b0205cf2fd4..146688ddb01e 100644
> --- a/src/fsync-err.c
> +++ b/src/fsync-err.c
> @@ -106,7 +106,7 @@ int main(int argc, char **argv)
>  	memset(buf, 0x7c, bufsize);
>  
>  	for (i = 0; i < numfds; ++i) {
> -		ret = write(fd[i], buf, bufsize);
> +		ret = pwrite(fd[i], buf, bufsize, i * bufsize);
>  		if (ret < 0) {
>  			printf("First write on fd[%d] failed: %m\n", i);
>  			return 1;
> @@ -149,7 +149,7 @@ int main(int argc, char **argv)
>  	}
>  
>  	for (i = 0; i < numfds; ++i) {
> -		ret = write(fd[i], buf, bufsize);
> +		ret = pwrite(fd[i], buf, bufsize, i * bufsize);
>  		if (ret < 0) {
>  			printf("Second write on fd[%d] failed: %m\n", i);
>  			return 1;
> -- 
> 2.13.5
> 

      reply	other threads:[~2017-09-14  6:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 13:06 [PATCH] fsync-err: write to different offset on each fd Jeff Layton
2017-09-14  6:24 ` Eryu Guan [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=20170914062454.GG8034@eguan.usersys.redhat.com \
    --to=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=jlayton@kernel.org \
    --cc=neilb@suse.com \
    /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