From patchwork Wed Sep 26 10:23:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 10615619 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 07EB7417B for ; Wed, 26 Sep 2018 10:25:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05D9B2A7A4 for ; Wed, 26 Sep 2018 10:25:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE6D82A7B4; Wed, 26 Sep 2018 10:25:52 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 7DA582A7A4 for ; Wed, 26 Sep 2018 10:25:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727157AbeIZQiG (ORCPT ); Wed, 26 Sep 2018 12:38:06 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:48606 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727483AbeIZQiG (ORCPT ); Wed, 26 Sep 2018 12:38:06 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w8QANhNW037022 for ; Wed, 26 Sep 2018 10:25:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=B/gqPIqJL3GmBny8e+Zs/yKNwzmnnzetnptij2ZNJtQ=; b=gEmJYwm6FwGyfcTmJKYGv+tu9ldSw8FrCSVDASIVEDL1iQx4wHN0GU7ji6WAS7LfUjVq GBuesV9DITUF3jQHcW8aEzSmlPnVQNHbjYfEvGCNT2cLLK+SwHvSi0v1Xdo7i9r2qGyB J/r6LiTwgPiZuhJTHFpOfZhS+dHj9OnZ6zeTDR54GX1e0CnBjzj2iqlG5z+Xyh5irRwA v87++ZqvzIG1Ny3drbedbIzyM8WmYO7dxNVqEzIpqMTpxJYq5CMYiTzgPYWHCDI06kQ4 aCxpNWCvkmLLqz20QRkJkXt0eAvw14ZUzfuPZ6sScxvGX4E+JNckQ5LuwehQiTy5Q07C bA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2mnvtur9bp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 26 Sep 2018 10:25:49 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w8QAPmMI027230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 26 Sep 2018 10:25:49 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w8QAPm9b032136 for ; Wed, 26 Sep 2018 10:25:48 GMT Received: from localhost.localdomain (/70.176.225.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Sep 2018 03:25:48 -0700 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v3 16/30] xfsprogs: add parent pointer support to attribute code Date: Wed, 26 Sep 2018 03:23:19 -0700 Message-Id: <1537957413-10630-17-git-send-email-allison.henderson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537957413-10630-1-git-send-email-allison.henderson@oracle.com> References: <1537957413-10630-1-git-send-email-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9027 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809260104 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add the new parent attribute type. XFS_ATTR_PARENT is used only for parent pointer entries; it uses reserved blocks like XFS_ATTR_ROOT. [dchinner: forward ported and cleaned up] [achender: rebased] Signed-off-by: Mark Tinguely Signed-off-by: Dave Chinner Signed-off-by: Allison Henderson --- libxfs/xfs_attr.c | 4 +++- libxfs/xfs_attr.h | 2 ++ libxfs/xfs_attr_leaf.c | 1 + libxfs/xfs_da_format.h | 12 ++++++++---- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 1e86c94..3a5f8f8 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -377,11 +377,13 @@ xfs_attr_set( struct xfs_buf *leaf_bp = NULL; struct xfs_da_args args; struct xfs_trans_res tres; - int rsvd = (flags & ATTR_ROOT) != 0; + int rsvd; int error, local; XFS_STATS_INC(mp, xs_attr_set); + rsvd = ((flags & ATTR_ROOT) | ATTR_PARENT) != 0; + if (XFS_FORCED_SHUTDOWN(dp->i_mount)) return -EIO; diff --git a/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index d3407f1..126a024 100644 --- a/libxfs/xfs_attr.h +++ b/libxfs/xfs_attr.h @@ -32,6 +32,7 @@ struct xfs_attr_list_context; #define ATTR_SECURE 0x0008 /* use attrs in security namespace */ #define ATTR_CREATE 0x0010 /* pure create: fail if attr already exists */ #define ATTR_REPLACE 0x0020 /* pure set: fail if attr does not exist */ +#define ATTR_PARENT 0x0040 /* use attrs in parent namespace */ #define ATTR_INCOMPLETE 0x4000 /* [kernel] return INCOMPLETE attr keys */ @@ -42,6 +43,7 @@ struct xfs_attr_list_context; { ATTR_SECURE, "SECURE" }, \ { ATTR_CREATE, "CREATE" }, \ { ATTR_REPLACE, "REPLACE" }, \ + { ATTR_PARENT, "PARENT" }, \ { ATTR_KERNOTIME, "KERNOTIME" }, \ { ATTR_KERNOVAL, "KERNOVAL" }, \ { ATTR_INCOMPLETE, "INCOMPLETE" } diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index 7942aee..5420682 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -21,6 +21,7 @@ #include "xfs_bmap.h" #include "xfs_attr_sf.h" #include "xfs_attr_remote.h" +#include "xfs_attr.h" #include "xfs_attr_leaf.h" #include "xfs_trace.h" #include "xfs_cksum.h" diff --git a/libxfs/xfs_da_format.h b/libxfs/xfs_da_format.h index 5d5bf3b..67cb9ea 100644 --- a/libxfs/xfs_da_format.h +++ b/libxfs/xfs_da_format.h @@ -746,24 +746,28 @@ struct xfs_attr3_icleaf_hdr { #define XFS_ATTR_LOCAL_BIT 0 /* attr is stored locally */ #define XFS_ATTR_ROOT_BIT 1 /* limit access to trusted attrs */ #define XFS_ATTR_SECURE_BIT 2 /* limit access to secure attrs */ +#define XFS_ATTR_PARENT_BIT 3 /* parent pointer secure attrs */ #define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */ #define XFS_ATTR_LOCAL (1 << XFS_ATTR_LOCAL_BIT) #define XFS_ATTR_ROOT (1 << XFS_ATTR_ROOT_BIT) #define XFS_ATTR_SECURE (1 << XFS_ATTR_SECURE_BIT) +#define XFS_ATTR_PARENT (1 << XFS_ATTR_PARENT_BIT) #define XFS_ATTR_INCOMPLETE (1 << XFS_ATTR_INCOMPLETE_BIT) /* * Conversion macros for converting namespace bits from argument flags * to ondisk flags. */ -#define XFS_ATTR_NSP_ARGS_MASK (ATTR_ROOT | ATTR_SECURE) -#define XFS_ATTR_NSP_ONDISK_MASK (XFS_ATTR_ROOT | XFS_ATTR_SECURE) +#define XFS_ATTR_NSP_ARGS_MASK (ATTR_ROOT | ATTR_SECURE | XFS_ATTR_PARENT) +#define XFS_ATTR_NSP_ONDISK_MASK (XFS_ATTR_ROOT | XFS_ATTR_SECURE | XFS_ATTR_PARENT) #define XFS_ATTR_NSP_ONDISK(flags) ((flags) & XFS_ATTR_NSP_ONDISK_MASK) #define XFS_ATTR_NSP_ARGS(flags) ((flags) & XFS_ATTR_NSP_ARGS_MASK) #define XFS_ATTR_NSP_ARGS_TO_ONDISK(x) (((x) & ATTR_ROOT ? XFS_ATTR_ROOT : 0) |\ - ((x) & ATTR_SECURE ? XFS_ATTR_SECURE : 0)) + ((x) & ATTR_SECURE ? XFS_ATTR_SECURE : 0) | \ + ((x) & ATTR_PARENT ? XFS_ATTR_PARENT : 0)) #define XFS_ATTR_NSP_ONDISK_TO_ARGS(x) (((x) & XFS_ATTR_ROOT ? ATTR_ROOT : 0) |\ - ((x) & XFS_ATTR_SECURE ? ATTR_SECURE : 0)) + ((x) & XFS_ATTR_SECURE ? ATTR_SECURE : 0) | \ + ((x) & XFS_ATTR_PARENT ? ATTR_PARENT : 0)) /* * Alignment for namelist and valuelist entries (since they are mixed