Commit b21d9c43 authored by Amir Goldstein's avatar Amir Goldstein Committed by Miklos Szeredi

ovl: support the FS_IOC_FS[SG]ETXATTR ioctls

They are the extended version of FS_IOC_FS[SG]ETFLAGS ioctls.
xfs_io -c "chattr <flags>" uses the new ioctls for setting flags.

This used to work in kernel pre v4.19, before stacked file ops
introduced the ovl_ioctl whitelist.
Reported-by: default avatarDave Chinner <david@fromorbit.com>
Fixes: d1d04ef8 ("ovl: stack file ops")
Cc: <stable@vger.kernel.org> # v4.19
Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent cd6c84d8
...@@ -426,7 +426,8 @@ static unsigned int ovl_get_inode_flags(struct inode *inode) ...@@ -426,7 +426,8 @@ static unsigned int ovl_get_inode_flags(struct inode *inode)
return ovl_iflags; return ovl_iflags;
} }
static long ovl_ioctl_set_flags(struct file *file, unsigned long arg) static long ovl_ioctl_set_flags(struct file *file, unsigned int cmd,
unsigned long arg)
{ {
long ret; long ret;
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
...@@ -456,7 +457,7 @@ static long ovl_ioctl_set_flags(struct file *file, unsigned long arg) ...@@ -456,7 +457,7 @@ static long ovl_ioctl_set_flags(struct file *file, unsigned long arg)
if (ret) if (ret)
goto unlock; goto unlock;
ret = ovl_real_ioctl(file, FS_IOC_SETFLAGS, arg); ret = ovl_real_ioctl(file, cmd, arg);
ovl_copyflags(ovl_inode_real(inode), inode); ovl_copyflags(ovl_inode_real(inode), inode);
unlock: unlock:
...@@ -474,11 +475,13 @@ static long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -474,11 +475,13 @@ static long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
switch (cmd) { switch (cmd) {
case FS_IOC_GETFLAGS: case FS_IOC_GETFLAGS:
case FS_IOC_FSGETXATTR:
ret = ovl_real_ioctl(file, cmd, arg); ret = ovl_real_ioctl(file, cmd, arg);
break; break;
case FS_IOC_SETFLAGS: case FS_IOC_SETFLAGS:
ret = ovl_ioctl_set_flags(file, arg); case FS_IOC_FSSETXATTR:
ret = ovl_ioctl_set_flags(file, cmd, arg);
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment