public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Murphy Zhou <jencce.kernel@gmail.com>
Cc: Petr Vorel <pvorel@suse.cz>,
	Yang Xu <xuyang2018.jy@cn.fujitsu.com>,
	chrubis@suse.cz, ltp@lists.linux.it, linux-xfs@vger.kernel.org
Subject: Re: [LTP] [PATCH v7 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test
Date: Wed, 7 Aug 2019 22:12:12 +1000	[thread overview]
Message-ID: <20190807121212.GM7777@dread.disaster.area> (raw)
In-Reply-To: <20190807101742.mt6tgowsh4xw5hyt@XZHOUW.usersys.redhat.com>

On Wed, Aug 07, 2019 at 06:17:42PM +0800, Murphy Zhou wrote:
> ccing linux-xfs@vger.kernel.org
> 
> Hi,
> 
> Tracked down this to be a xfs specific issue:
> 
> If we call copy_file_range with a large offset like this:
> 
> 	loff_t off = 9223372036854710270; // 2 ** 63
> 	ret = copy_file_range(fd_in, 0, fd_out, &off, 65537, 0);

That's not 2**63:

$ echo $((9223372036854710270 + 65537))
9223372036854775807

$ echo $((2**63 - 1))
9223372036854775807

i.e. it's LLONG_MAX, not an overflow. XFS sets sb->s_maxbytes in
xfs_max_file_offset to:

	(1 << BITS_PER_LONG - 1) - 1 = 2**63 - 1 = LLONG_MAX.

So no matter how we look at it, this operation should not return
EFBIG on XFS.

> (test programme cfrbig.c attached)
> 
> xfs has it done successfully, while ext4 returns EFBIG.

ext4 has a max file size of 2**32 * blocksize, so it doesn't support
files larger than 16TB. So it will give EFBIG on this test.

/me compiles and runs the test program on his workstation:

$ ls -l foobar
-rw------- 1 dave dave 10737418240 Apr 12 14:46 foobar
$ ./a.out foobar bar
ret 65537
$ ls -l bar
-rw-r--r-- 1 dave dave 9223372036854775807 Aug  7 22:11 bar
$

That looks like a successful copy to me, not EINVAL or EFBIG...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2019-08-07 12:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190730110555.GB7528@rei.lan>
     [not found] ` <1564569629-2358-1-git-send-email-xuyang2018.jy@cn.fujitsu.com>
     [not found]   ` <1564569629-2358-3-git-send-email-xuyang2018.jy@cn.fujitsu.com>
     [not found]     ` <20190805065832.ti6vpoviykfaxcj7@XZHOUW.usersys.redhat.com>
     [not found]       ` <5D47D6B9.9090306@cn.fujitsu.com>
     [not found]         ` <20190805102211.pvyufepn6xywi7vm@XZHOUW.usersys.redhat.com>
     [not found]           ` <20190806162703.GA1333@dell5510>
2019-08-07 10:17             ` [LTP] [PATCH v7 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test Murphy Zhou
2019-08-07 12:12               ` Dave Chinner [this message]
2019-08-08  3:46                 ` Murphy Zhou
2019-08-08  3:11               ` Yang Xu
2019-08-08  3:11                 ` Yang Xu
2019-08-08  3:57                 ` Murphy Zhou
2019-08-27 10:04                   ` Petr Vorel

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=20190807121212.GM7777@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=chrubis@suse.cz \
    --cc=jencce.kernel@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    --cc=xuyang2018.jy@cn.fujitsu.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