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.7 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 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 A1AFCC43381 for ; Mon, 18 Mar 2019 05:00:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 799DD2087C for ; Mon, 18 Mar 2019 05:00:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725967AbfCRFAh (ORCPT ); Mon, 18 Mar 2019 01:00:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39764 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725915AbfCRFAh (ORCPT ); Mon, 18 Mar 2019 01:00:37 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7638330832CF; Mon, 18 Mar 2019 05:00:37 +0000 (UTC) Received: from localhost (dhcp-12-130.nay.redhat.com [10.66.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE4F560C6C; Mon, 18 Mar 2019 05:00:36 +0000 (UTC) From: Murphy Zhou To: linux-fsdevel@vger.kernel.org Cc: Murphy Zhou Subject: [PATCH] vfs: return EINVAL instead of ENOENT when missing source Date: Mon, 18 Mar 2019 13:00:22 +0800 Message-Id: <20190318050022.7833-1-jencce.kernel@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 18 Mar 2019 05:00:37 +0000 (UTC) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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 --- 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