linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH resend] vfs: return EINVAL instead of ENOENT when missing source
@ 2019-05-01  0:35 Murphy Zhou
  2019-05-01  1:03 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Murphy Zhou @ 2019-05-01  0:35 UTC (permalink / raw)
  To: viro, linux-fsdevel; +Cc: Xiong Zhou, David Howells

From: Xiong Zhou <jencce.kernel@gmail.com>

mount(2) with a NULL source device would return ENOENT instead of EINVAL
after this commit:

commit f3a09c92018a91ad0981146a4ac59414f814d801
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Sun Dec 23 18:55:56 2018 -0500

    introduce fs_context methods

Change the return value to be compatible with the old behaviour.

This was caught by LTP mount02[1]. This testcase is calling mount(2) with a
NULL device name and expecting EINVAL to PASS but now we are getting ENOENT.

[1] https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/mount/mount02.c

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
Reviewed-by: David Howells <dhowells@redhat.com>
---
 fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index 583a0124bc39..48e51f13a4ba 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1469,7 +1469,7 @@ int vfs_get_tree(struct fs_context *fc)
 
 	if (fc->fs_type->fs_flags & FS_REQUIRES_DEV && !fc->source) {
 		errorf(fc, "Filesystem requires source device");
-		return -ENOENT;
+		return -EINVAL;
 	}
 
 	if (fc->root)
-- 
2.21.0


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

* Re: [PATCH resend] vfs: return EINVAL instead of ENOENT when missing source
  2019-05-01  0:35 [PATCH resend] vfs: return EINVAL instead of ENOENT when missing source Murphy Zhou
@ 2019-05-01  1:03 ` Al Viro
  2019-05-01  6:49   ` Murphy Zhou
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2019-05-01  1:03 UTC (permalink / raw)
  To: Murphy Zhou; +Cc: linux-fsdevel, David Howells

On Wed, May 01, 2019 at 08:35:35AM +0800, Murphy Zhou wrote:
> From: Xiong Zhou <jencce.kernel@gmail.com>
> 
> mount(2) with a NULL source device would return ENOENT instead of EINVAL
> after this commit:

See ee948837d7fa in vfs.git#fixes...

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

* Re: [PATCH resend] vfs: return EINVAL instead of ENOENT when missing source
  2019-05-01  1:03 ` Al Viro
@ 2019-05-01  6:49   ` Murphy Zhou
  0 siblings, 0 replies; 3+ messages in thread
From: Murphy Zhou @ 2019-05-01  6:49 UTC (permalink / raw)
  To: Al Viro; +Cc: Linux-Fsdevel, David Howells

On Wed, May 1, 2019 at 9:03 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> On Wed, May 01, 2019 at 08:35:35AM +0800, Murphy Zhou wrote:
> > From: Xiong Zhou <jencce.kernel@gmail.com>
> >
> > mount(2) with a NULL source device would return ENOENT instead of EINVAL
> > after this commit:
>
> See ee948837d7fa in vfs.git#fixes...

Got it. Thanks!

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

end of thread, other threads:[~2019-05-01  6:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-01  0:35 [PATCH resend] vfs: return EINVAL instead of ENOENT when missing source Murphy Zhou
2019-05-01  1:03 ` Al Viro
2019-05-01  6:49   ` Murphy Zhou

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).