Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8546869ybl; Thu, 16 Jan 2020 19:17:17 -0800 (PST) X-Google-Smtp-Source: APXvYqzHTWWbEvV2h135zbwwMVR7eQt8oH8KsAVmocRBgAxbgX/poneVWUxYeNa9CnHwXJ89HBNv X-Received: by 2002:a9d:62c2:: with SMTP id z2mr4784322otk.309.1579231037416; Thu, 16 Jan 2020 19:17:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579231037; cv=none; d=google.com; s=arc-20160816; b=g2Su6I98rigR5hapiIwkK3Ujlw2qt9nZE2bvkrJuFZriqqWD+YX6qo66CRHKRVlaWs SfQH/KDYffDBX53fJLnFJSC4pbpQEHnd8xCC+E1AsYUbhX3Fzs46SsX8rzI1yODBy90X Prihtv+aRG7IpECOcA2cw3r6IUjNfTmOLFGqGoAFD/tsdl3/b18ben4V4aUuM4dC3as6 dnvAVZFLMoLOMmmK0nmM6h8qDZ3HAVIu9a/mpRenqs4LUvN+nqBa5x8UW0fdkErDlnnW L82fp8wxebeJu2UjMfuH3EWBZdWui9eXZS0dAFfCOaoT1X4HaatFqk1Kz7xsEC3h7d4h pPGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tPFCWkxl8hpP8UYhvo2088bZi92WZS4d5RHqiKH+u1Y=; b=DslqqAjV6JHg1qrbDoVQL2FoCLXcxmEFoFpDU37Zs/owGLlRUPubj3xG6EcvMQynEx 2fDKng+Z249FPrQiK9h73zPWrZejYVWsteziRZkvGn66m0nWP14dzROhkMwTNXEg1U0E TvlA7oUTg6Pp5AU1RjUfeRstahRC+iPpQIHxdusDMyrTrr4Pycl9/MZNLIPG3KUfnqwS FUYu6jypYuxjVd7612K+Vx76qBhhXwa2f4bN1aqHKgPCrHsvlbXwjLY18MOqV78DDZy+ pLYOAHql1+r94/i3ffUIuz/jXfvBbUmLoS0xDwiYUDA0RiPUOayToDHtScbYDW3Q0czo 2dmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DnNiYe5r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y3si14240884oto.98.2020.01.16.19.17.03; Thu, 16 Jan 2020 19:17:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DnNiYe5r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733108AbgAPXYS (ORCPT + 99 others); Thu, 16 Jan 2020 18:24:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:53166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730066AbgAPXYQ (ORCPT ); Thu, 16 Jan 2020 18:24:16 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7BDFD2072E; Thu, 16 Jan 2020 23:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217054; bh=5jCLxx3Rwe6TZPOs6dpI1oxqJLHtu7QOJCkhfkEuc64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DnNiYe5rISY8YEavO/RMvJH2NTr05h9dj9VE5Hjn6fND0TbBlOgGbVtAXPvdLgGTl qpDBR5SG4EH/aFJHl8Mxlkzg8WgLsjYPaUhJkVE3jNeKXJcxQN6TyR7sgrR0Zlsjm/ Ih5MB0jvOnlhd98PrWovMCWwJjnlZYojaAxeMX98= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Peterson , Andreas Gruenbacher , Arnd Bergmann Subject: [PATCH 5.4 129/203] gfs2: add compat_ioctl support Date: Fri, 17 Jan 2020 00:17:26 +0100 Message-Id: <20200116231756.453956408@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231745.218684830@linuxfoundation.org> References: <20200116231745.218684830@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann commit 8d0980704842e8a68df2c3164c1c165e5c7ebc08 upstream. Out of the four ioctl commands supported on gfs2, only FITRIM works in compat mode. Add a proper handler based on the ext4 implementation. Fixes: 6ddc5c3ddf25 ("gfs2: getlabel support") Reviewed-by: Bob Peterson Cc: Andreas Gruenbacher Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- fs/gfs2/file.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -354,6 +355,31 @@ static long gfs2_ioctl(struct file *filp return -ENOTTY; } +#ifdef CONFIG_COMPAT +static long gfs2_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + switch(cmd) { + /* These are just misnamed, they actually get/put from/to user an int */ + case FS_IOC32_GETFLAGS: + cmd = FS_IOC_GETFLAGS; + break; + case FS_IOC32_SETFLAGS: + cmd = FS_IOC_SETFLAGS; + break; + /* Keep this list in sync with gfs2_ioctl */ + case FITRIM: + case FS_IOC_GETFSLABEL: + break; + default: + return -ENOIOCTLCMD; + } + + return gfs2_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); +} +#else +#define gfs2_compat_ioctl NULL +#endif + /** * gfs2_size_hint - Give a hint to the size of a write request * @filep: The struct file @@ -1294,6 +1320,7 @@ const struct file_operations gfs2_file_f .write_iter = gfs2_file_write_iter, .iopoll = iomap_dio_iopoll, .unlocked_ioctl = gfs2_ioctl, + .compat_ioctl = gfs2_compat_ioctl, .mmap = gfs2_mmap, .open = gfs2_open, .release = gfs2_release, @@ -1309,6 +1336,7 @@ const struct file_operations gfs2_file_f const struct file_operations gfs2_dir_fops = { .iterate_shared = gfs2_readdir, .unlocked_ioctl = gfs2_ioctl, + .compat_ioctl = gfs2_compat_ioctl, .open = gfs2_open, .release = gfs2_release, .fsync = gfs2_fsync, @@ -1325,6 +1353,7 @@ const struct file_operations gfs2_file_f .write_iter = gfs2_file_write_iter, .iopoll = iomap_dio_iopoll, .unlocked_ioctl = gfs2_ioctl, + .compat_ioctl = gfs2_compat_ioctl, .mmap = gfs2_mmap, .open = gfs2_open, .release = gfs2_release, @@ -1338,6 +1367,7 @@ const struct file_operations gfs2_file_f const struct file_operations gfs2_dir_fops_nolock = { .iterate_shared = gfs2_readdir, .unlocked_ioctl = gfs2_ioctl, + .compat_ioctl = gfs2_compat_ioctl, .open = gfs2_open, .release = gfs2_release, .fsync = gfs2_fsync,