linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: return -EOPNOTSUPP from ->fileattr_[gs]et() instead of -ENOTTY
@ 2025-07-01 14:29 Amir Goldstein
  2025-07-01 17:41 ` Miklos Szeredi
  0 siblings, 1 reply; 3+ messages in thread
From: Amir Goldstein @ 2025-07-01 14:29 UTC (permalink / raw)
  To: Miklos Szeredi
  Cc: Christian Brauner, Jan Kara, Andrey Albershteyn, linux-fsdevel,
	linux-unionfs

As part of changing calling convenstion of ->fileattr_[gs]et()
to return -EOPNOTSUPP and fix related overlayfs code.

Fixes: 5b0a414d06c3 ("ovl: fix filattr copy-up failure")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---

Miklos,

As part of Andrey's work on the new file_[gs]etattr() syscalls,
I noticed that we have this oddity in overlayfs copy up.

I think that overlayfs checks for -ENOTTY from the days that it called
vfs_ioctl() and we do not need that anymore, so I'd rather move the
conversion into fuse to align with the new vfs calling conventiions.

After the calling convention change, the conversion in
ovl_real_fileattr_get() is going to go away, so I've asked Christian
to apply this change with the file_[gs]etattr() syscalls series.

WDYT?

Thanks,
Amir.


 fs/fuse/ioctl.c        | 4 ++++
 fs/overlayfs/copy_up.c | 2 +-
 fs/overlayfs/inode.c   | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/ioctl.c b/fs/fuse/ioctl.c
index 2d9abf48828f..f2692f7d5932 100644
--- a/fs/fuse/ioctl.c
+++ b/fs/fuse/ioctl.c
@@ -536,6 +536,8 @@ int fuse_fileattr_get(struct dentry *dentry, struct fileattr *fa)
 cleanup:
 	fuse_priv_ioctl_cleanup(inode, ff);
 
+	if (err == -ENOTTY)
+		err = -EOPNOTSUPP;
 	return err;
 }
 
@@ -572,5 +574,7 @@ int fuse_fileattr_set(struct mnt_idmap *idmap,
 cleanup:
 	fuse_priv_ioctl_cleanup(inode, ff);
 
+	if (err == -ENOTTY)
+		err = -EOPNOTSUPP;
 	return err;
 }
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index d7310fcf3888..2c646b7076d0 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -178,7 +178,7 @@ static int ovl_copy_fileattr(struct inode *inode, const struct path *old,
 	err = ovl_real_fileattr_get(old, &oldfa);
 	if (err) {
 		/* Ntfs-3g returns -EINVAL for "no fileattr support" */
-		if (err == -ENOTTY || err == -EINVAL)
+		if (err == -EOPNOTSUPP || err == -EINVAL)
 			return 0;
 		pr_warn("failed to retrieve lower fileattr (%pd2, err=%i)\n",
 			old->dentry, err);
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 6f0e15f86c21..92754749f316 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -722,7 +722,7 @@ int ovl_real_fileattr_get(const struct path *realpath, struct fileattr *fa)
 
 	err = vfs_fileattr_get(realpath->dentry, fa);
 	if (err == -ENOIOCTLCMD)
-		err = -ENOTTY;
+		err = -EOPNOTSUPP;
 	return err;
 }
 
-- 
2.43.0


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

* Re: [PATCH] fuse: return -EOPNOTSUPP from ->fileattr_[gs]et() instead of -ENOTTY
  2025-07-01 14:29 [PATCH] fuse: return -EOPNOTSUPP from ->fileattr_[gs]et() instead of -ENOTTY Amir Goldstein
@ 2025-07-01 17:41 ` Miklos Szeredi
  2025-07-01 19:11   ` Amir Goldstein
  0 siblings, 1 reply; 3+ messages in thread
From: Miklos Szeredi @ 2025-07-01 17:41 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: Christian Brauner, Jan Kara, Andrey Albershteyn, linux-fsdevel,
	linux-unionfs

On Tue, 1 Jul 2025 at 16:29, Amir Goldstein <amir73il@gmail.com> wrote:

> index 6f0e15f86c21..92754749f316 100644
> --- a/fs/overlayfs/inode.c
> +++ b/fs/overlayfs/inode.c
> @@ -722,7 +722,7 @@ int ovl_real_fileattr_get(const struct path *realpath, struct fileattr *fa)
>
>         err = vfs_fileattr_get(realpath->dentry, fa);
>         if (err == -ENOIOCTLCMD)
> -               err = -ENOTTY;
> +               err = -EOPNOTSUPP;

This doesn't make sense, the Andrey's 4/6 patch made vfs_fileattr_get
return EOPNOTSUPP instead of ENOIOCTLCMD.  So why is it being checked
here?

Thanks,
Miklos

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

* Re: [PATCH] fuse: return -EOPNOTSUPP from ->fileattr_[gs]et() instead of -ENOTTY
  2025-07-01 17:41 ` Miklos Szeredi
@ 2025-07-01 19:11   ` Amir Goldstein
  0 siblings, 0 replies; 3+ messages in thread
From: Amir Goldstein @ 2025-07-01 19:11 UTC (permalink / raw)
  To: Miklos Szeredi
  Cc: Christian Brauner, Jan Kara, Andrey Albershteyn, linux-fsdevel,
	linux-unionfs

On Tue, Jul 1, 2025 at 7:41 PM Miklos Szeredi <miklos@szeredi.hu> wrote:
>
> On Tue, 1 Jul 2025 at 16:29, Amir Goldstein <amir73il@gmail.com> wrote:
>
> > index 6f0e15f86c21..92754749f316 100644
> > --- a/fs/overlayfs/inode.c
> > +++ b/fs/overlayfs/inode.c
> > @@ -722,7 +722,7 @@ int ovl_real_fileattr_get(const struct path *realpath, struct fileattr *fa)
> >
> >         err = vfs_fileattr_get(realpath->dentry, fa);
> >         if (err == -ENOIOCTLCMD)
> > -               err = -ENOTTY;
> > +               err = -EOPNOTSUPP;
>
> This doesn't make sense, the Andrey's 4/6 patch made vfs_fileattr_get
> return EOPNOTSUPP instead of ENOIOCTLCMD.  So why is it being checked
> here?

You are right.
I was trying to demonstrate the change in fuse/ovl independent of
Ansrey's patch, but don't worry after squashing this patch,
there is no remaining conversion in ovl_real_fileattr_get().

I verified that with Christian.

Thanks,
Amir.

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

end of thread, other threads:[~2025-07-01 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-01 14:29 [PATCH] fuse: return -EOPNOTSUPP from ->fileattr_[gs]et() instead of -ENOTTY Amir Goldstein
2025-07-01 17:41 ` Miklos Szeredi
2025-07-01 19:11   ` Amir Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).