[5/5] fsx: check ENOSYS in test_copy_range()
diff mbox series

Message ID 20181229023452.28074-6-houtao1@huawei.com
State New
Headers show
Series
  • tiny fixes for xfstests
Related show

Commit Message

Hou Tao Dec. 29, 2018, 2:34 a.m. UTC
In configure script, we only check whether or not the build
of copy-range test program is successful, but that doesn't
mean the kernel has implemented the syscall, so checking
for this case.

Signed-off-by: Hou Tao <houtao1@huawei.com>
---
 ltp/fsx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eryu Guan Dec. 29, 2018, 8:16 a.m. UTC | #1
On Sat, Dec 29, 2018 at 10:34:52AM +0800, Hou Tao wrote:
> In configure script, we only check whether or not the build
> of copy-range test program is successful, but that doesn't
> mean the kernel has implemented the syscall, so checking
> for this case.
> 
> Signed-off-by: Hou Tao <houtao1@huawei.com>
> ---
>  ltp/fsx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ltp/fsx.c b/ltp/fsx.c
> index 316f08eb..b84180f7 100644
> --- a/ltp/fsx.c
> +++ b/ltp/fsx.c
> @@ -1583,7 +1583,7 @@ test_copy_range(void)
>  	loff_t o1 = 0, o2 = 0;
>  
>  	if (syscall(__NR_copy_file_range, fd, &o1, fd, &o2, 0, 0) == -1 &&
> -	    (errno == EOPNOTSUPP || errno == ENOTTY)) {
> +	    (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTTY)) {

Should we also check for ENOSYS in other operations like
{clone,dedupe}_range and fallocate?

Other fixes look good to me, thanks a lot for the fixes!

Thanks,
Eryu

>  		if (!quiet)
>  			fprintf(stderr,
>  				"main: filesystem does not support "
> -- 
> 2.16.2.dirty
>
Darrick J. Wong Dec. 29, 2018, 6:53 p.m. UTC | #2
On Sat, Dec 29, 2018 at 10:34:52AM +0800, Hou Tao wrote:
> In configure script, we only check whether or not the build
> of copy-range test program is successful, but that doesn't
> mean the kernel has implemented the syscall, so checking
> for this case.
> 
> Signed-off-by: Hou Tao <houtao1@huawei.com>

Err, oops.  Thanks for catching that!

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  ltp/fsx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ltp/fsx.c b/ltp/fsx.c
> index 316f08eb..b84180f7 100644
> --- a/ltp/fsx.c
> +++ b/ltp/fsx.c
> @@ -1583,7 +1583,7 @@ test_copy_range(void)
>  	loff_t o1 = 0, o2 = 0;
>  
>  	if (syscall(__NR_copy_file_range, fd, &o1, fd, &o2, 0, 0) == -1 &&
> -	    (errno == EOPNOTSUPP || errno == ENOTTY)) {
> +	    (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTTY)) {
>  		if (!quiet)
>  			fprintf(stderr,
>  				"main: filesystem does not support "
> -- 
> 2.16.2.dirty
>
Darrick J. Wong Dec. 29, 2018, 6:56 p.m. UTC | #3
On Sat, Dec 29, 2018 at 04:16:19PM +0800, Eryu Guan wrote:
> On Sat, Dec 29, 2018 at 10:34:52AM +0800, Hou Tao wrote:
> > In configure script, we only check whether or not the build
> > of copy-range test program is successful, but that doesn't
> > mean the kernel has implemented the syscall, so checking
> > for this case.
> > 
> > Signed-off-by: Hou Tao <houtao1@huawei.com>
> > ---
> >  ltp/fsx.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/ltp/fsx.c b/ltp/fsx.c
> > index 316f08eb..b84180f7 100644
> > --- a/ltp/fsx.c
> > +++ b/ltp/fsx.c
> > @@ -1583,7 +1583,7 @@ test_copy_range(void)
> >  	loff_t o1 = 0, o2 = 0;
> >  
> >  	if (syscall(__NR_copy_file_range, fd, &o1, fd, &o2, 0, 0) == -1 &&
> > -	    (errno == EOPNOTSUPP || errno == ENOTTY)) {
> > +	    (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTTY)) {
> 
> Should we also check for ENOSYS in other operations like
> {clone,dedupe}_range

Unimplemented ioctls usually return EOPNOTSUPP or ENOTTY, not ENOSYS, so
I don't think that's necessary.... unless there are kernels that don't
implement the ioctl syscall?

In any case, the manpage for clone and dedupe don't say anything about
returning ENOSYS.

> and fallocate?

Yes.

--D

> Other fixes look good to me, thanks a lot for the fixes!
> 
> Thanks,
> Eryu
> 
> >  		if (!quiet)
> >  			fprintf(stderr,
> >  				"main: filesystem does not support "
> > -- 
> > 2.16.2.dirty
> >
Hou Tao Jan. 4, 2019, 8:57 a.m. UTC | #4
Hi,

On 2018/12/30 2:56, Darrick J. Wong wrote:
> On Sat, Dec 29, 2018 at 04:16:19PM +0800, Eryu Guan wrote:
>> On Sat, Dec 29, 2018 at 10:34:52AM +0800, Hou Tao wrote:
>>> In configure script, we only check whether or not the build
>>> of copy-range test program is successful, but that doesn't
>>> mean the kernel has implemented the syscall, so checking
>>> for this case.
>>>
>>> Signed-off-by: Hou Tao <houtao1@huawei.com>
>>> ---
>>>  ltp/fsx.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/ltp/fsx.c b/ltp/fsx.c
>>> index 316f08eb..b84180f7 100644
>>> --- a/ltp/fsx.c
>>> +++ b/ltp/fsx.c
>>> @@ -1583,7 +1583,7 @@ test_copy_range(void)
>>>  	loff_t o1 = 0, o2 = 0;
>>>  
>>>  	if (syscall(__NR_copy_file_range, fd, &o1, fd, &o2, 0, 0) == -1 &&
>>> -	    (errno == EOPNOTSUPP || errno == ENOTTY)) {
>>> +	    (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTTY)) {
>>
>> Should we also check for ENOSYS in other operations like
>> {clone,dedupe}_range
> 
> Unimplemented ioctls usually return EOPNOTSUPP or ENOTTY, not ENOSYS, so
> I don't think that's necessary.... unless there are kernels that don't
> implement the ioctl syscall?
> 
> In any case, the manpage for clone and dedupe don't say anything about
> returning ENOSYS.
> 
>> and fallocate?
> > Yes.
I will send a v2 to also check test_fallocate(), and thanks for your review.

> 
> --D
> 
>> Other fixes look good to me, thanks a lot for the fixes!
>>
>> Thanks,
>> Eryu
>>
>>>  		if (!quiet)
>>>  			fprintf(stderr,
>>>  				"main: filesystem does not support "
>>> -- 
>>> 2.16.2.dirty
>>>
> 
>

Patch
diff mbox series

diff --git a/ltp/fsx.c b/ltp/fsx.c
index 316f08eb..b84180f7 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -1583,7 +1583,7 @@  test_copy_range(void)
 	loff_t o1 = 0, o2 = 0;
 
 	if (syscall(__NR_copy_file_range, fd, &o1, fd, &o2, 0, 0) == -1 &&
-	    (errno == EOPNOTSUPP || errno == ENOTTY)) {
+	    (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTTY)) {
 		if (!quiet)
 			fprintf(stderr,
 				"main: filesystem does not support "