Skip to contentSkip to conversation

copy_file_range() errno changes introduced in v5.3-rc1

DISCUSSION Petr Vorel 3 participants 8 messages Sep 26, 2019 – Sep 27, 2019 VFS

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

Hi Amir,

I'm going to fix LTP test copy_file_range02 before upcoming LTP release.
There are some returning errno changes introduced in v5.3-rc1, part of commit 40f06c799539 ("Merge tag 'copy-file-range-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux").
These changes looks pretty obvious as wanted, but can you please confirm it they were intentional?

* 5dae222a5ff0 ("vfs: allow copy_file_range to copy across devices") started to return -EXDEV.
* 96e6e8f4a68d ("vfs: add missing checks to copy_file_range") started to return -EPERM, -ETXTBSY, -EOVERFLOW.

Thanks for info.

Kind regards,
Petr

#1 lore raw
Quoted 9 lines · Petr Vorel

Hi Amir,

I'm going to fix LTP test copy_file_range02 before upcoming LTP release.
There are some returning errno changes introduced in v5.3-rc1, part of commit 40f06c799539 ("Merge tag 'copy-file-range-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux").
These changes looks pretty obvious as wanted, but can you please confirm it they were intentional?

* 5dae222a5ff0 ("vfs: allow copy_file_range to copy across devices") started to return -EXDEV.
* 96e6e8f4a68d ("vfs: add missing checks to copy_file_range") started to return -EPERM, -ETXTBSY, -EOVERFLOW.

I'm not Amir, but by my recollection, yes, those are intentional. :)

--D

Quoted 4 lines

Thanks for info.

Kind regards,
Petr

author
#2 lore raw

Hi Darrick,

Quoted 8 lines · Petr Vorel
Quoted 6 lines

Hi Amir,

I'm going to fix LTP test copy_file_range02 before upcoming LTP release.
There are some returning errno changes introduced in v5.3-rc1, part of commit 40f06c799539 ("Merge tag 'copy-file-range-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux").
These changes looks pretty obvious as wanted, but can you please confirm it they were intentional?

Quoted 4 lines
Quoted 2 lines

* 5dae222a5ff0 ("vfs: allow copy_file_range to copy across devices") started to return -EXDEV.
* 96e6e8f4a68d ("vfs: add missing checks to copy_file_range") started to return -EPERM, -ETXTBSY, -EOVERFLOW.

I'm not Amir, but by my recollection, yes, those are intentional. :)

Thanks for a quick confirmation.

Quoted 1 line

--D

Kind regards,
Petr

#3 lore raw
Quoted 12 lines · Petr Vorel

Hi Darrick,

Quoted 9 lines · Petr Vorel
Quoted 8 lines

Hi Amir,

I'm going to fix LTP test copy_file_range02 before upcoming LTP release.
There are some returning errno changes introduced in v5.3-rc1, part of commit 40f06c799539 ("Merge tag 'copy-file-range-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux").
These changes looks pretty obvious as wanted, but can you please confirm it they were intentional?

* 5dae222a5ff0 ("vfs: allow copy_file_range to copy across devices") started to return -EXDEV.

Started to return EXDEV?? quite the opposite.
But LTP tests where already adapted to that behavior AFAICT:
15cac7b46 syscalls/copy_file_range01: add cross-device test

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

* 96e6e8f4a68d ("vfs: add missing checks to copy_file_range") started to return -EPERM, -ETXTBSY, -EOVERFLOW.

I'm not Amir, but by my recollection, yes, those are intentional. :)

Thanks for a quick confirmation.

Which reminds me - I forgot to send the man pages patch out to maintainer:
https://lore.kernel.org/linux-fsdevel/[email protected]/

At least according to man page -EACCES is also possible.

Thanks,
Amir.

#4 lore raw
Quoted 22 lines · Amir Goldstein
Quoted 12 lines · Petr Vorel

Hi Darrick,

Quoted 9 lines · Petr Vorel
Quoted 8 lines

Hi Amir,

I'm going to fix LTP test copy_file_range02 before upcoming LTP release.
There are some returning errno changes introduced in v5.3-rc1, part of commit 40f06c799539 ("Merge tag 'copy-file-range-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux").
These changes looks pretty obvious as wanted, but can you please confirm it they were intentional?

* 5dae222a5ff0 ("vfs: allow copy_file_range to copy across devices") started to return -EXDEV.

Started to return EXDEV?? quite the opposite.
But LTP tests where already adapted to that behavior AFAICT:
15cac7b46 syscalls/copy_file_range01: add cross-device test

Quoted 2 lines
Quoted 1 line
Quoted 1 line

* 96e6e8f4a68d ("vfs: add missing checks to copy_file_range") started to return -EPERM, -ETXTBSY, -EOVERFLOW.

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

I'm not Amir, but by my recollection, yes, those are intentional. :)

Thanks for a quick confirmation.

Which reminds me - I forgot to send the man pages patch out to maintainer:
https://lore.kernel.org/linux-fsdevel/[email protected]/

