Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1203026ybl; Fri, 16 Aug 2019 10:34:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxyNufCwYajUJWVop/JBYmGzCgbHhWCYXSkYhQnXKAUMtZeGhqai/mkDmFMI3ezGie1FTL X-Received: by 2002:a63:f401:: with SMTP id g1mr9091979pgi.314.1565976867377; Fri, 16 Aug 2019 10:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565976867; cv=none; d=google.com; s=arc-20160816; b=qBFcqfz2OY8sgeFm38tDhwoEJa71UYXVeiPoaRajxE4UiIWJgSMNdb7KPfnrEg05Xq t7yyA4xWPnV+V551ZqtQRP5b9K8ML3Cm8NyNCTulsXuc11HI50+0S8bX88dcAuJVKxE8 Gf3zQ1d4G48X/33ib2NJodqYe98ZJOWQH9nZAGtZNdkfJvQSh71lh4diC85K0IOWwh/K GixyA3DEW//ObkuouverlT2utdd+wWf+bUrjyfG/nNmTvn4CbsLpAcO653bctI6NZnoS SqkV9UkPgCh+RKlA0tcYfZbEKKW4MYZGIT9dKKJLNLMCFSJXEOjYZXChFMRVUV3E6mnf 5NGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=+aWrb6bkEyRJ9ljqtUOtJ0J5JLJy+MWVMX/WZQyVm9g=; b=q6C8FA4hMbTs5PhJwuJonIwHIgT1oM758jHfb9wPwq5FY/eQ79WSZPDo4NOniDh5fu uOwJbe8RQPfDsyaBX3/LvgMnYe/m0dHHE/AjtoGVqK1O2xput0+zb+vRvI8pIIzbtFn/ SiK/BebSUIhqaQ36HSa9Gf/w1s/WnTRSRFXuOFjvvjm1nJvbm3IYGoDzW55CYBOOP9Ev dO4iensCL+b+LIUo2eh69w0HGTbgwaowylmAr+luU81kObhOr3CfI/c92jb8Ym7ttEjE /GGHPzPN/2rgeqH4kawy1p5IHIcYkI3AjZplXx2WpZzpss4nX1bpQs7U7vShZOZdgbxi YX1g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 60si4401680plb.16.2019.08.16.10.34.11; Fri, 16 Aug 2019 10:34:27 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727635AbfHPRb7 (ORCPT + 99 others); Fri, 16 Aug 2019 13:31:59 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:44510 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726824AbfHPRb7 (ORCPT ); Fri, 16 Aug 2019 13:31:59 -0400 Received: by mail-ot1-f68.google.com with SMTP id w4so10213792ote.11 for ; Fri, 16 Aug 2019 10:31:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+aWrb6bkEyRJ9ljqtUOtJ0J5JLJy+MWVMX/WZQyVm9g=; b=cgZj4bLlAZhniQUHKXpV13WqcGIxC4ZzTtDN6f+9cmxCu1lvwNy3JlRuKRaADuOr0a 43baiVeYPFrXPpGfZKy+9FTeyfBYiYDEqAfbbmBPd8PH0PdTGXTg+BdFHXGMcK3AWNzJ uiAVLQHPDYohMwPugo1t3dteStO2EbrdQZgrGFRNFGyRm+anFFczsA5UFiefrxNNrlkQ L/vHSBKw2buj2HiqZPHMtvn5idGItFNJ8M04gZ4bcZQfR4yB4X+O9nkMa8ItMUlC4uqG gR4k+rciJJvsclExrSPwaKXFoLknB4PRF3M0r2cLgypTwSkWQ2xUZAN8Qr+t8s3bpOQa glDA== X-Gm-Message-State: APjAAAUpfOR9WrykZN43iJFcQkeAbgL1wxKx7gSE6d5VAKF4kl/bpqaH gELvBmCE675j/l3bwIXqiW2/dAsvQH49K3d5gSgB/Q== X-Received: by 2002:a05:6830:1059:: with SMTP id b25mr7653740otp.95.1565976718425; Fri, 16 Aug 2019 10:31:58 -0700 (PDT) MIME-Version: 1.0 References: <20190814204259.120942-1-arnd@arndb.de> <20190814204259.120942-4-arnd@arndb.de> In-Reply-To: <20190814204259.120942-4-arnd@arndb.de> From: Andreas Gruenbacher Date: Fri, 16 Aug 2019 19:31:47 +0200 Message-ID: Subject: Re: [PATCH v5 03/18] gfs2: add compat_ioctl support To: Arnd Bergmann Cc: LKML , Alexander Viro , linux-fsdevel , Bob Peterson , Steve Whitehouse , Jan Kara , NeilBrown , "Darrick J. Wong" , cluster-devel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd, On Wed, Aug 14, 2019 at 10:45 PM Arnd Bergmann wrote: > > 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") > Signed-off-by: Arnd Bergmann > --- > fs/gfs2/file.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c > index 52fa1ef8400b..49287f0b96d0 100644 > --- a/fs/gfs2/file.c > +++ b/fs/gfs2/file.c > @@ -6,6 +6,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -354,6 +355,25 @@ static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > return -ENOTTY; > } > > +#ifdef CONFIG_COMPAT > +static long gfs2_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > +{ > + /* These are just misnamed, they actually get/put from/to user an int */ > + switch(cmd) { > + case FS_IOC32_GETFLAGS: > + cmd = FS_IOC_GETFLAGS; > + break; > + case FS_IOC32_SETFLAGS: > + cmd = FS_IOC_SETFLAGS; > + break; I'd like the code to be more explicit here: 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 +1314,7 @@ const struct file_operations gfs2_file_fops = { > .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 +1330,7 @@ const struct file_operations gfs2_file_fops = { > 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 +1347,7 @@ const struct file_operations gfs2_file_fops_nolock = { > .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 +1361,7 @@ const struct file_operations gfs2_file_fops_nolock = { > 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, > -- > 2.20.0 > Should we feed this through the gfs2 tree? Thanks, Andreas