From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:55574 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932125AbcFGLnf (ORCPT ); Tue, 7 Jun 2016 07:43:35 -0400 Date: Tue, 7 Jun 2016 12:43:33 +0100 From: Al Viro To: "Yan, Zheng" Cc: linux-fsdevel@vger.kernel.org, mszeredi@redhat.com Subject: Re: commit 1643b43fbd breaks open(.., O_RDONLY|O_CREAT, ...) on fuse. Message-ID: <20160607114333.GO14480@ZenIV.linux.org.uk> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Jun 07, 2016 at 04:27:28PM +0800, Yan, Zheng wrote: > If the file does not exist and the caller has no permission to create > file, syscall open() should return -EACCESS. But on fuse mount of > 4.7-rc2 kernel, open() return -ENOENT. Does the following fix your reproducer? diff --git a/fs/namei.c b/fs/namei.c index d7c0cac..28cb1cd 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2995,9 +2995,13 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry, } if (*opened & FILE_CREATED) fsnotify_create(dir, dentry); - path->dentry = dentry; - path->mnt = nd->path.mnt; - return 1; + if (unlikely(d_is_negative(dentry))) { + error = -ENOENT; + } else { + path->dentry = dentry; + path->mnt = nd->path.mnt; + return 1; + } } } dput(dentry);