From patchwork Wed May 1 00:35:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murphy Zhou X-Patchwork-Id: 10924405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C54DD92A for ; Wed, 1 May 2019 00:36:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B72DB28AC0 for ; Wed, 1 May 2019 00:36:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB3DA28AE6; Wed, 1 May 2019 00:36:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47A9928AE1 for ; Wed, 1 May 2019 00:35:58 +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 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 X-Virus-Scanned: ClamAV using ClamSMTP 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)