public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ceph: check negative offsets on ceph_llseek()
@ 2017-07-28 10:56 Luis Henriques
  2017-08-17 13:45 ` Luis Henriques
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Henriques @ 2017-07-28 10:56 UTC (permalink / raw)
  To: Yan, Zheng, Sage Weil, Ilya Dryomov
  Cc: ceph-devel, linux-kernel, Luis Henriques

When a user requests SEEK_HOLE or SEEK_DATA with a negative offset
ceph_llseek should return -ENXIO.  Currently -EINVAL is being returned for
SEEK_DATA and 0 for SEEK_HOLE.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
---
 fs/ceph/file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 3d48c415f3cb..e1912e67843f 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1481,13 +1481,13 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
 		offset += file->f_pos;
 		break;
 	case SEEK_DATA:
-		if (offset >= i_size) {
+		if (offset < 0 || offset >= i_size) {
 			ret = -ENXIO;
 			goto out;
 		}
 		break;
 	case SEEK_HOLE:
-		if (offset >= i_size) {
+		if (offset < 0 || offset >= i_size) {
 			ret = -ENXIO;
 			goto out;
 		}

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ceph: check negative offsets on ceph_llseek()
  2017-07-28 10:56 [PATCH] ceph: check negative offsets on ceph_llseek() Luis Henriques
@ 2017-08-17 13:45 ` Luis Henriques
  2017-08-17 17:57   ` Ilya Dryomov
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Henriques @ 2017-08-17 13:45 UTC (permalink / raw)
  To: Yan, Zheng; +Cc: Sage Weil, Ilya Dryomov, ceph-devel, linux-kernel

Luis Henriques <lhenriques@suse.com> writes:

> When a user requests SEEK_HOLE or SEEK_DATA with a negative offset
> ceph_llseek should return -ENXIO.  Currently -EINVAL is being returned for
> SEEK_DATA and 0 for SEEK_HOLE.

Ping

This patch should make xfstest generic/448 happy.

Cheers,
-- 
Luís

>
> Signed-off-by: Luis Henriques <lhenriques@suse.com>
> ---
>  fs/ceph/file.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> index 3d48c415f3cb..e1912e67843f 100644
> --- a/fs/ceph/file.c
> +++ b/fs/ceph/file.c
> @@ -1481,13 +1481,13 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
>  		offset += file->f_pos;
>  		break;
>  	case SEEK_DATA:
> -		if (offset >= i_size) {
> +		if (offset < 0 || offset >= i_size) {
>  			ret = -ENXIO;
>  			goto out;
>  		}
>  		break;
>  	case SEEK_HOLE:
> -		if (offset >= i_size) {
> +		if (offset < 0 || offset >= i_size) {
>  			ret = -ENXIO;
>  			goto out;
>  		}
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ceph: check negative offsets on ceph_llseek()
  2017-08-17 13:45 ` Luis Henriques
@ 2017-08-17 17:57   ` Ilya Dryomov
  2017-08-17 18:40     ` Luis Henriques
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Dryomov @ 2017-08-17 17:57 UTC (permalink / raw)
  To: Luis Henriques
  Cc: Yan, Zheng, Sage Weil, Ceph Development,
	linux-kernel@vger.kernel.org

On Thu, Aug 17, 2017 at 3:45 PM, Luis Henriques <lhenriques@suse.com> wrote:
> Luis Henriques <lhenriques@suse.com> writes:
>
>> When a user requests SEEK_HOLE or SEEK_DATA with a negative offset
>> ceph_llseek should return -ENXIO.  Currently -EINVAL is being returned for
>> SEEK_DATA and 0 for SEEK_HOLE.
>
> Ping
>
> This patch should make xfstest generic/448 happy.

It should or it does? ;)

I saw generic/448 failures on ext4 with Darrick's recent test change,
haven't tried ceph yet.

