linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] nfstest_posix: add check for EINVAL when open(2) called with O_DIRECTORY|O_CREAT
@ 2024-01-17 18:01 Dai Ngo
  2024-01-18 14:39 ` Christian Brauner
  2024-02-20 21:25 ` dai.ngo
  0 siblings, 2 replies; 5+ messages in thread
From: Dai Ngo @ 2024-01-17 18:01 UTC (permalink / raw)
  To: Jorge.Mora; +Cc: linux-nfs, brauner

The 'open' tests of nfstest_posix failed with 6.7 kernel with these errors:

FAIL: open - opening existent file should return an error when O_EXCL|O_CREAT is used (256 passed, 256 failed)
FAIL: open - opening symbolic link should return an error when O_EXCL|O_CREAT is used (256 passed, 256 failed)

These tests failed due to the commit 43b450632676 that fixes problems
with VFS API:

43b450632676: open: return EINVAL for O_DIRECTORY | O_CREAT

This patch fixes the problem by adding a check for EINVAL when the
open(2) was called with O_DIRECTORY | O_CREAT.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 test/nfstest_posix | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/nfstest_posix b/test/nfstest_posix
index 57db5d69b072..6d5fd0dfffee 100755
--- a/test/nfstest_posix
+++ b/test/nfstest_posix
@@ -1232,7 +1232,12 @@ class PosixTest(TestUtil):
                         fstat = posix.fstat(fd)
 
                     if ftype in [EXISTENT, SYMLINK]:
-                        if posix.O_EXCL in flags and posix.O_CREAT in flags:
+                        if posix.O_CREAT in flags and posix.O_DIRECTORY in flags:
+                            # O_CREAT and O_DIRECTORY are set
+                            (expr, fmsg) = self._oserror(openerr, errno.EINVAL)
+                            msg = "open - opening %s should return EINVAL error when O_CREAT|O_DIRECTORY is used" % fmap[ftype]
+                            self.test(expr, msg, subtest=flag_str, failmsg=fmsg)
+                        elif posix.O_EXCL in flags and posix.O_CREAT in flags:
                             # O_EXCL and O_CREAT are set
                             (expr, fmsg) = self._oserror(openerr, errno.EEXIST)
                             msg = "open - opening %s should return an error when O_EXCL|O_CREAT is used" % fmap[ftype]
-- 
2.9.5


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

* Re: [PATCH 1/1] nfstest_posix: add check for EINVAL when open(2) called with O_DIRECTORY|O_CREAT
  2024-01-17 18:01 [PATCH 1/1] nfstest_posix: add check for EINVAL when open(2) called with O_DIRECTORY|O_CREAT Dai Ngo
@ 2024-01-18 14:39 ` Christian Brauner
  2024-02-20 21:25 ` dai.ngo
  1 sibling, 0 replies; 5+ messages in thread
From: Christian Brauner @ 2024-01-18 14:39 UTC (permalink / raw)
  To: Dai Ngo; +Cc: Jorge.Mora, linux-nfs

On Wed, Jan 17, 2024 at 10:01:41AM -0800, Dai Ngo wrote:
> The 'open' tests of nfstest_posix failed with 6.7 kernel with these errors:
> 
> FAIL: open - opening existent file should return an error when O_EXCL|O_CREAT is used (256 passed, 256 failed)
> FAIL: open - opening symbolic link should return an error when O_EXCL|O_CREAT is used (256 passed, 256 failed)
> 
> These tests failed due to the commit 43b450632676 that fixes problems
> with VFS API:
> 
> 43b450632676: open: return EINVAL for O_DIRECTORY | O_CREAT
> 
> This patch fixes the problem by adding a check for EINVAL when the
> open(2) was called with O_DIRECTORY | O_CREAT.
> 
> Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
> ---

Thank you!

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

