xfs_io: Improvements to copy_range return code handling
PATCH v2 1/1 xfs_io: Improvements to copy_range return code handling
If copy_file_range() returns 0, then that means no data was copied. We should break out of the loop in this case to prevent looping indefinitely.
Additionally, if an error is returned by copy_file_range() then we need to print out the string form to be used by error checking tests in xfstests.
---
v2:
- Use perror() instead of fprintf()
--- io/copy_file_range.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
io/copy_file_range.c +4 -1
@@ -49,8 +49,11 @@ copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len)do { ret =syscall (__NR_copy_file_range, fd, src, file->fd, dst, len,0 ); -if (ret ==-1 ) +if (ret ==-1 ) { +perror ("copy_range" );return errno; + }else if (ret ==0 ) +break ; len -= ret; }while (len >0 );
Signature · 1 line
2.10.2
Quoted 4 lines · Anna Schumaker
If
copy_file_range()returns 0, then that means no data was copied. We should break out of the loop in this case to prevent looping indefinitely.
looks good for me, you can add
Quoted 36 lines
Additionally, if an error is returned by
copy_file_range()then we need to print out the string form to be used by error checking tests in xfstests.Signed-off-by Anna Schumaker <[email protected]>---
v2:
- Useperror()instead offprintf()--- io/copy_file_range.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)io/copy_file_range.c +4
-1@@ -49,8 +49,11 @@ copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len)do { ret =syscall (__NR_copy_file_range, fd, src, file->fd, dst, len,0 ); -if (ret ==-1 ) +if (ret ==-1 ) { +perror ("copy_range" );return errno; + }else if (ret ==0 ) +break ; len -= ret; }while (len >0 );Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Carlos