From patchwork Fri Aug 31 02:29:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10583057 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5DD9A5A4 for ; Fri, 31 Aug 2018 02:29:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FD8C2C384 for ; Fri, 31 Aug 2018 02:29:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 446392C388; Fri, 31 Aug 2018 02:29:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED8B42C384 for ; Fri, 31 Aug 2018 02:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727173AbeHaGfB (ORCPT ); Fri, 31 Aug 2018 02:35:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:55758 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726037AbeHaGfB (ORCPT ); Fri, 31 Aug 2018 02:35:01 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E0A57B05B for ; Fri, 31 Aug 2018 02:29:51 +0000 (UTC) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 1/3] btrfs: Set qgroup inherit size limit to SZ_4K instead of page size Date: Fri, 31 Aug 2018 10:29:28 +0800 Message-Id: <20180831022930.3465-2-wqu@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180831022930.3465-1-wqu@suse.com> References: <20180831022930.3465-1-wqu@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change btrfs_qgroup_inherit maximum size from PAGE_SIZE to SZ_4K to make it consistent across different architectures. Although in theory this could lead to incompatibility, but considering how rare btrfs_qgroup_inherit is used, it's still not too late to change it without impacting a large user base. Signed-off-by: Qu Wenruo --- fs/btrfs/ioctl.c | 2 +- include/uapi/linux/btrfs.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 63600dc2ac4c..5db8680b40a9 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1811,7 +1811,7 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file, if (vol_args->flags & BTRFS_SUBVOL_RDONLY) readonly = true; if (vol_args->flags & BTRFS_SUBVOL_QGROUP_INHERIT) { - if (vol_args->size > PAGE_SIZE) { + if (vol_args->size > BTRFS_QGROUP_INHERIT_MAX_SIZE) { ret = -EINVAL; goto free_args; } diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h index 5ca1d21fc4a7..311edb65567c 100644 --- a/include/uapi/linux/btrfs.h +++ b/include/uapi/linux/btrfs.h @@ -82,6 +82,7 @@ struct btrfs_qgroup_limit { */ #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) +#define BTRFS_QGROUP_INHERIT_MAX_SIZE (SZ_4K) struct btrfs_qgroup_inherit { __u64 flags; __u64 num_qgroups;