From patchwork Thu Apr 14 08:10:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Florian Margaine X-Patchwork-Id: 8832341 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 99758C0553 for ; Thu, 14 Apr 2016 08:10:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 95EAE2026C for ; Thu, 14 Apr 2016 08:10:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 97F1720145 for ; Thu, 14 Apr 2016 08:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751661AbcDNIJk (ORCPT ); Thu, 14 Apr 2016 04:09:40 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:37248 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750861AbcDNIJg (ORCPT ); Thu, 14 Apr 2016 04:09:36 -0400 Received: by mail-wm0-f54.google.com with SMTP id n3so113838879wmn.0 for ; Thu, 14 Apr 2016 01:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=margaine-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:mime-version :content-transfer-encoding; bh=0IXw9NBSz9CxmpF2PeEC4IgmWIw5IwM0Q8RJKQfpQqQ=; b=ep86BJZfWehPBzV6XQTSdhfjG1eqpZRPZY24rW8I3rSTIBCM+KkhrltHHHoeZI2ZxS 6ZLj4EdAkffLXbJKEyio5d/3xiDHrwdSr7Mzese3/P18AqgAWbkaTqSFGlr4gdPM9m8o zv9Nr05NMJLO32optXpcVCV7Pe1l4zfix0g5vp01IQ0+ZqFRJfr0CRprKilaJIoxua8L KnIPjCx0IzZVK/D8EjbiSIxttOWetdli/f7+ykXlEPR6wdusKae0nHRl5uWZ9HQsff2R qbtpquTbOGHUWJhoup+WNje2rf0GyDnwlRKd/+T1LgqQQHgP37zHL05VDZijBfKPMuwL MmnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=0IXw9NBSz9CxmpF2PeEC4IgmWIw5IwM0Q8RJKQfpQqQ=; b=MCMqeth6fHKWqeBZah+Qbg508UzzvuMi9jMTt2zc76oQEVBMMuJVjbPb4jUnXG2W+m OT3+Xs8I4aFOoSxexFLGXB4LIkSb5KEWc5IcSX63+i05IAU/FB/+fBLYJn5hBde3XxxP u+C5w0/PT4mdzMwFcWGpNLXimgDpYSbK0Ca2KArSM8KPI3QweEnf/DSKPn+Iprrr2GFC 3161sNHkc+QnjoQ2EqjpmDN4NRDcQXHBokFV11jzqrZJUXRzB/JfAS/OvM3bSXgMYxAt q8tpEAN3D2nSblSFV1HcDXiiju7SPC52NLYKPuhT8rWcUpuPxsxm8LsoMmEVCQyfhORi joww== X-Gm-Message-State: AD7BkJL2mPEOZMQnK/p1BR5jgNUmC0Cw/sS6j9v2ThTVdQu/pm5gdPVAn5TeQNJnnsGYnQ== X-Received: by 10.28.225.198 with SMTP id y189mr36719640wmg.34.1460621374820; Thu, 14 Apr 2016 01:09:34 -0700 (PDT) Received: from genera (5-49-178-78.hfc.dyn.abo.bbox.fr. [5.49.178.78]) by smtp.gmail.com with ESMTPSA id lh1sm42588748wjb.20.2016.04.14.01.09.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Apr 2016 01:09:34 -0700 (PDT) Message-ID: <1460621441.4952.2.camel@margaine.com> Subject: Re: [PATCH] fs: add the FIGETFROZEN ioctl call From: Florian Margaine To: Alexander Viro , Jeff Layton , "J. Bruce Fields" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 14 Apr 2016 10:10:41 +0200 In-Reply-To: References: X-Mailer: Evolution 3.20.1 Mime-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, For some reason, my email client replaced tabs with spaces in my previous email. Here is the patch using another client. Regards, Florian From 80febe62cf5c21e0a369b64e38c82f068a416a61 Mon Sep 17 00:00:00 2001 From: Florian MARGAINE Date: Sat, 19 Mar 2016 23:25:28 +0100 Subject: [PATCH] fs: add the FIGETFROZEN ioctl call This lets userland get the filesystem freezing status, aka whether the filesystem is frozen or not. This is so that an application can know if it should freeze the filesystem or if it isn't necessary when taking a snapshot. ---  fs/compat_ioctl.c       |  1 +  fs/ioctl.c              | 13 +++++++++++++  include/uapi/linux/fs.h |  1 +  3 files changed, 15 insertions(+)  #define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)  #define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range) --  2.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index bd01b92..d2173ab 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -918,6 +918,7 @@ COMPATIBLE_IOCTL(FIGETBSZ)  COMPATIBLE_IOCTL(FIFREEZE)  COMPATIBLE_IOCTL(FITHAW)  COMPATIBLE_IOCTL(FITRIM) +COMPATIBLE_IOCTL(FIGETFROZEN)  COMPATIBLE_IOCTL(KDGETKEYCODE)  COMPATIBLE_IOCTL(KDSETKEYCODE)  COMPATIBLE_IOCTL(KDGKBTYPE) diff --git a/fs/ioctl.c b/fs/ioctl.c index 116a333..249ed20 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -568,6 +568,16 @@ static int ioctl_fsthaw(struct file *filp)   return thaw_super(sb);  }   +static int ioctl_fsgetfrozen(struct file *filp) +{ + struct super_block *sb = file_inode(filp)->i_sb; + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + + return sb->s_writers.frozen; +} +  static long ioctl_file_dedupe_range(struct file *file, void __user *arg)  {   struct file_dedupe_range __user *argp = arg; @@ -652,6 +662,9 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,   error = ioctl_fsthaw(filp);   break;   + case FIGETFROZEN: + return put_user(ioctl_fsgetfrozen(filp), argp); +   case FS_IOC_FIEMAP:   return ioctl_fiemap(filp, arg);   diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 149bec8..d48f19c 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -230,6 +230,7 @@ struct fsxattr {  #define FIFREEZE _IOWR('X', 119, int) /* Freeze */  #define FITHAW _IOWR('X', 120, int) /* Thaw */  #define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */ +#define FIGETFROZEN _IOWR('X', 122, int) /* Frozen status */  #define FICLONE _IOW(0x94, 9, int)