From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AE29C43219 for ; Wed, 1 May 2019 00:35:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DAEC82087B for ; Wed, 1 May 2019 00:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727430AbfEAAfp (ORCPT ); Tue, 30 Apr 2019 20:35:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60724 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbfEAAfo (ORCPT ); Tue, 30 Apr 2019 20:35:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 620D15D60F; Wed, 1 May 2019 00:35:44 +0000 (UTC) Received: from localhost (dhcp-12-130.nay.redhat.com [10.66.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEA7E171B7; Wed, 1 May 2019 00:35:43 +0000 (UTC) From: Murphy Zhou To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org Cc: Xiong Zhou , David Howells Subject: [PATCH resend] vfs: return EINVAL instead of ENOENT when missing source Date: Wed, 1 May 2019 08:35:35 +0800 Message-Id: <20190501003535.23426-1-jencce.kernel@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 01 May 2019 00:35:44 +0000 (UTC) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Xiong Zhou mount(2) with a NULL source device would return ENOENT instead of EINVAL after this commit: commit f3a09c92018a91ad0981146a4ac59414f814d801 Author: Al Viro 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 Reviewed-by: David Howells --- 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