linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl
@ 2015-10-29  8:22 Luke Dashjr
  2015-10-29 14:21 ` David Sterba
  2015-10-29 17:33 ` Josef Bacik
  0 siblings, 2 replies; 3+ messages in thread
From: Luke Dashjr @ 2015-10-29  8:22 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba, linux-btrfs, linux-kernel,
	trivial

32-bit ioctl uses these rather than the regular FS_IOC_* versions. They can
be handled in btrfs using the same code. Without this, 32-bit {ch,ls}attr
fail.

Signed-off-by: Luke Dashjr <luke-jr+git@utopios.org>
Cc: stable@vger.kernel.org
---
 fs/btrfs/ctree.h |  1 +
 fs/btrfs/file.c  |  2 +-
 fs/btrfs/inode.c |  2 +-
 fs/btrfs/ioctl.c | 21 +++++++++++++++++++++
 4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 6f364e1..880604d 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3956,6 +3956,7 @@ void btrfs_test_inode_set_ops(struct inode *inode);
 
 /* ioctl.c */
 long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
+long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 void btrfs_update_iflags(struct inode *inode);
 void btrfs_inherit_iflags(struct inode *inode, struct inode *dir);
 int btrfs_is_empty_uuid(u8 *uuid);
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index b072e17..fa366f4 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2811,7 +2811,7 @@ const struct file_operations btrfs_file_operations = {
 	.fallocate	= btrfs_fallocate,
 	.unlocked_ioctl	= btrfs_ioctl,
 #ifdef CONFIG_COMPAT
-	.compat_ioctl	= btrfs_ioctl,
+	.compat_ioctl	= btrfs_compat_ioctl,
 #endif
 };
 
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8bb0136..3cde738 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9812,7 +9812,7 @@ static const struct file_operations btrfs_dir_file_operations = {
 	.iterate	= btrfs_real_readdir,
 	.unlocked_ioctl	= btrfs_ioctl,
 #ifdef CONFIG_COMPAT
-	.compat_ioctl	= btrfs_ioctl,
+	.compat_ioctl	= btrfs_compat_ioctl,
 #endif
 	.release        = btrfs_release_file,
 	.fsync		= btrfs_sync_file,
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 1c22c65..55baee9 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -5357,3 +5357,24 @@ long btrfs_ioctl(struct file *file, unsigned int
 
 	return -ENOTTY;
 }
+
+#ifdef CONFIG_COMPAT
+long btrfs_compat_ioctl(struct file *file, unsigned int
+		cmd, unsigned long arg)
+{
+	switch (cmd) {
+	case FS_IOC32_GETFLAGS:
+		cmd = FS_IOC_GETFLAGS;
+		break;
+	case FS_IOC32_SETFLAGS:
+		cmd = FS_IOC_SETFLAGS;
+		break;
+	case FS_IOC32_GETVERSION:
+		cmd = FS_IOC_GETVERSION;
+		break;
+	default:
+		return -ENOIOCTLCMD;
+	}
+	return btrfs_ioctl(file, cmd, (unsigned long) compat_ptr(arg));
+}
+#endif
-- 
2.4.10

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

* Re: [PATCHv2] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl
  2015-10-29  8:22 [PATCHv2] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl Luke Dashjr
@ 2015-10-29 14:21 ` David Sterba
  2015-10-29 17:33 ` Josef Bacik
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2015-10-29 14:21 UTC (permalink / raw)
  To: Luke Dashjr
  Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs, linux-kernel,
	trivial

On Thu, Oct 29, 2015 at 08:22:21AM +0000, Luke Dashjr wrote:
> 32-bit ioctl uses these rather than the regular FS_IOC_* versions. They can
> be handled in btrfs using the same code. Without this, 32-bit {ch,ls}attr
> fail.
> 
> Signed-off-by: Luke Dashjr <luke-jr+git@utopios.org>
> Cc: stable@vger.kernel.org

Reviewed-by: David Sterba <dsterba@suse.com>

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

* Re: [PATCHv2] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl
  2015-10-29  8:22 [PATCHv2] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl Luke Dashjr
  2015-10-29 14:21 ` David Sterba
@ 2015-10-29 17:33 ` Josef Bacik
  1 sibling, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2015-10-29 17:33 UTC (permalink / raw)
  To: Luke Dashjr, Chris Mason, David Sterba, linux-btrfs, linux-kernel,
	trivial

On 10/29/2015 04:22 AM, Luke Dashjr wrote:
> 32-bit ioctl uses these rather than the regular FS_IOC_* versions. They can
> be handled in btrfs using the same code. Without this, 32-bit {ch,ls}attr
> fail.
>

Looks good, thanks,

Reviewed-by: Josef Bacik <jbacik@fb.com>


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

end of thread, other threads:[~2015-10-29 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-29  8:22 [PATCHv2] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl Luke Dashjr
2015-10-29 14:21 ` David Sterba
2015-10-29 17:33 ` Josef Bacik

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