* Re: [PATCH 1/1] nfstest_posix: add check for EINVAL when open(2) called with O_DIRECTORY|O_CREAT
  2024-01-17 18:01 [PATCH 1/1] nfstest_posix: add check for EINVAL when open(2) called with O_DIRECTORY|O_CREAT Dai Ngo
  2024-01-18 14:39 ` Christian Brauner
@ 2024-02-20 21:25 ` dai.ngo
  2024-02-22 16:13   ` Mora, Jorge
  1 sibling, 1 reply; 5+ messages in thread
From: dai.ngo @ 2024-02-20 21:25 UTC (permalink / raw)
  To: Jorge.Mora; +Cc: linux-nfs, brauner

Hi Jorge,

Have you had a chance to take a look at this patch?

Thanks,
-Dai

On 1/17/24 10:01 AM, Dai Ngo wrote:
> The 'open' tests of nfstest_posix failed with 6.7 kernel with these errors:
>
> FAIL: open - opening existent file should return an error when O_EXCL|O_CREAT is used (256 passed, 256 failed)
> FAIL: open - opening symbolic link should return an error when O_EXCL|O_CREAT is used (256 passed, 256 failed)
>
> These tests failed due to the commit 43b450632676 that fixes problems
> with VFS API:
>
> 43b450632676: open: return EINVAL for O_DIRECTORY | O_CREAT
>
> This patch fixes the problem by adding a check for EINVAL when the
> open(2) was called with O_DIRECTORY | O_CREAT.
>
> Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
> ---
>   test/nfstest_posix | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/test/nfstest_posix b/test/nfstest_posix
> index 57db5d69b072..6d5fd0dfffee 100755
> --- a/test/nfstest_posix
> +++ b/test/nfstest_posix
> @@ -1232,7 +1232,12 @@ class PosixTest(TestUtil):
>                           fstat = posix.fstat(fd)
>   
>                       if ftype in [EXISTENT, SYMLINK]:
> -                        if posix.O_EXCL in flags and posix.O_CREAT in flags:
> +                        if posix.O_CREAT in flags and posix.O_DIRECTORY in flags:
> +                            # O_CREAT and O_DIRECTORY are set
> +                            (expr, fmsg) = self._oserror(openerr, errno.EINVAL)
> +                            msg = "open - opening %s should return EINVAL error when O_CREAT|O_DIRECTORY is used" % fmap[ftype]
> +                            self.test(expr, msg, subtest=flag_str, failmsg=fmsg)
> +                        elif posix.O_EXCL in flags and posix.O_CREAT in flags:
>                               # O_EXCL and O_CREAT are set
>                               (expr, fmsg) = self._oserror(openerr, errno.EEXIST)
>                               msg = "open - opening %s should return an error when O_EXCL|O_CREAT is used" % fmap[ftype]

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

* Re: [PATCH 1/1] nfstest_posix: add check for EINVAL when open(2) called with O_DIRECTORY|O_CREAT
  2024-02-20 21:25 ` dai.ngo
@ 2024-02-22 16:13   ` Mora, Jorge
  2024-02-22 17:45     ` dai.ngo
  0 siblings, 1 reply; 5+ messages in thread
From: Mora, Jorge @ 2024-02-22 16:13 UTC (permalink / raw)
  To: dai.ngo@oracle.com; +Cc: linux-nfs@vger.kernel.org, brauner@kernel.org

Hello Dai,

Looks good, I have pushed it upstream.

Thanks,

--Jorge

________________________________________
From: dai.ngo@oracle.com <dai.ngo@oracle.com>
Sent: Tuesday, February 20, 2024 2:25 PM
To: Mora, Jorge
Cc: linux-nfs@vger.kernel.org; brauner@kernel.org
Subject: Re: [PATCH 1/1] nfstest_posix: add check for EINVAL when open(2) called with O_DIRECTORY|O_CREAT

EXTERNAL EMAIL - USE CAUTION when clicking links or attachments




Hi Jorge,

Have you had a chance to take a look at this patch?

Thanks,
-Dai

On 1/17/24 10:01 AM, Dai Ngo wrote:
> The 'open' tests of nfstest_posix failed with 6.7 kernel with these errors:
>
> FAIL: open - opening existent file should return an error when O_EXCL|O_CREAT is used (256 passed, 256 failed)
> FAIL: open - opening symbolic link should return an error when O_EXCL|O_CREAT is used (256 passed, 256 failed)
>
> These tests failed due to the commit 43b450632676 that fixes problems
> with VFS API:
>
> 43b450632676: open: return EINVAL for O_DIRECTORY | O_CREAT
>
> This patch fixes the problem by adding a check for EINVAL when the
> open(2) was called with O_DIRECTORY | O_CREAT.
>
> Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
> ---
>   test/nfstest_posix | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/test/nfstest_posix b/test/nfstest_posix
> index 57db5d69b072..6d5fd0dfffee 100755
> --- a/test/nfstest_posix
> +++ b/test/nfstest_posix
> @@ -1232,7 +1232,12 @@ class PosixTest(TestUtil):
>                           fstat = posix.fstat(fd)
>
>                       if ftype in [EXISTENT, SYMLINK]:
> -                        if posix.O_EXCL in flags and posix.O_CREAT in flags:
> +                        if posix.O_CREAT in flags and posix.O_DIRECTORY in flags:
> +                            # O_CREAT and O_DIRECTORY are set
> +                            (expr, fmsg) = self._oserror(openerr, errno.EINVAL)
> +                            msg = "open - opening %s should return EINVAL error when O_CREAT|O_DIRECTORY is used" % fmap[ftype]
> +                            self.test(expr, msg, subtest=flag_str, failmsg=fmsg)
> +                        elif posix.O_EXCL in flags and posix.O_CREAT in flags:
>                               # O_EXCL and O_CREAT are set
>                               (expr, fmsg) = self._oserror(openerr, errno.EEXIST)
>                               msg = "open - opening %s should return an error when O_EXCL|O_CREAT is used" % fmap[ftype]

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

* Re: [PATCH 1/1] nfstest_posix: add check for EINVAL when open(2) called with O_DIRECTORY|O_CREAT
  2024-02-22 16:13   ` Mora, Jorge
@ 2024-02-22 17:45     ` dai.ngo
  0 siblings, 0 replies; 5+ messages in thread
From: dai.ngo @ 2024-02-22 17:45 UTC (permalink / raw)
  To: Mora, Jorge; +Cc: linux-nfs@vger.kernel.org, brauner@kernel.org

Thank you Jorge!

-Dai

On 2/22/24 8:13 AM, Mora, Jorge wrote:
> Hello Dai,
>
> Looks good, I have pushed it upstream.
>
> Thanks,
>
> --Jorge
>
> ________________________________________
> From: dai.ngo@oracle.com <dai.ngo@oracle.com>
> Sent: Tuesday, February 20, 2024 2:25 PM
> To: Mora, Jorge
> Cc: linux-nfs@vger.kernel.org; brauner@kernel.org
> Subject: Re: [PATCH 1/1] nfstest_posix: add check for EINVAL when open(2) called with O_DIRECTORY|O_CREAT
>
> EXTERNAL EMAIL - USE CAUTION when clicking links or attachments
>
>
>
>
> Hi Jorge,
>
> Have you had a chance to take a look at this patch?
>
> Thanks,
> -Dai
>
> On 1/17/24 10:01 AM, Dai Ngo wrote:
>> The 'open' tests of nfstest_posix failed with 6.7 kernel with these errors:
>>
>> FAIL: open - opening existent file should return an error when O_EXCL|O_CREAT is used (256 passed, 256 failed)
>> FAIL: open - opening symbolic link should return an error when O_EXCL|O_CREAT is used (256 passed, 256 failed)
>>
>> These tests failed due to the commit 43b450632676 that fixes problems
>> with VFS API:
>>
>> 43b450632676: open: return EINVAL for O_DIRECTORY | O_CREAT
>>
>> This patch fixes the problem by adding a check for EINVAL when the
>> open(2) was called with O_DIRECTORY | O_CREAT.
>>
>> Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
>> ---
>>    test/nfstest_posix | 7 ++++++-
>>    1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/test/nfstest_posix b/test/nfstest_posix
>> index 57db5d69b072..6d5fd0dfffee 100755
>> --- a/test/nfstest_posix
>> +++ b/test/nfstest_posix
>> @@ -1232,7 +1232,12 @@ class PosixTest(TestUtil):
>>                            fstat = posix.fstat(fd)
>>
>>                        if ftype in [EXISTENT, SYMLINK]:
>> -                        if posix.O_EXCL in flags and posix.O_CREAT in flags:
>> +                        if posix.O_CREAT in flags and posix.O_DIRECTORY in flags:
>> +                            # O_CREAT and O_DIRECTORY are set
>> +                            (expr, fmsg) = self._oserror(openerr, errno.EINVAL)
>> +                            msg = "open - opening %s should return EINVAL error when O_CREAT|O_DIRECTORY is used" % fmap[ftype]
>> +                            self.test(expr, msg, subtest=flag_str, failmsg=fmsg)
>> +                        elif posix.O_EXCL in flags and posix.O_CREAT in flags:
>>                                # O_EXCL and O_CREAT are set
>>                                (expr, fmsg) = self._oserror(openerr, errno.EEXIST)
>>                                msg = "open - opening %s should return an error when O_EXCL|O_CREAT is used" % fmap[ftype]

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

end of thread, other threads:[~2024-02-22 17:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-17 18:01 [PATCH 1/1] nfstest_posix: add check for EINVAL when open(2) called with O_DIRECTORY|O_CREAT Dai Ngo
2024-01-18 14:39 ` Christian Brauner
2024-02-20 21:25 ` dai.ngo
2024-02-22 16:13   ` Mora, Jorge
2024-02-22 17:45     ` dai.ngo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).