From patchwork Fri Jan 24 00:16:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11349399 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7B0117EA for ; Fri, 24 Jan 2020 00:18:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 930BF214AF for ; Fri, 24 Jan 2020 00:18:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ffDgloUW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729277AbgAXASo (ORCPT ); Thu, 23 Jan 2020 19:18:44 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:34340 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbgAXASo (ORCPT ); Thu, 23 Jan 2020 19:18:44 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O08r6p182936; Fri, 24 Jan 2020 00:18:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=l6YttYBI5+Vagm6LiwE+vW/MFl/6//TJhcXrZU9Q204=; b=ffDgloUW53vgV7yF639ku9qFgLrvc+bRJTPRBLCMTgjOCFRzTA/PbF095seSsQDw3cw0 PhSHBxRIx21LFH4nbh1Oy4B63N46ITrzxInt0kY+iRYJ4z3xhrSND8xAFpdaee3oQjzN HPmwOV2OPFuOEzjeIPvHCir8CWEvU3eeoV0+3SDqu/XnS5RypcjaCzeJeuLsabmPGr4k em/ESwP3VraepDa5DhVPObwJwiS79T2zSMszFRR2A7OQAj6qBDHgv+Eb+cHzH/rEM7ns SCu8olu34SSdLSv2geTYSqNXgScJ0xwaGanXHFn6IehXRE2Z69GtkdzRXdVJIHmNVZzz Rw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 2xksyqns9p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:18:42 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O0DWQA037212; Fri, 24 Jan 2020 00:16:41 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2xqmuxkgwq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:16:41 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00O0GeMB030363; Fri, 24 Jan 2020 00:16:40 GMT Received: from localhost (/10.145.179.16) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Jan 2020 16:16:40 -0800 Subject: [PATCH 1/8] man: list xfs_io lsattr inode flag letters From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 23 Jan 2020 16:16:38 -0800 Message-ID: <157982499817.2765410.16336840066253160007.stgit@magnolia> In-Reply-To: <157982499185.2765410.18206322669640988643.stgit@magnolia> References: <157982499185.2765410.18206322669640988643.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 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-1911140001 definitions=main-2001240000 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001240000 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong The section of the xfs_io manpage for the 'chattr' command says to refer to xfsctl(3) for information on the flags. The inode flag information was moved to ioctl_xfs_fssetxattr(2) ages ago, and it never actually mapped the inode flag letters to inode flag bits, so fix the link and add such a mapping to the xfs_io manpage. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- man/man8/xfs_io.8 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 83 insertions(+), 6 deletions(-) diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8 index c69b295d..f5431a8c 100644 --- a/man/man8/xfs_io.8 +++ b/man/man8/xfs_io.8 @@ -794,18 +794,95 @@ for all directory entries below the currently open file can be used to restrict the output to directories only). This is a depth first descent, it does not follow symlinks and it also does not cross mount points. + +The current inode flag letters are documented below. +Please refer to the +.BR ioctl_xfs_fsgetxattr "(2)" +documentation for more details about what they mean. + +.PD 0 +.RS +.TP 0.5i +.B r +realtime file (XFS_XFLAG_REALTIME) + +.TP +.B p +prealloc (XFS_XFLAG_PREALLOC) + +.TP +.B i +immutable (XFS_XFLAG_IMMUTABLE) + +.TP +.B a +append only (XFS_XFLAG_APPEND) + +.TP +.B s +synchronous file writes (XFS_XFLAG_SYNC) + +.TP +.B A +noatime (XFS_XFLAG_NOATIME) + +.TP +.B d +nodump (XFS_XFLAG_NODUMP) + +.TP +.B t +inherit realtime flag (XFS_XFLAG_RTINHERIT)" + +.TP +.B P +inherit project id (XFS_XFLAG_PROJINHERIT) + +.TP +.B n +no symlink creation (XFS_XFLAG_NOSYMLINKS) + +.TP +.B e +extent size hint (XFS_XFLAG_EXTSIZE) + +.TP +.B E +inherit extent size hint (XFS_XFLAG_EXTSZINHERIT) + +.TP +.B f +nodefrag (XFS_XFLAG_NODEFRAG) + +.TP +.B S +filestream allocator (XFS_XFLAG_FILESTREAM) + +.TP +.B x +direct access persistent memory (XFS_XFLAG_DAX) + +.TP +.B C +copy on write extent hint (XFS_XFLAG_COWEXTSIZE) + +.TP +.B X +has extended attributes (XFS_XFLAG_HASATTR) +.RE + .TP .BR chattr " [ " \-R " | " \-D " ] [ " + / \-riasAdtPneEfSxC " ]" Change extended inode flags on the currently open file. The .B \-R and .B \-D -options have the same meaning as above. The mapping between each -letter and the inode flags (refer to -.BR xfsctl (3) -for the full list) is available via the -.B help -command. +options have the same meaning as above. + +See the +.B lsattr +command above for the list of inode flag letters. + .TP .BI "flink " path Link the currently open file descriptor into the filesystem namespace. From patchwork Fri Jan 24 00:16:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11349373 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B664109A for ; Fri, 24 Jan 2020 00:17:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45BB32071E for ; Fri, 24 Jan 2020 00:17:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="I20c5Mou" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729274AbgAXAQv (ORCPT ); Thu, 23 Jan 2020 19:16:51 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:33826 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729017AbgAXAQv (ORCPT ); Thu, 23 Jan 2020 19:16:51 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O08kNg024609; Fri, 24 Jan 2020 00:16:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=p5WWCQS9/YJVevyQmkRpMF99yu8gjZyqdYBNJMzya7o=; b=I20c5MouIybbeifocL7FesRhtMR68ic3nHSwN4OeOM5P42My321aFWC7twmttNGL6hlm bei5Rp38t3LcDnq9SQschDeMT6+wr3PGPMe7w/CxJxC2l0Ia+q9Wd/oCoHw8FM9aTNV5 9Y+WNoEkKFuJutlbTg48f3W6XDz0Ofj3ek2Uv/b7V+povMzsGv5x5oP+pBvv/Nz6lhcO qNSYXe7CtrpCvC6DOxKSn7AgEwhCg26WOpWyWay//xu8W80hk/0FGdH6KZLePBlek2Dw Ww1GiGVvrDOABeg3My95z2ZMkeyqAajSOLxC49B48ZYzTCZtMnzcWjW05BmknM+tf6/K 7Q== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2xkseuwvtd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:16:49 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O0E65X111077; Fri, 24 Jan 2020 00:16:48 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2xqmwb1b0r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:16:48 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00O0GlEj030419; Fri, 24 Jan 2020 00:16:47 GMT Received: from localhost (/10.145.179.16) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Jan 2020 16:16:46 -0800 Subject: [PATCH 2/8] man: document the xfs_db btheight command From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 23 Jan 2020 16:16:44 -0800 Message-ID: <157982500443.2765410.17401149852075835578.stgit@magnolia> In-Reply-To: <157982499185.2765410.18206322669640988643.stgit@magnolia> References: <157982499185.2765410.18206322669640988643.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 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-1911140001 definitions=main-2001240000 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001240000 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Document the btheight command in xfs_db. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- man/man8/xfs_db.8 | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8 index a1ee3514..53e34983 100644 --- a/man/man8/xfs_db.8 +++ b/man/man8/xfs_db.8 @@ -346,6 +346,45 @@ If the cursor points at an inode, dump the extended attribute block mapping btre Dump all keys and pointers in intermediate btree nodes, and all records in leaf btree nodes. .RE .TP +.BI "btheight [\-b " blksz "] [\-n " recs "] [\-w " max "|\-w " min "] btree types..." +For a given number of btree records and a btree type, report the number of +records and blocks for each level of the btree, and the total number of blocks. +The btree type must be given after the options. + +A raw btree geometry can be provided in the format +"record_bytes:key_bytes:ptr_bytes:header_type", where header_type is one of +"short", "long", "shortcrc", or "longcrc". + +The supported btree types are: +.IR bnobt , +.IR cntbt , +.IR inobt , +.IR finobt , +.IR bmapbt , +.IR refcountbt , +and +.IR rmapbt . + +Options are as follows: +.RS 1.0i +.TP 0.4i +.B \-b +is used to override the btree block size. +The default is the filesystem block size. +.TP +.B \-n +is used to specify the number of records to store. +This argument is required. +.TP +.B \-w max +shows only the best case scenario, which is when the btree blocks are +maximally loaded. +.TP +.B \-w min +shows only the worst case scenario, which is when the btree blocks are +half full. +.RE +.TP .B check See the .B blockget From patchwork Fri Jan 24 00:16:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11349401 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6FAE109A for ; Fri, 24 Jan 2020 00:18:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9136C214AF for ; Fri, 24 Jan 2020 00:18:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="D3fyeujk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729335AbgAXAS5 (ORCPT ); Thu, 23 Jan 2020 19:18:57 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:34518 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbgAXAS5 (ORCPT ); Thu, 23 Jan 2020 19:18:57 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O09q26183453; Fri, 24 Jan 2020 00:18:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=LA921WI6yfojEG96jHlZJ9/YUVJQ88zMY3s/z0maJyQ=; b=D3fyeujkVhvRjjD8mQ1UTFCnhQB4XachxlqXfi1iYBIh6mrPNT116Mvj/S+iaKiIKE6C tYBti3/N3RWnqT58V2zTbkrJONbfcYSPAFU58Sl2ShKU2N6FRJ2EXZEk0ADAMR5UObl+ pyeozQwICK9Ms3GJGtn5kfXwwLMiI52CxADDVgvVslde02Dv+TVoNISbHYegxD39hxMK 2mTBXpT6kLRNWKZcdXiJ4RTDRkoXea0gb+0mrH+z6mHl2omL//wtSpKYUi9nIhQqtb/X oWTbZ74+lLwv6m+HziWcCSwdbC2kycWxFLyAxJLw2b8rXQsq2kqKgJGhkNUmdhJGm3Pp Lg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 2xksyqnsax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:18:54 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O0EZkq156418; Fri, 24 Jan 2020 00:16:54 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2xqnrs0akb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:16:53 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00O0GrMD030562; Fri, 24 Jan 2020 00:16:53 GMT Received: from localhost (/10.145.179.16) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Jan 2020 16:16:52 -0800 Subject: [PATCH 3/8] man: reformat xfs_quota commands in the manpage for testing From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 23 Jan 2020 16:16:50 -0800 Message-ID: <157982501072.2765410.10319214860660759283.stgit@magnolia> In-Reply-To: <157982499185.2765410.18206322669640988643.stgit@magnolia> References: <157982499185.2765410.18206322669640988643.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 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-1911140001 definitions=main-2001240000 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001240000 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Reformat the xfs_quota commands listed in the xfs_quota.8 manpage so that we can implement a fstest that checks that each command actually has a section in the manpage. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- man/man8/xfs_quota.8 | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/man/man8/xfs_quota.8 b/man/man8/xfs_quota.8 index d9c5f649..e6fe7cd1 100644 --- a/man/man8/xfs_quota.8 +++ b/man/man8/xfs_quota.8 @@ -228,8 +228,7 @@ option sends the output to .I file instead of stdout. .HP -.B -free +.B free [ .B \-bir ] [ @@ -398,8 +397,7 @@ option reports information without the header line. The .B \-t option performs a terse report. .HP -.B -state +.B state [ .B \-gpu ] [ @@ -420,8 +418,7 @@ instead of stdout. The .B \-a option reports state on all filesystems and not just the current path. .HP -.B -limit +.B limit [ .BR \-g " | " \-p " | " \-u ] @@ -519,8 +516,7 @@ identified by the current path. Quota must not be enabled on the filesystem, else this operation will report an error. .HP -.B -dump +.B dump [ .BR \-g " | " \-p " | " \-u ] [ @@ -547,8 +543,7 @@ The file must be in the format produced by the .B dump command. .HP -.B -quot +.B quot [ .BR \-g " | " \-p " | " \-u ] [ From patchwork Fri Jan 24 00:16:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11349375 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BF6417EF for ; Fri, 24 Jan 2020 00:17:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 76B962071E for ; Fri, 24 Jan 2020 00:17:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="BjTTmnod" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729505AbgAXARF (ORCPT ); Thu, 23 Jan 2020 19:17:05 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:60802 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727056AbgAXARF (ORCPT ); Thu, 23 Jan 2020 19:17:05 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O09MsV183357; Fri, 24 Jan 2020 00:17:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=C5ipKU4BVGYGQAU07YPaghijI6NUrnGUdQM1nzVPMhE=; b=BjTTmnod3P7MSaQNRqDZ9vLTCMC6j/BdvJgiZT1ccqjsuNmb4f/iWz0Om6+emqgbJdVv zIYpXhicNHSLqaDlQl5MfldmXn2vbTKQbuWxOlZBFuDoNyvIgbnYolDwYYGGMN1VMQKU jGpdCWjJjVUwb7eaTisQegY8Lt9q+JJXRooPiZWsqwjBgNkFV+AgiMiSqQCAdRPzOyWo CYXIzVx1xoxjdAk6dl/bZzHPSVbvfegaeLFs/E0qu/jZ3Fq4JHBR+0MgAPb+mnLtzpfg 1nqGDMqmbcaKins/lItjX/NM9P47qF9qQkyPucgaLOvTf81sfHF/rKmElvbR2FPf+P2q 2g== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2xksyqns17-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:17:02 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O0E4ch110960; Fri, 24 Jan 2020 00:17:02 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2xqmwb1cup-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:17:02 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00O0H1HM020047; Fri, 24 Jan 2020 00:17:01 GMT Received: from localhost (/10.145.179.16) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Jan 2020 16:17:00 -0800 Subject: [PATCH 4/8] man: document some missing xfs_db commands From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 23 Jan 2020 16:16:56 -0800 Message-ID: <157982501686.2765410.2779527901724988940.stgit@magnolia> In-Reply-To: <157982499185.2765410.18206322669640988643.stgit@magnolia> References: <157982499185.2765410.18206322669640988643.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 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-1911140001 definitions=main-2001240000 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001240000 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong The 'attr_set', 'attr_remove', and 'logformat' commands in xfs_db were not documented. Add sections about them to the manpage. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- db/attrset.c | 4 ++-- man/man8/xfs_db.8 | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/db/attrset.c b/db/attrset.c index 56972506..8eecf465 100644 --- a/db/attrset.c +++ b/db/attrset.c @@ -23,11 +23,11 @@ static void attrset_help(void); static const cmdinfo_t attr_set_cmd = { "attr_set", "aset", attr_set_f, 1, -1, 0, - N_("[-r|-s|-p|-u] [-n] [-R|-C] [-v n] name"), + N_("[-r|-s|-u] [-n] [-R|-C] [-v n] name"), N_("set the named attribute on the current inode"), attrset_help }; static const cmdinfo_t attr_remove_cmd = { "attr_remove", "aremove", attr_remove_f, 1, -1, 0, - N_("[-r|-s|-p|-u] [-n] name"), + N_("[-r|-s|-u] [-n] name"), N_("remove the named attribute from the current inode"), attrset_help }; static void diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8 index 53e34983..9f1ff761 100644 --- a/man/man8/xfs_db.8 +++ b/man/man8/xfs_db.8 @@ -179,6 +179,57 @@ Set current address to the AGI block for allocation group .IR agno . If no argument is given, use the current allocation group. .TP +.BI "attr_remove [\-r|\-u|\-s] [\-n] " name +Remove the specified extended attribute from the current file. +.RS 1.0i +.TP 0.4i +.B \-r +Sets the attribute in the root namespace. +Only one namespace option can be specified. +.TP +.B \-u +Sets the attribute in the user namespace. +Only one namespace option can be specified. +.TP +.B \-s +Sets the attribute in the secure namespace. +Only one namespace option can be specified. +.TP +.B \-n +Do not enable 'noattr2' mode on V4 filesystems. +.RE +.TP +.BI "attr_set [\-r|\-u|\-s] [\-n] [\-R|\-C] [\-v " namelen "] " name +Sets an extended attribute on the current file with the given name. +.RS 1.0i +.TP 0.4i +.B \-r +Sets the attribute in the root namespace. +Only one namespace option can be specified. +.TP +.B \-u +Sets the attribute in the user namespace. +Only one namespace option can be specified. +.TP +.B \-s +Sets the attribute in the secure namespace. +Only one namespace option can be specified. +.TP +.B \-n +Do not enable 'noattr2' mode on V4 filesystems. +.TP +.B \-R +Replace the attribute. +The command will fail if the attribute does not already exist. +.TP +.B \-C +Create the attribute. +The command will fail if the attribute already exists. +.TP +.B \-v +Set the attribute value to a string of this length containing the letter 'v'. +.RE +.TP .B b See the .B back @@ -737,6 +788,13 @@ Start logging output to .IR filename , stop logging, or print the current logging status. .TP +.BI "logformat [\-c " cycle "] [\-s " sunit "]" +Reformats the log to the specified log cycle and log stripe unit. +This has the effect of clearing the log destructively. +If the log cycle is not specified, the log is reformatted to the current cycle. +If the log stripe unit is not specified, the stripe unit from the filesystem +superblock is used. +.TP .B logres Print transaction reservation size information for each transaction type. This makes it easier to find discrepancies in the reservation calculations From patchwork Fri Jan 24 00:17:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11349377 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C651109A for ; Fri, 24 Jan 2020 00:17:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A51921569 for ; Fri, 24 Jan 2020 00:17:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Qf6wgEpj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729470AbgAXARL (ORCPT ); Thu, 23 Jan 2020 19:17:11 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:34122 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727056AbgAXARL (ORCPT ); Thu, 23 Jan 2020 19:17:11 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O0935v024877; Fri, 24 Jan 2020 00:17:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=vQYVkEaYryusdXge9Qv1MuafSuAS/FAZpkViHXYIrl4=; b=Qf6wgEpjuwq/U12ozPsSpbs+OpHKXPRVG0eHoMr/wTXaLRBCeUxPjNY553nIDgZOCSLO k12A3J+fL3ptbAc2e0fyfYiBA0hDD0DtSQ2bZScPlm0Yqacu0JjzUytEkhwEWLgrHZ6U ij/Mb9EvUMw9pE9iIWNbu3B/n4wv3o8j7JU9sjHgW2fgIQYCJuewkKipo57H0DbAzx56 onGXMeLAspPqrhwSJRqVhhTfGKp+QlunoLe0h71P51uHt4rwfBOiXFoL7IxpdszulpoL abMb7PsRyRqnJDTsUum0KA9h38U3fbY3FWE3ggMAMS3sAvR/6HHngblUUqL3Rhj0Ob8E GQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2xkseuwvv8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:17:08 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O0Eafv156543; Fri, 24 Jan 2020 00:17:08 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2xqnrs0avq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:17:08 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 00O0H7XH007678; Fri, 24 Jan 2020 00:17:07 GMT Received: from localhost (/10.145.179.16) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Jan 2020 16:17:07 -0800 Subject: [PATCH 5/8] xfs_db: dump per-AG reservations From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 23 Jan 2020 16:17:05 -0800 Message-ID: <157982502518.2765410.15232492114026905479.stgit@magnolia> In-Reply-To: <157982499185.2765410.18206322669640988643.stgit@magnolia> References: <157982499185.2765410.18206322669640988643.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 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-1911140001 definitions=main-2001240000 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001240000 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Add a new 'agresv' command to print the size and free blocks count of an AG along with the size and usage of the per-AG reservation. This command can be used to aid in diagnosing why a particular filesystem fails the mount time per-AG space reservation, and to figure out how much space needs to be freed from a given AG to fix the problem. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- db/info.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++ libxfs/libxfs_api_defs.h | 5 ++ man/man8/xfs_db.8 | 5 ++ 3 files changed, 114 insertions(+) diff --git a/db/info.c b/db/info.c index e5f1c2dd..fc5ccfe7 100644 --- a/db/info.c +++ b/db/info.c @@ -8,6 +8,7 @@ #include "init.h" #include "output.h" #include "libfrog/fsgeom.h" +#include "libfrog/logging.h" static void info_help(void) @@ -45,8 +46,111 @@ static const struct cmdinfo info_cmd = { .help = info_help, }; +static void +agresv_help(void) +{ + dbprintf(_( +"\n" +" Print the size and per-AG reservation information some allocation groups.\n" +"\n" +" Specific allocation group numbers can be provided as command line arguments.\n" +" If no arguments are provided, all allocation groups are iterated.\n" +"\n" +)); + +} + +static void +print_agresv_info( + xfs_agnumber_t agno) +{ + struct xfs_buf *bp; + struct xfs_agf *agf; + xfs_extlen_t ask = 0; + xfs_extlen_t used = 0; + xfs_extlen_t free = 0; + xfs_extlen_t length = 0; + int error; + + error = -libxfs_refcountbt_calc_reserves(mp, NULL, agno, &ask, &used); + if (error) + xfrog_perror(error, "refcountbt"); + error = -libxfs_finobt_calc_reserves(mp, NULL, agno, &ask, &used); + if (error) + xfrog_perror(error, "finobt"); + error = -libxfs_rmapbt_calc_reserves(mp, NULL, agno, &ask, &used); + if (error) + xfrog_perror(error, "rmapbt"); + + error = -libxfs_read_agf(mp, NULL, agno, 0, &bp); + if (error) + xfrog_perror(error, "AGF"); + agf = XFS_BUF_TO_AGF(bp); + length = be32_to_cpu(agf->agf_length); + free = be32_to_cpu(agf->agf_freeblks) + + be32_to_cpu(agf->agf_flcount); + libxfs_putbuf(bp); + + printf("AG %d: length: %u free: %u reserved: %u used: %u", + agno, length, free, ask, used); + if (ask - used > free) + printf(" "); + printf("\n"); +} + +static int +agresv_f( + int argc, + char **argv) +{ + xfs_agnumber_t agno; + int i; + + if (argc > 1) { + for (i = 1; i < argc; i++) { + long a; + char *p; + + errno = 0; + a = strtol(argv[i], &p, 0); + if (p == argv[i]) + errno = ERANGE; + if (errno) { + perror(argv[i]); + continue; + } + + if (a < 0 || a >= mp->m_sb.sb_agcount) { + fprintf(stderr, "%ld: Not a AG.\n", a); + continue; + } + + print_agresv_info(a); + } + return 0; + } + + for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) + print_agresv_info(agno); + + return 0; +} + +static const struct cmdinfo agresv_cmd = { + .name = "agresv", + .altname = NULL, + .cfunc = agresv_f, + .argmin = 0, + .argmax = -1, + .canpush = 0, + .args = NULL, + .oneline = N_("print AG reservation stats"), + .help = agresv_help, +}; + void info_init(void) { add_command(&info_cmd); + add_command(&agresv_cmd); } diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index eed63ace..cc7304ad 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -173,4 +173,9 @@ #define xfs_ag_init_headers libxfs_ag_init_headers #define xfs_buf_delwri_submit libxfs_buf_delwri_submit +#define xfs_refcountbt_calc_reserves libxfs_refcountbt_calc_reserves +#define xfs_finobt_calc_reserves libxfs_finobt_calc_reserves +#define xfs_rmapbt_calc_reserves libxfs_rmapbt_calc_reserves +#define xfs_read_agf libxfs_read_agf + #endif /* __LIBXFS_API_DEFS_H__ */ diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8 index 9f1ff761..7f73d458 100644 --- a/man/man8/xfs_db.8 +++ b/man/man8/xfs_db.8 @@ -179,6 +179,11 @@ Set current address to the AGI block for allocation group .IR agno . If no argument is given, use the current allocation group. .TP +.BI "agresv [" agno ] +Displays the length, free block count, per-AG reservation size, and per-AG +reservation usage for a given AG. +If no argument is given, display information for all AGs. +.TP .BI "attr_remove [\-r|\-u|\-s] [\-n] " name Remove the specified extended attribute from the current file. .RS 1.0i From patchwork Fri Jan 24 00:17:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11349379 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B819F109A for ; Fri, 24 Jan 2020 00:17:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93CB021835 for ; Fri, 24 Jan 2020 00:17:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="V5WoApLe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729546AbgAXARR (ORCPT ); Thu, 23 Jan 2020 19:17:17 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:55410 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727056AbgAXARR (ORCPT ); Thu, 23 Jan 2020 19:17:17 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O08sgN002844; Fri, 24 Jan 2020 00:17:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=EnTJXAWZADZJcCzFBE965w/xej9r1JJIYP0vW8Bo2wY=; b=V5WoApLeemPe40s02Kq6twzcqxkoioacZ1k4/8B9E8Aty1KppDSaKluHXecoZv7JmHtf CZxNkMszI/pOmanNK9FEvKSABBhtiXdAWfA9FULz0OSXK/hsQxVECSCSUCiEyq9o9E0R U74Rh6zJ30X4wHoh1k/pBKoVVkYuMWtRtAWskwRNSiR9XS792AiPKK2Cm7T1AOrc9h16 04Dqip97+iRVuKIKhHvJhMb8UpI09z45UNmYLbrkgHnz5N1snEl97K0lDLC4jBviZeda KfEwWbq+TSuHWuX2c5+UuGYl92RU6+FLnUWBM0e39F73cs9RWzMjwaO8/wBF7XiO0wk6 mg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2xktnrnn1g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:17:14 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O0DW3k037291; Fri, 24 Jan 2020 00:17:14 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2xqmuxkhrr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:17:14 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 00O0HD8g031219; Fri, 24 Jan 2020 00:17:13 GMT Received: from localhost (/10.145.179.16) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Jan 2020 16:17:13 -0800 Subject: [PATCH 6/8] xfs_io: fix copy_file_range length argument overflow From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 23 Jan 2020 16:17:11 -0800 Message-ID: <157982503121.2765410.8361260238180400802.stgit@magnolia> In-Reply-To: <157982499185.2765410.18206322669640988643.stgit@magnolia> References: <157982499185.2765410.18206322669640988643.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=956 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001240000 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001240000 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Don't let the length argument overflow size_t. This is mostly a problem on 32-bit platforms. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- io/copy_file_range.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/io/copy_file_range.c b/io/copy_file_range.c index 800b98da..fb5702e1 100644 --- a/io/copy_file_range.c +++ b/io/copy_file_range.c @@ -71,6 +71,7 @@ copy_range_f(int argc, char **argv) { long long src_off = 0; long long dst_off = 0; + long long llen; size_t len = 0; bool len_specified = false; int opt; @@ -99,11 +100,21 @@ copy_range_f(int argc, char **argv) } break; case 'l': - len = cvtnum(fsblocksize, fssectsize, optarg); - if (len == -1LL) { + llen = cvtnum(fsblocksize, fssectsize, optarg); + if (llen == -1LL) { printf(_("invalid length -- %s\n"), optarg); return 0; } + /* + * If size_t can't hold what's in llen, report a + * length overflow. + */ + if ((size_t)llen != llen) { + errno = EOVERFLOW; + perror("copy_range"); + return 0; + } + len = llen; len_specified = true; break; case 'f': From patchwork Fri Jan 24 00:17:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11349381 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA60717EA for ; Fri, 24 Jan 2020 00:17:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5EAF214AF for ; Fri, 24 Jan 2020 00:17:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="eX1p3nR0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729547AbgAXARX (ORCPT ); Thu, 23 Jan 2020 19:17:23 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:32868 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727056AbgAXARX (ORCPT ); Thu, 23 Jan 2020 19:17:23 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O08rO8182933; Fri, 24 Jan 2020 00:17:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=BOP91qwr/dnhQzLgzvLI6OK6tGlToJOGVHsgSnYYXZ4=; b=eX1p3nR0oYyoocdu+kW/Z5n3O+m3A46DAmS1+i6wdkzYaGjwB0GGKULxqJQE+9+g70yf nEqtzV/DtKTe188HgMbDXgB4iQt9YvqXjel2KVa3rc712RvAsJr5cauHyElKsufm4J3E m7x34HJyydjHBHWLAp158R5wyeDOWym9D93NlPmn+1ZIWwjBITxZvi0Bu/1YLuLPlJ+6 kneGNPZMAg5O+8wQSLrlRo58ZNgAsDR1KDIWheqZ9c3A/zQPGeA4e/ag35qk02jovDpi k5iqqTdBOnholqPm1pkVquBi0+oauto0iorHX1UdQTCLL6yWKyY5vg2LhckbW6T5o/mH BA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2xksyqns2r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:17:21 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O0E7Xn111158; Fri, 24 Jan 2020 00:17:20 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2xqmwb1f6b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:17:20 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00O0HJgG030705; Fri, 24 Jan 2020 00:17:19 GMT Received: from localhost (/10.145.179.16) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Jan 2020 16:17:19 -0800 Subject: [PATCH 7/8] xfs_io: fix pwrite/pread length truncation on 32-bit systems From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 23 Jan 2020 16:17:17 -0800 Message-ID: <157982503725.2765410.9945705757777826157.stgit@magnolia> In-Reply-To: <157982499185.2765410.18206322669640988643.stgit@magnolia> References: <157982499185.2765410.18206322669640988643.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=998 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001240000 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001240000 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong The pwrite and pread commands in xfs_io accept an operation length that can be any quantity that fits in a long long int; and loops to handle the cases where the operation length is larger than the IO buffer. Weirdly, the do_ functions contain code to shorten the operation to the IO buffer size but the @count parameter is size_t, which means that for a large argument on a 32-bit system, we rip off the upper bits of the length, turning your 8GB write into a 0 byte write, which does nothing. This was found by running generic/175 and observing that the 8G test file it creates has zero length after the operation: wrote 0/8589934592 bytes at offset 0 0.000000 bytes, 0 ops; 0.0001 sec (0.000000 bytes/sec and 0.0000 ops/sec) Fix this by pushing long long count all the way through the call stack. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- io/pread.c | 4 ++-- io/pwrite.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/io/pread.c b/io/pread.c index 1b4352be..d52e21d9 100644 --- a/io/pread.c +++ b/io/pread.c @@ -164,7 +164,7 @@ static ssize_t do_preadv( int fd, off64_t offset, - size_t count) + long long count) { int vecs = 0; ssize_t oldlen = 0; @@ -199,7 +199,7 @@ static ssize_t do_pread( int fd, off64_t offset, - size_t count, + long long count, size_t buffer_size) { if (!vectors) diff --git a/io/pwrite.c b/io/pwrite.c index ccf14be9..1c28612f 100644 --- a/io/pwrite.c +++ b/io/pwrite.c @@ -54,8 +54,8 @@ static ssize_t do_pwritev( int fd, off64_t offset, - size_t count, - int pwritev2_flags) + long long count, + int pwritev2_flags) { int vecs = 0; ssize_t oldlen = 0; @@ -97,7 +97,7 @@ static ssize_t do_pwrite( int fd, off64_t offset, - size_t count, + long long count, size_t buffer_size, int pwritev2_flags) { From patchwork Fri Jan 24 00:17:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11349383 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E88DD17EA for ; Fri, 24 Jan 2020 00:17:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2E2F21569 for ; Fri, 24 Jan 2020 00:17:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="fYysx2ec" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729184AbgAXAR3 (ORCPT ); Thu, 23 Jan 2020 19:17:29 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:34394 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727056AbgAXAR3 (ORCPT ); Thu, 23 Jan 2020 19:17:29 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O08oal024624; Fri, 24 Jan 2020 00:17:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=9yrSnLPoCUY9dPsCSYgxzDN/3KK5EAkUYpC+I4SarBM=; b=fYysx2ecdT1vXMaDI/GKCNtOmIHP+25bmdh6HGbFb7CmvtFuAt/wukw78E3KudtlDGPP HIXP9yOhDyDTMyMgqdHBN1IMEtEAMK42GO7WsoThD4nEaLwtDocqpIXHnUkMcJzK7/m6 WH5oWRf/hSb2JctqOcAGBXqhKgL9qmmV0kpRpw53MBRUbtG+ljEpQw+5nHgixy0SRGZZ VuqPfcIw+cmaSwPXX3kZzkp1OjGI8gzuDR4rRE/WTKYnNHpIvgcRUkEAMbq7TlhQMncb soYcrZSPFB6TAvu4+1Wx0yIb/Q9d8GO6mRrsQ8pmLbPNw4x75/aNZYOaxBWd1J0jksgL eA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2xkseuwvwh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:17:26 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00O0E6XV111048; Fri, 24 Jan 2020 00:17:26 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2xqmwb1fwk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jan 2020 00:17:25 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 00O0HPYH007959; Fri, 24 Jan 2020 00:17:25 GMT Received: from localhost (/10.145.179.16) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 23 Jan 2020 16:17:25 -0800 Subject: [PATCH 8/8] xfs_repair: fix totally broken unit conversion in directory invalidation From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 23 Jan 2020 16:17:23 -0800 Message-ID: <157982504329.2765410.10475555316974599797.stgit@magnolia> In-Reply-To: <157982499185.2765410.18206322669640988643.stgit@magnolia> References: <157982499185.2765410.18206322669640988643.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=995 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001240000 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9509 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001240000 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Your humble author forgot that xfs_dablk_t has the same units as xfs_fileoff_t, and totally screwed up the directory buffer invalidation loop in dir_binval. Not only is there an off-by-one error in the loop conditional, but the unit conversions are wrong. Fix all this stupidity by adding a for loop macro to take care of these details for us so that everyone can iterate all logical directory blocks (xfs_dir2_db_t) that start within a given bmbt record. The pre-5.5 xfs_da_get_buf implementation mostly hides the off-by-one error because dir_binval turns on "don't complain if no mapping" mode, but on dirblocksize > fsblocksize filesystems the incorrect units can cause us to miss invalidating some blocks, which can lead to other buffer cache errors later. Fixes: f9c559f4e4fb4 ("xfs_repair: invalidate dirty dir buffers when we zap a directory") Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- repair/phase6.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/repair/phase6.c b/repair/phase6.c index 76709f73..0874b649 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -1273,7 +1273,7 @@ dir_binval( struct xfs_ifork *ifp; struct xfs_da_geometry *geo; struct xfs_buf *bp; - xfs_dablk_t dabno, end_dabno; + xfs_dablk_t dabno; int error = 0; if (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS && @@ -1283,11 +1283,9 @@ dir_binval( geo = tp->t_mountp->m_dir_geo; ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK); for_each_xfs_iext(ifp, &icur, &rec) { - dabno = xfs_dir2_db_to_da(geo, rec.br_startoff + - geo->fsbcount - 1); - end_dabno = xfs_dir2_db_to_da(geo, rec.br_startoff + - rec.br_blockcount); - for (; dabno <= end_dabno; dabno += geo->fsbcount) { + for (dabno = roundup(rec.br_startoff, geo->fsbcount); + dabno < rec.br_startoff + rec.br_blockcount; + dabno += geo->fsbcount) { bp = NULL; error = -libxfs_da_get_buf(tp, ip, dabno, &bp, whichfork); From patchwork Tue Jan 28 15:56:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11354663 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A15813A4 for ; Tue, 28 Jan 2020 15:58:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 281CF24681 for ; Tue, 28 Jan 2020 15:58:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="cUEZK4XW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726561AbgA1P6y (ORCPT ); Tue, 28 Jan 2020 10:58:54 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49246 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725959AbgA1P6y (ORCPT ); Tue, 28 Jan 2020 10:58:54 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00SFrUZl191012; Tue, 28 Jan 2020 15:58:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=kgbbU7HvCQ+tvQrxBqKvQFDKm9fXl+i7pBdyH/568T8=; b=cUEZK4XW82Frq1ePkCunB5PY5l9f03NHZhRHazQxC1rvSR/69bTxiyErJ0T5YmpJx5I8 46CeKNLqhY2X0XVoxsHJWMWX5RfotG5Jdd0F9VFXRlvDBkslfXhjNK0F5AxZVU80KN97 e9AT1yd5tbsyn+h7qmgvKgH4roFTtEZ9BVFxGaN6W8eop6Se9GPZy5+YAHRTifGkV7tY HUQxEdps4S79rDi8v9rv9nuM2PMoHz/OQFT9R+PUU4I9Mm0qmN+cMSd+Q9K/92B0Blry rJDzxboTnFj2rY5U+xcUjdsOVlf6/nF9V6RCRQKmtD6O+ALeXHFFuME0aN12z2SMWATt /Q== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2xrear747g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jan 2020 15:58:51 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00SFsfa2008128; Tue, 28 Jan 2020 15:56:50 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2xtmr2q2t0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jan 2020 15:56:50 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 00SFuntm007157; Tue, 28 Jan 2020 15:56:49 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 28 Jan 2020 07:56:49 -0800 Date: Tue, 28 Jan 2020 07:56:48 -0800 From: "Darrick J. Wong" To: sandeen@sandeen.net Cc: linux-xfs@vger.kernel.org Subject: [PATCH 9/8] xfs_io: fix integer over/underflow handling in timespec_from_string Message-ID: <20200128155648.GN3447196@magnolia> References: <157982499185.2765410.18206322669640988643.stgit@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <157982499185.2765410.18206322669640988643.stgit@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9514 signatures=668685 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-1911140001 definitions=main-2001280124 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9514 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001280124 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong When we're filling out the struct timespec, make sure we detect when the string value cannot be represented by a (potentially 32-bit) seconds field in struct timespec. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxcmd/input.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/libxcmd/input.c b/libxcmd/input.c index d232d4f3..137856e3 100644 --- a/libxcmd/input.c +++ b/libxcmd/input.c @@ -183,19 +183,30 @@ timestr( int timespec_from_string( - const char * secs, - const char * nsecs, - struct timespec * ts) + const char *secs, + const char *nsecs, + struct timespec *ts) { - char* p; + char *p; + unsigned long long int ll; + if (!secs || !nsecs || !ts) return 1; - ts->tv_sec = strtoull(secs, &p, 0); + + ll = strtoull(secs, &p, 0); if (*p) return 1; - ts->tv_nsec = strtoull(nsecs, &p, 0); + ts->tv_sec = ll; + if ((unsigned long long int)ts->tv_sec != ll) + return 1; + + ll = strtoull(nsecs, &p, 0); if (*p) return 1; + ts->tv_nsec = ll; + if ((unsigned long long int)ts->tv_nsec != ll) + return 1; + return 0; } From patchwork Thu Jan 30 18:13:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11358533 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C58BC924 for ; Thu, 30 Jan 2020 18:15:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A0F9620CC7 for ; Thu, 30 Jan 2020 18:15:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="VFAa7Iia" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728584AbgA3SPB (ORCPT ); Thu, 30 Jan 2020 13:15:01 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:54506 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727089AbgA3SPB (ORCPT ); Thu, 30 Jan 2020 13:15:01 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00UIDoiV126000; Thu, 30 Jan 2020 18:14:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=ae5dFRCzp00v23Dfkj30VaCoRhZLGY92LypEbvdj6xo=; b=VFAa7IiaXRtpV7+AbJt2sJEqqL5w+6ESs0S0EyKt8VOknR2Rwk4OXECEODc0vUsfShBN f40jUgf8YCo3K3xXJdmoEmKlde5N043HUV84z6g2R16xjgPwe+veV3yc4E6tKcZE1KoK Y5x3GhT1nqWpndVwvReWH66nMVLWjfJ+O7pKxJMP5TOlDF+lp0J7wqesE5fJmgZBPPpl RU0AjkXylKNmUmhFumlPGfqazoom3ZHzYEBl5PLrySJxvRICFoQKOyg9GayrZYjKHiI3 LUTPfqH9VXg0xqTSQXYXTaRp15pribgu0ay0VnIzmoeoZNpRI1xKhIdRGEA+7+rnK3Ut qw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2xrd3unvn7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2020 18:14:57 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00UIEWPe105850; Thu, 30 Jan 2020 18:14:56 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2xuc30k88m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2020 18:14:55 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 00UIDVed010922; Thu, 30 Jan 2020 18:13:32 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 30 Jan 2020 10:13:31 -0800 Date: Thu, 30 Jan 2020 10:13:30 -0800 From: "Darrick J. Wong" To: sandeen@sandeen.net Cc: linux-xfs@vger.kernel.org Subject: [PATCH 10/8] libxfs: remove duplicate attr function declarations Message-ID: <20200130181330.GY3447196@magnolia> References: <157982499185.2765410.18206322669640988643.stgit@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <157982499185.2765410.18206322669640988643.stgit@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9516 signatures=668685 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-1911140001 definitions=main-2001300127 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9516 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001300127 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Remove these function declarations since they're in libxfs/xfs_attr.h and are therefore redundant. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxfs/libxfs_priv.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index 03edf0d3..fe08f96b 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -607,14 +607,6 @@ static inline int test_and_set_bit(int nr, volatile unsigned long *addr) } /* Keep static checkers quiet about nonstatic functions by exporting */ -int xfs_inode_hasattr(struct xfs_inode *ip); -int xfs_attr_get_ilocked(struct xfs_inode *ip, struct xfs_da_args *args); -int xfs_attr_get(struct xfs_inode *ip, const unsigned char *name, - unsigned char **value, int *valuelenp, int flags); -int xfs_attr_set(struct xfs_inode *dp, const unsigned char *name, - unsigned char *value, int valuelen, int flags); -int xfs_attr_remove(struct xfs_inode *dp, const unsigned char *name, int flags); - int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp, xfs_rtblock_t block, int issum, struct xfs_buf **bpp); int xfs_rtcheck_range(struct xfs_mount *mp, struct xfs_trans *tp, From patchwork Thu Jan 30 18:15:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11358535 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13004112B for ; Thu, 30 Jan 2020 18:15:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3F3E214AF for ; Thu, 30 Jan 2020 18:15:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="VDEx2ZNc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728607AbgA3SPS (ORCPT ); Thu, 30 Jan 2020 13:15:18 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:36856 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728610AbgA3SPS (ORCPT ); Thu, 30 Jan 2020 13:15:18 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00UIDT3I102841; Thu, 30 Jan 2020 18:15:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=62dWQq+nGO+TmwnM1T27wnlI+zmx6AjE096PwrckVZA=; b=VDEx2ZNc+6ah8pbXVI1IvzLNEbL+PYwLcfjh6+qspmRrP2yM61NlGoMvIf0WUsgdWxy/ RJsJxoFF0LKxoqj9N7i+3o1OFP72XDX2pEgeT0q86pIWBSTJxlONqhgNwzP/St+98Ynp Uedt693DT1tXfruPWuTC8VFX9Qef/Lzh3jAGR1+Zw3WvLvHIdOWS8xiDJJAGmqxYtc+P UpBEqADl509OG/JusgOUU0o/Ce4Xo2mBWJlgg3V0ZhFcspI4N2rCYDX5h3z3Xb/5UzRS /NFEh7e+aJX7XVUPq2wyQSuRw5xopfGnWwtCxt6zwZorhxEux2vFLKNFJ4ZRorh+nnFb Lg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2xrearnre9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2020 18:15:15 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00UIEPuU024435; Thu, 30 Jan 2020 18:15:15 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 2xuemwwgfw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2020 18:15:15 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00UIFDJ3024182; Thu, 30 Jan 2020 18:15:14 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 30 Jan 2020 10:15:12 -0800 Date: Thu, 30 Jan 2020 10:15:12 -0800 From: "Darrick J. Wong" To: sandeen@sandeen.net Cc: linux-xfs@vger.kernel.org Subject: [PATCH 11/8] xfs_repair: don't corrupt a attr fork da3 node when clearing forw/back Message-ID: <20200130181512.GZ3447196@magnolia> References: <157982499185.2765410.18206322669640988643.stgit@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <157982499185.2765410.18206322669640988643.stgit@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9516 signatures=668685 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-1911140001 definitions=main-2001300127 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9516 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001300127 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong In process_longform_attr, we enforce that the root block of the attribute index must have both forw or back pointers set to zero. Unfortunately, the code that nulls out the pointers is not aware that the root block could be in da3 node format. This leads to corruption of da3 root node blocks because the functions that convert attr3 leaf headers to and from the ondisk structures perform some interpretation of firstused on what they think is an attr1 leaf block. Found by using xfs/402 to fuzz hdr.info.hdr.forw. Signed-off-by: Darrick J. Wong --- repair/attr_repair.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/repair/attr_repair.c b/repair/attr_repair.c index 9a44f610..9d2a40f7 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -952,6 +952,33 @@ _("wrong FS UUID, inode %" PRIu64 " attr block %" PRIu64 "\n"), return 0; } +/* + * Zap the forw/back links in an attribute block. Be careful, because the + * root block could be an attr leaf block or a da node block. + */ +static inline void +clear_attr_forw_back( + struct xfs_buf *bp, + struct xfs_attr3_icleaf_hdr *leafhdr) +{ + struct xfs_mount *mp = bp->b_mount; + + if (leafhdr->magic == XFS_DA_NODE_MAGIC || + leafhdr->magic == XFS_DA3_NODE_MAGIC) { + struct xfs_da3_icnode_hdr da3_hdr; + + xfs_da3_node_hdr_from_disk(mp, &da3_hdr, bp->b_addr); + da3_hdr.forw = 0; + da3_hdr.back = 0; + xfs_da3_node_hdr_to_disk(mp, bp->b_addr, &da3_hdr); + return; + } + + leafhdr->forw = 0; + leafhdr->back = 0; + xfs_attr3_leaf_hdr_to_disk(mp->m_attr_geo, bp->b_addr, leafhdr); +} + /* * Start processing for a leaf or fuller btree. * A leaf directory is one where the attribute fork is too big for @@ -1028,10 +1055,7 @@ process_longform_attr( _("clearing forw/back pointers in block 0 for attributes in inode %" PRIu64 "\n"), ino); repairlinks = 1; - leafhdr.forw = 0; - leafhdr.back = 0; - xfs_attr3_leaf_hdr_to_disk(mp->m_attr_geo, - leaf, &leafhdr); + clear_attr_forw_back(bp, &leafhdr); } else { do_warn( _("would clear forw/back pointers in block 0 for attributes in inode %" PRIu64 "\n"), ino);