Thanks,

                Ilya

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ceph: check negative offsets on ceph_llseek()
  2017-08-17 17:57   ` Ilya Dryomov
@ 2017-08-17 18:40     ` Luis Henriques
  2017-08-18  8:32       ` Ilya Dryomov
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Henriques @ 2017-08-17 18:40 UTC (permalink / raw)
  To: Ilya Dryomov
  Cc: Yan, Zheng, Sage Weil, Ceph Development,
	linux-kernel@vger.kernel.org

Ilya Dryomov <idryomov@gmail.com> writes:

> On Thu, Aug 17, 2017 at 3:45 PM, Luis Henriques <lhenriques@suse.com> wrote:
>> Luis Henriques <lhenriques@suse.com> writes:
>>
>>> When a user requests SEEK_HOLE or SEEK_DATA with a negative offset
>>> ceph_llseek should return -ENXIO.  Currently -EINVAL is being returned for
>>> SEEK_DATA and 0 for SEEK_HOLE.
>>
>> Ping
>>
>> This patch should make xfstest generic/448 happy.
>
> It should or it does? ;)
>

Heh, it *does* make generic/448 happy.

>
> I saw generic/448 failures on ext4 with Darrick's recent test
>change,
> haven't tried ceph yet.

The generic/448 test currently fails with the error codes described in
the commit log.  I didn't found it useful to include in the commit
log, but here's the full test output:

File system supports the default behavior.
File system does not support unwritten extents.
File system magic#: 0xc36400
Allocation size: 4194304
18. Test file with negative SEEK_{HOLE,DATA} offsets
18.01 SEEK_HOLE expected -1 or -1, got 0.                         FAIL
18.02 SEEK_DATA expected -1 with errno -6, got -22.               FAIL

seek sanity check failed!


Cheers,
-- 
Luís

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ceph: check negative offsets on ceph_llseek()
  2017-08-17 18:40     ` Luis Henriques
@ 2017-08-18  8:32       ` Ilya Dryomov
  0 siblings, 0 replies; 5+ messages in thread
From: Ilya Dryomov @ 2017-08-18  8:32 UTC (permalink / raw)
  To: Luis Henriques
  Cc: Yan, Zheng, Sage Weil, Ceph Development,
	linux-kernel@vger.kernel.org

On Thu, Aug 17, 2017 at 8:40 PM, Luis Henriques <lhenriques@suse.com> wrote:
> Ilya Dryomov <idryomov@gmail.com> writes:
>
>> On Thu, Aug 17, 2017 at 3:45 PM, Luis Henriques <lhenriques@suse.com> wrote:
>>> Luis Henriques <lhenriques@suse.com> writes:
>>>
>>>> When a user requests SEEK_HOLE or SEEK_DATA with a negative offset
>>>> ceph_llseek should return -ENXIO.  Currently -EINVAL is being returned for
>>>> SEEK_DATA and 0 for SEEK_HOLE.
>>>
>>> Ping
>>>
>>> This patch should make xfstest generic/448 happy.
>>
>> It should or it does? ;)
>>
>
> Heh, it *does* make generic/448 happy.
>
>>
>> I saw generic/448 failures on ext4 with Darrick's recent test
>>change,
>> haven't tried ceph yet.
>
> The generic/448 test currently fails with the error codes described in
> the commit log.  I didn't found it useful to include in the commit
> log, but here's the full test output:
>
> File system supports the default behavior.
> File system does not support unwritten extents.
> File system magic#: 0xc36400
> Allocation size: 4194304
> 18. Test file with negative SEEK_{HOLE,DATA} offsets
> 18.01 SEEK_HOLE expected -1 or -1, got 0.                         FAIL
> 18.02 SEEK_DATA expected -1 with errno -6, got -22.               FAIL
>
> seek sanity check failed!

Applied.

Thanks,

                Ilya

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-08-18  8:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-28 10:56 [PATCH] ceph: check negative offsets on ceph_llseek() Luis Henriques
2017-08-17 13:45 ` Luis Henriques
2017-08-17 17:57   ` Ilya Dryomov
2017-08-17 18:40     ` Luis Henriques
2017-08-18  8:32       ` Ilya Dryomov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox