All of lore.kernel.org
 help / color / mirror / Atom feed
* commit 1643b43fbd breaks open(.., O_RDONLY|O_CREAT, ...) on fuse.
@ 2016-06-07  8:27 Yan, Zheng
  2016-06-07 11:43 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Yan, Zheng @ 2016-06-07  8:27 UTC (permalink / raw)
  To: linux-fsdevel, Al Viro, mszeredi

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.

Regards
Yan, Zheng

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

* Re: commit 1643b43fbd breaks open(.., O_RDONLY|O_CREAT, ...) on fuse.
  2016-06-07  8:27 commit 1643b43fbd breaks open(.., O_RDONLY|O_CREAT, ...) on fuse Yan, Zheng
@ 2016-06-07 11:43 ` Al Viro
  2016-06-07 13:18   ` Yan, Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2016-06-07 11:43 UTC (permalink / raw)
  To: Yan, Zheng; +Cc: linux-fsdevel, mszeredi

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

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

* Re: commit 1643b43fbd breaks open(.., O_RDONLY|O_CREAT, ...) on fuse.
  2016-06-07 11:43 ` Al Viro
@ 2016-06-07 13:18   ` Yan, Zheng
  0 siblings, 0 replies; 3+ messages in thread
From: Yan, Zheng @ 2016-06-07 13:18 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, mszeredi

On Tue, Jun 7, 2016 at 7:43 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> 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);

Yes, it fixes the issue.

Regards
Yan, Zheng

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

end of thread, other threads:[~2016-06-07 13:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-07  8:27 commit 1643b43fbd breaks open(.., O_RDONLY|O_CREAT, ...) on fuse Yan, Zheng
2016-06-07 11:43 ` Al Viro
2016-06-07 13:18   ` Yan, Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.