At least according to man page -EACCES is also possible.

But it looks like man page update is wrong.
I'll fix it and post.

Thanks,
Amir.

author
#5 lore raw
In reply to Amir Goldstein

Hi Amir,

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

* 5dae222a5ff0 ("vfs: allow copy_file_range to copy across devices") started to return -EXDEV.

Started to return EXDEV?? quite the opposite.
But LTP tests where already adapted to that behavior AFAICT:
15cac7b46 syscalls/copy_file_range01: add cross-device test

I'm talking about copy_file_range02 (15cac7b46 changes copy_file_range01).

Anyway, the problem which I want to fix is a backward compatibility for v5.2 and older to fix errors like this:

copy_file_range02.c:102: INFO: Test #7: overlaping range
copy_file_range02.c:134: FAIL: copy_file_range returned wrong value: 16 copy_file_range02.c:102: INFO: Test #8: block device
copy_file_range02.c:128: FAIL: copy_file_range failed unexpectedly; expected EINVAL, but got: EXDEV (18) copy_file_range02.c:102: INFO: Test #9: char device
copy_file_range02.c:128: FAIL: copy_file_range failed unexpectedly; expected EINVAL, but got: EXDEV (18)
...
copy_file_range02.c:102: INFO: Test #11: max length lenght
copy_file_range02.c:128: FAIL: copy_file_range failed unexpectedly; expected EOVERFLOW, but got: EINVAL (22) copy_file_range02.c:102: INFO: Test #12: max file size
copy_file_range02.c:128: FAIL: copy_file_range failed unexpectedly; expected EFBIG, but got: EINVAL (22)

LTP hasn't defined yet any policy about changing errnos, as it's probably best to check whether change was intentional (like your obvious fixes) or not.

Quoted 10 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

* 96e6e8f4a68d ("vfs: add missing checks to copy_file_range") started to return -EPERM, -ETXTBSY, -EOVERFLOW.

I'm not Amir, but by my recollection, yes, those are intentional. :)

Thanks for a quick confirmation.

Which reminds me - I forgot to send the man pages patch out to maintainer:
https://lore.kernel.org/linux-fsdevel/[email protected]/

At least according to man page -EACCES is also possible.

Thanks for fixing man :).

Kind regards,
Petr

#6 lore raw
Quoted 25 lines · Petr Vorel

Hi Amir,

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

* 5dae222a5ff0 ("vfs: allow copy_file_range to copy across devices") started to return -EXDEV.

Started to return EXDEV?? quite the opposite.
But LTP tests where already adapted to that behavior AFAICT:
15cac7b46 syscalls/copy_file_range01: add cross-device test

I'm talking about copy_file_range02 (15cac7b46 changes copy_file_range01).

Anyway, the problem which I want to fix is a backward compatibility for v5.2 and older to fix errors like this:

copy_file_range02.c:102: INFO: Test #7: overlaping range
copy_file_range02.c:134: FAIL: copy_file_range returned wrong value: 16 copy_file_range02.c:102: INFO: Test #8: block device
copy_file_range02.c:128: FAIL: copy_file_range failed unexpectedly; expected EINVAL, but got: EXDEV (18) copy_file_range02.c:102: INFO: Test #9: char device
copy_file_range02.c:128: FAIL: copy_file_range failed unexpectedly; expected EINVAL, but got: EXDEV (18)
...
copy_file_range02.c:102: INFO: Test #11: max length lenght
copy_file_range02.c:128: FAIL: copy_file_range failed unexpectedly; expected EOVERFLOW, but got: EINVAL (22) copy_file_range02.c:102: INFO: Test #12: max file size
copy_file_range02.c:128: FAIL: copy_file_range failed unexpectedly; expected EFBIG, but got: EINVAL (22)

Quoted 4 lines

LTP hasn't defined yet any policy about changing errnos, as it's probably best to check whether change was intentional (like your obvious fixes) or not.

IIUC, copy_file_range02 was written after v5.3 changes to verify that copy_file_range
stays unbroken.
As such, I would suggest that you check if kernel supports cross-fs copy, like copy_file_range01 does and if it doesn't, skip the test entirely. If some one ever backports cross-fs copy to any distro stable kernel, then one would better also backkport all of those API fixes, otherwise test will fail.

Thanks,
Amir.

author
#7 lore raw

Hi Amir,

Quoted 5 lines
Quoted 3 lines

LTP hasn't defined yet any policy about changing errnos, as it's probably best to check whether change was intentional (like your obvious fixes) or not.

Quoted 7 lines

IIUC, copy_file_range02 was written after v5.3 changes to verify that copy_file_range
stays unbroken.
As such, I would suggest that you check if kernel supports cross-fs copy, like copy_file_range01 does and if it doesn't, skip the test entirely. If some one ever backports cross-fs copy to any distro stable kernel, then one would better also backkport all of those API fixes, otherwise test will fail.

Thanks for a tip, I'll send a patch today.

Quoted 2 lines

Thanks,
Amir.

Kind regards,
Petr