From patchwork Mon Apr 22 15:44:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10911203 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 6143D161F for ; Mon, 22 Apr 2019 15:45:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 502A2280CF for ; Mon, 22 Apr 2019 15:45:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 418A1283CF; Mon, 22 Apr 2019 15:45:02 +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 29780280CF for ; Mon, 22 Apr 2019 15:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727021AbfDVPpA (ORCPT ); Mon, 22 Apr 2019 11:45:00 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:38116 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVPpA (ORCPT ); Mon, 22 Apr 2019 11:45:00 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3MFi0CP049144; Mon, 22 Apr 2019 15:44:57 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-2018-07-02; bh=C1dsFFuwTRLOsXn2RrWMQdoy2rVy3KfBzx+ltmTovOk=; b=C/rQzAE4lyw7AieO89Ij8HzlQI+ucl3Hyj+XQbeDn5SL5j5CW5/k2WROQ1T4IeM607I5 Lclo2pYo+1xGqxuSGboEPhoVJ6usmFqwuYuQ5j89j1FAz91BKYmn4iwUPUtT/2JehcvJ bdVG4c0SyXdEfouNs5BHvwf+AayunHxbMSWUXoT875kpCUxRjCDVJpKy1+jbWPGZQ6Gv vrtoZ/FZVL6ZTpGQ9dn36yodCxUWNHCBxUus65ClXA1WErvV/5MrBrL0JxAYS1bOxNGs 3UeXakzCYO3d9LLnPL96Oi7C2q82QWCFtMkBg8TP+H/RF6l189r3LsUaRcH2X6oPxxa/ rg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 2ryrxcq5q3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:44:57 +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 x3MFhE4X186559; Mon, 22 Apr 2019 15:44:56 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2ryrhrjsnw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:44:56 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3MFitJv013608; Mon, 22 Apr 2019 15:44:55 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2019 08:44:55 -0700 Subject: [PATCH 01/10] scrub: fix Makefile targets which depend on builddefs From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 22 Apr 2019 08:44:56 -0700 Message-ID: <155594789626.115924.12751110694998923783.stgit@magnolia> In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=9 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-1810050000 definitions=main-1904220118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=9 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-1810050000 definitions=main-1904220119 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 From: Darrick J. Wong Add Makefile dependencies for targets that require variables set in builddefs. Although most of the required variables are file paths defined during the ./configure process, we cannot simply use AC_CONFIG_FILES to generate the scripts because that macro only expands one level deep and its documentation says that it's only to be used for generating makefiles, not build targets themselves. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Reviewed-by: Bill O'Donnell --- scrub/Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scrub/Makefile b/scrub/Makefile index f4710d3e..882da8fd 100644 --- a/scrub/Makefile +++ b/scrub/Makefile @@ -3,7 +3,8 @@ # TOPDIR = .. -include $(TOPDIR)/include/builddefs +builddefs=$(TOPDIR)/include/builddefs +include $(builddefs) # On linux we get fsmap from the system or define it ourselves # so include this based on platform type. If this reverts to only @@ -101,27 +102,27 @@ LDIRT = $(XFS_SCRUB_ALL_PROG) *.service *.cron default: depend $(LTCOMMAND) $(XFS_SCRUB_ALL_PROG) $(OPTIONAL_TARGETS) -xfs_scrub_all: xfs_scrub_all.in +xfs_scrub_all: xfs_scrub_all.in $(builddefs) @echo " [SED] $@" $(Q)$(SED) -e "s|@sbindir@|$(PKG_SBIN_DIR)|g" \ -e "s|@pkg_version@|$(PKG_VERSION)|g" \ -e "s|@scrub_args@|$(XFS_SCRUB_ARGS)|g" < $< > $@ $(Q)chmod a+x $@ -phase5.o unicrash.o xfs.o: $(TOPDIR)/include/builddefs +phase5.o unicrash.o xfs.o: $(builddefs) include $(BUILDRULES) install: $(INSTALL_SCRUB) -%.service: %.service.in +%.service: %.service.in $(builddefs) @echo " [SED] $@" $(Q)$(SED) -e "s|@sbindir@|$(PKG_SBIN_DIR)|g" \ -e "s|@scrub_args@|$(XFS_SCRUB_ARGS)|g" \ -e "s|@pkg_lib_dir@|$(PKG_LIB_DIR)|g" \ -e "s|@pkg_name@|$(PKG_NAME)|g" < $< > $@ -%.cron: %.cron.in +%.cron: %.cron.in $(builddefs) @echo " [SED] $@" $(Q)$(SED) -e "s|@sbindir@|$(PKG_SBIN_DIR)|g" < $< > $@ From patchwork Mon Apr 22 15:45:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10911205 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 59EFE14DB for ; Mon, 22 Apr 2019 15:45:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47104280CF for ; Mon, 22 Apr 2019 15:45:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B58C283CF; Mon, 22 Apr 2019 15:45:06 +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 D04DF280CF for ; Mon, 22 Apr 2019 15:45:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727309AbfDVPpF (ORCPT ); Mon, 22 Apr 2019 11:45:05 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:43820 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVPpF (ORCPT ); Mon, 22 Apr 2019 11:45:05 -0400 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 x3MFi2jc042696; Mon, 22 Apr 2019 15:45: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-2018-07-02; bh=iGTJ517+wtiIvbARchgrY79V/Wv8aSvg3NuSoII9z+0=; b=ogppEaN6skipRXVQv42XFj/OhHY1pucN3dNeILszX/NqfqH4+ibXw/iNR2Lzy/QeeNP2 8iKhCnfHcAh4IlZbssvGuWmPKdsiwzkHTRi+eeK8yPIeTeKb84co1AFzHGFXL88UNVnI 8bEo4kSpfK4icfAng4fC+rtrAKewir03x+IWgUvN/ljix4DvLHgFTALehYDPKjjCGmRG jYhYorNZW+IFwQtLGUjRgWC7IdscV80kr4NykfrqQdRs4yAEi2IJ8igF6WlKt8T6cVDR KDMpK9xW2v14kim56AcYoPd7hcjL3somY6A3PPIrmYHcf2GslTP5jd2MAGvg7fuJ+VM1 wQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2rytusq07u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:02 +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 x3MFijka157748; Mon, 22 Apr 2019 15:45:02 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2s0dwds0p4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:02 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x3MFj1tO030094; Mon, 22 Apr 2019 15:45:01 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2019 08:45:01 -0700 Subject: [PATCH 02/10] xfs_info: use findmnt to handle mounted block devices From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 22 Apr 2019 08:45:02 -0700 Message-ID: <155594790268.115924.87682432738525436.stgit@magnolia> In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220119 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 From: Darrick J. Wong Use findmnt to determine if the passed-in argument is associated with a mount point, and if so, use spaceman to query the mounted filesystem. If the user passed in a file, try to find out if it's a loop mounted live filesystem and if so query the live filesystem. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Reviewed-by: Bill O'Donnell --- debian/control | 2 +- spaceman/xfs_info.sh | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/debian/control b/debian/control index f4f807b0..0b3205f5 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 4.0.0 Homepage: https://xfs.wiki.kernel.org/ Package: xfsprogs -Depends: ${shlibs:Depends}, ${misc:Depends}, python3:any +Depends: ${shlibs:Depends}, ${misc:Depends}, python3:any, util-linux Provides: fsck-backend Suggests: xfsdump, acl, attr, quota Breaks: xfsdump (<< 3.0.0) diff --git a/spaceman/xfs_info.sh b/spaceman/xfs_info.sh index ecf17f61..1bf6d2c3 100755 --- a/spaceman/xfs_info.sh +++ b/spaceman/xfs_info.sh @@ -7,6 +7,14 @@ OPTS="" USAGE="Usage: xfs_info [-V] [-t mtab] [mountpoint|device|file]" +# Try to find a loop device associated with a file. We only want to return +# one loopdev (multiple loop devices can attach to a single file) so we grab +# the last line and return it if it's actually a block device. +try_find_loop_dev_for_file() { + local x="$(losetup -O NAME -j "$1" 2> /dev/null | tail -n 1)" + test -b "$x" && echo "$x" +} + while getopts "t:V" c do case $c in @@ -24,11 +32,19 @@ set -- extra "$@" shift $OPTIND case $# in 1) - if [ -b "$1" ] || [ -f "$1" ]; then - xfs_db -p xfs_info -c "info" $OPTS "$1" + arg="$1" + + # See if we can map the arg to a loop device + loopdev="$(try_find_loop_dev_for_file "${arg}")" + test -n "${loopdev}" && arg="${loopdev}" + + # If we find a mountpoint for the device, do a live query; + # otherwise try reading the fs with xfs_db. + if mountpt="$(findmnt -f -n -o TARGET "${arg}" 2> /dev/null)"; then + xfs_spaceman -p xfs_info -c "info" $OPTS "${mountpt}" status=$? else - xfs_spaceman -p xfs_info -c "info" $OPTS "$1" + xfs_db -p xfs_info -c "info" $OPTS "${arg}" status=$? fi ;; From patchwork Mon Apr 22 15:45:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10911207 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 8EE8614DB for ; Mon, 22 Apr 2019 15:45:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BFCE28306 for ; Mon, 22 Apr 2019 15:45:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6ACB528573; Mon, 22 Apr 2019 15:45:13 +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 DED2628306 for ; Mon, 22 Apr 2019 15:45:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727394AbfDVPpM (ORCPT ); Mon, 22 Apr 2019 11:45:12 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:42392 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVPpM (ORCPT ); Mon, 22 Apr 2019 11:45:12 -0400 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 x3MFhvvm058425; Mon, 22 Apr 2019 15:45:10 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-2018-07-02; bh=SpoO6AT32xwovdvNyCdgHgpf05ozpoq3YCmN/FzZ8Ws=; b=34ibvDPHwdoePmsv/MGG+NP/oMEwGCZ1lLNZZ9bsmtX15AKoSz2UL68Gpc2mZb3MBfa8 5Y/8KGqViSx0ZmVxUoNVZpQbwMWm0r/PXSid6IxDGvddNSqmqUC+6gur7EprCWrsdKiD TQFFr+ZuMqxEqyoTZSYTWEfA3RyjFx67T2JEVOk0HicUh+cTRNqYNxEwhyKVRVC/5erU NFeR5K2Jc1KcOUvkLKVUfWragbnzAj6C2KWsrOSrsM+gs/v8RvMHyCTlA59Kw3hPaoWo Jsakus5JLhfDepJTvvp22Lgd0vlU9HgvCfef2B7DYTleg/Mnwyy3bwCV4LUjojHNdS0/ LA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2ryv2pxv9m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:09 +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 x3MFiVh5186011; Mon, 22 Apr 2019 15:45:09 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2s0f0v0kgw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:09 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3MFj7Vk013787; Mon, 22 Apr 2019 15:45:08 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2019 08:45:07 -0700 Subject: [PATCH 03/10] xfs_repair: correctly account for free space btree shrinks when fixing freelist From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 22 Apr 2019 08:45:09 -0700 Message-ID: <155594790894.115924.5483344448490636960.stgit@magnolia> In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220119 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 From: Darrick J. Wong When we fix the freelist at the end of build_agf_agfl in phase 5 of repair, we need to create incore rmap records for the blocks that get added to the AGFL. We can't let the regular freelist fixing code use the regular on-disk rmapbt update code because the rmapbt isn't fully set up yet. Unfortunately, the original code fails to account for the fact that the free space btrees can shrink when we allocate blocks to fix the freelist; those blocks are also put on the freelist, but there are already incore rmaps for all the free space btree blocks. We must not create (redundant) incore rmaps for those blocks. If we do, repair fails with a complaint that rebuilding the rmapbt failed during phase 5. xfs/137 on a 1k block size occasionally triggers this bug. To fix the problem, construct a bitmap of all OWN_AG blocks that we know about before traversing the AGFL, and only create new incore rmaps for those AGFL blocks that are not already tracked in the bitmap. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Reviewed-by: Bill O'Donnell --- repair/rmap.c | 54 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/repair/rmap.c b/repair/rmap.c index d0156f9d..19cceca3 100644 --- a/repair/rmap.c +++ b/repair/rmap.c @@ -12,6 +12,7 @@ #include "dinode.h" #include "slab.h" #include "rmap.h" +#include "bitmap.h" #undef RMAP_DEBUG @@ -450,15 +451,16 @@ rmap_store_ag_btree_rec( struct xfs_buf *agflbp = NULL; struct xfs_trans *tp; __be32 *agfl_bno, *b; + struct xfs_ag_rmap *ag_rmap = &ag_rmaps[agno]; + struct bitmap *own_ag_bitmap = NULL; int error = 0; if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) return 0; /* Release the ar_rmaps; they were put into the rmapbt during p5. */ - free_slab(&ag_rmaps[agno].ar_rmaps); - error = init_slab(&ag_rmaps[agno].ar_rmaps, - sizeof(struct xfs_rmap_irec)); + free_slab(&ag_rmap->ar_rmaps); + error = init_slab(&ag_rmap->ar_rmaps, sizeof(struct xfs_rmap_irec)); if (error) goto err; @@ -478,19 +480,50 @@ rmap_store_ag_btree_rec( * rmap, we only need to add rmap records for AGFL blocks past * that point in the AGFL because those blocks are a result of a * no-rmap no-shrink freelist fixup that we did earlier. + * + * However, some blocks end up on the AGFL because the free space + * btrees shed blocks as a result of allocating space to fix the + * freelist. We already created in-core rmap records for the free + * space btree blocks, so we must be careful not to create those + * records again. Create a bitmap of already-recorded OWN_AG rmaps. */ + error = init_slab_cursor(ag_rmap->ar_raw_rmaps, rmap_compare, &rm_cur); + if (error) + goto err; + if (!bitmap_init(&own_ag_bitmap)) { + error = -ENOMEM; + goto err_slab; + } + while ((rm_rec = pop_slab_cursor(rm_cur)) != NULL) { + if (rm_rec->rm_owner != XFS_RMAP_OWN_AG) + continue; + if (!bitmap_set(own_ag_bitmap, rm_rec->rm_startblock, + rm_rec->rm_blockcount)) { + error = EFSCORRUPTED; + goto err_slab; + } + } + free_slab_cursor(&rm_cur); + + /* Create rmaps for any AGFL blocks that aren't already rmapped. */ agfl_bno = XFS_BUF_TO_AGFL_BNO(mp, agflbp); - b = agfl_bno + ag_rmaps[agno].ar_flcount; + b = agfl_bno + ag_rmap->ar_flcount; while (*b != cpu_to_be32(NULLAGBLOCK) && b - agfl_bno < libxfs_agfl_size(mp)) { - error = rmap_add_ag_rec(mp, agno, be32_to_cpu(*b), 1, - XFS_RMAP_OWN_AG); - if (error) - goto err; + xfs_agblock_t agbno; + + agbno = be32_to_cpu(*b); + if (!bitmap_test(own_ag_bitmap, agbno, 1)) { + error = rmap_add_ag_rec(mp, agno, agbno, 1, + XFS_RMAP_OWN_AG); + if (error) + goto err; + } b++; } libxfs_putbuf(agflbp); agflbp = NULL; + bitmap_free(&own_ag_bitmap); /* Merge all the raw rmaps into the main list */ error = rmap_fold_raw_recs(mp, agno); @@ -498,8 +531,7 @@ rmap_store_ag_btree_rec( goto err; /* Create cursors to refcount structures */ - error = init_slab_cursor(ag_rmaps[agno].ar_rmaps, rmap_compare, - &rm_cur); + error = init_slab_cursor(ag_rmap->ar_rmaps, rmap_compare, &rm_cur); if (error) goto err; @@ -542,6 +574,8 @@ rmap_store_ag_btree_rec( err: if (agflbp) libxfs_putbuf(agflbp); + if (own_ag_bitmap) + bitmap_free(&own_ag_bitmap); return error; } From patchwork Mon Apr 22 15:45:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10911209 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 12B7314DB for ; Mon, 22 Apr 2019 15:45:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01C1D286F2 for ; Mon, 22 Apr 2019 15:45:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E972F286FF; Mon, 22 Apr 2019 15:45:26 +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 2B423286F2 for ; Mon, 22 Apr 2019 15:45:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727387AbfDVPpW (ORCPT ); Mon, 22 Apr 2019 11:45:22 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:42550 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVPpU (ORCPT ); Mon, 22 Apr 2019 11:45:20 -0400 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 x3MFiGQx058625; Mon, 22 Apr 2019 15:45:17 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-2018-07-02; bh=VjQcNkpsXC7+AYr0IWeBe8xKKIePxMZEH2B4gv1Z1Y4=; b=YUz7mSGefItx05u38fbpvyQ3cKIDEFGmpadKE1Pe4aLblcL8aRkOoko5weGXyBdTN37M JAPkMaVtj0yvEU2uld0xkyfC18vJMJjkJmNPvN3+blkNSl6Ss2IpspZ1hGuo9mn9ilZG FK0I7kvtObrqqoJTZsdCWy26aDoRYgO66F9q2Ed1AIce89I5km8lwvFD9jg6MnzPKgQi 67CnnQghAQDn9LWkv/cMIjooZui9tagdVp5WqguHI8nlwLs4+I6+2mUQaWx5cceyTzUC f9Y8jhW4Ppp6GkNCmXAM/XoAZgd50Kz/rXA+n8mfSKAynVYS2NDmf/F7QLjDkCuP3QeG yg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2ryv2pxvan-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:17 +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 x3MFiM33017371; Mon, 22 Apr 2019 15:45:16 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2s0fv2g734-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:16 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x3MFjE2R025758; Mon, 22 Apr 2019 15:45:14 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2019 08:45:14 -0700 Subject: [PATCH 04/10] libxfs: retain ifork_ops when flushing inode From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, Arkadiusz Miskiewicz Date: Mon, 22 Apr 2019 08:45:15 -0700 Message-ID: <155594791533.115924.7540619376750686973.stgit@magnolia> In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220119 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 From: Darrick J. Wong Retain the ifork ops used to validate the inode so that we can use the same one to iflush it. xfs_repair phase 6 can use multiple transactions to fix various inode problems, which means that the inode might not be fully fixed when each transaction commits. This can be a particular problem if there's a shortform directory with both invalid directory entries and incorrect i8count. Phase 3 will set the parent inode to "0" to signal to phase 6 that it needs to reset the parent and i8count, but phase 6 starts a transaction to junk the bad entries which fail to commit because the parent is invalid: fixing i8count in inode 69022994673 Invalid inode number 0x0 xfs_dir_ino_validate: XFS_ERROR_REPORT Metadata corruption detected at 0x464eb0, inode 0x10121750f1 data fork xfs_repair: warning - iflush_int failed (-117) And thus the inode fixes never get written out. Reported-by: Arkadiusz Miskiewicz Signed-off-by: Darrick J. Wong Reviewed-by: Bill O'Donnell Reviewed-by: Eric Sandeen --- include/xfs_inode.h | 1 + libxfs/rdwr.c | 1 + libxfs/util.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/xfs_inode.h b/include/xfs_inode.h index 79ec3a2d..e1e8b430 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -51,6 +51,7 @@ typedef struct xfs_inode { xfs_fsize_t i_size; /* in-memory size */ const struct xfs_dir_ops *d_ops; /* directory ops vector */ + struct xfs_ifork_ops *i_fork_ops; /* fork verifiers */ struct inode i_vnode; } xfs_inode_t; diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index a00360e7..69d5abb2 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -1391,6 +1391,7 @@ libxfs_iget( return error; } + ip->i_fork_ops = ifork_ops; if (!libxfs_inode_verify_forks(ip, ifork_ops)) { libxfs_irele(ip); return -EFSCORRUPTED; diff --git a/libxfs/util.c b/libxfs/util.c index 4ac151e6..2e3b9d51 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -422,7 +422,7 @@ libxfs_iflush_int(xfs_inode_t *ip, xfs_buf_t *bp) VFS_I(ip)->i_version++; /* Check the inline fork data before we write out. */ - if (!libxfs_inode_verify_forks(ip, &xfs_default_ifork_ops)) + if (!libxfs_inode_verify_forks(ip, ip->i_fork_ops)) return -EFSCORRUPTED; /* From patchwork Mon Apr 22 15:45:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10911223 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 2D7EB14DB for ; Mon, 22 Apr 2019 15:47:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E439286F2 for ; Mon, 22 Apr 2019 15:47:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12D2F286FF; Mon, 22 Apr 2019 15:47:25 +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 AAC61286F2 for ; Mon, 22 Apr 2019 15:47:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727457AbfDVPrY (ORCPT ); Mon, 22 Apr 2019 11:47:24 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:46280 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVPrY (ORCPT ); Mon, 22 Apr 2019 11:47:24 -0400 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 x3MFi1M7042620; Mon, 22 Apr 2019 15:47:22 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-2018-07-02; bh=pI8hZMlzqExEv543kg4NcQw9otKgQfdeQxndV21rSxo=; b=km+js8k1k0BxfuKEp5setH65JzIvDXb4adQu26Uf5GAPMh3gyPXwIgtSHfd+fd6DVcGy X5/LqN1jpAqm+GSVoxbNk12QWZtwU5NnOFQaQsc5ZLa4LjBcKzZxKFCBWdZSaokh8YFX /weMPvYPxv2E30JglZ6C2+UT45vz2l6kESNiorp2F2arWpdOTvXLpAgDb+4KsUd5FYeF /zFc3Ijc6df1v12HbfjLB7lY/XSPuaOvUhBMaZtAY0JKPA3LAQaa8TyAFEniCpWc498g HfXQc6nC5myseF7MX45l6QdLfU/3xtxkvw2f7OWS5xZWP+nkAWYuomj4KYtDMzxRji4E eA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2rytusq0m5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:47:21 +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 x3MFiWKB186084; Mon, 22 Apr 2019 15:45:21 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2s0f0v0kn0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:21 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x3MFjKgZ025783; Mon, 22 Apr 2019 15:45:20 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2019 08:45:20 -0700 Subject: [PATCH 05/10] libxfs: drop the ifork_ops parameter from _inode_verify_forks From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 22 Apr 2019 08:45:21 -0700 Message-ID: <155594792189.115924.17675145707430115266.stgit@magnolia> In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220119 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 From: Darrick J. Wong Now that the inode remembers its own ifork_ops, we can drop the second parameter from libxfs_inode_verify_forks. Signed-off-by: Darrick J. Wong Reviewed-by: Bill O'Donnell Reviewed-by: Eric Sandeen --- include/xfs_inode.h | 3 +-- libxfs/rdwr.c | 11 +++++------ libxfs/util.c | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/xfs_inode.h b/include/xfs_inode.h index e1e8b430..52d79f3c 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -151,8 +151,7 @@ extern void libxfs_trans_ichgtime(struct xfs_trans *, extern int libxfs_iflush_int (struct xfs_inode *, struct xfs_buf *); /* Inode Cache Interfaces */ -extern bool libxfs_inode_verify_forks(struct xfs_inode *ip, - struct xfs_ifork_ops *); +extern bool libxfs_inode_verify_forks(struct xfs_inode *ip); extern int libxfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, uint, struct xfs_inode **, struct xfs_ifork_ops *); diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 69d5abb2..bc2ed38c 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -1338,16 +1338,15 @@ extern kmem_zone_t *xfs_ili_zone; */ bool libxfs_inode_verify_forks( - struct xfs_inode *ip, - struct xfs_ifork_ops *ops) + struct xfs_inode *ip) { struct xfs_ifork *ifp; xfs_failaddr_t fa; - if (!ops) + if (!ip->i_fork_ops) return true; - fa = xfs_ifork_verify_data(ip, ops); + fa = xfs_ifork_verify_data(ip, ip->i_fork_ops); if (fa) { ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK); xfs_inode_verifier_error(ip, -EFSCORRUPTED, "data fork", @@ -1355,7 +1354,7 @@ libxfs_inode_verify_forks( return false; } - fa = xfs_ifork_verify_attr(ip, ops); + fa = xfs_ifork_verify_attr(ip, ip->i_fork_ops); if (fa) { ifp = XFS_IFORK_PTR(ip, XFS_ATTR_FORK); xfs_inode_verifier_error(ip, -EFSCORRUPTED, "attr fork", @@ -1392,7 +1391,7 @@ libxfs_iget( } ip->i_fork_ops = ifork_ops; - if (!libxfs_inode_verify_forks(ip, ifork_ops)) { + if (!libxfs_inode_verify_forks(ip)) { libxfs_irele(ip); return -EFSCORRUPTED; } diff --git a/libxfs/util.c b/libxfs/util.c index 2e3b9d51..ea75fa20 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -422,7 +422,7 @@ libxfs_iflush_int(xfs_inode_t *ip, xfs_buf_t *bp) VFS_I(ip)->i_version++; /* Check the inline fork data before we write out. */ - if (!libxfs_inode_verify_forks(ip, ip->i_fork_ops)) + if (!libxfs_inode_verify_forks(ip)) return -EFSCORRUPTED; /* From patchwork Mon Apr 22 15:45:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10911213 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 6A6A3161F for ; Mon, 22 Apr 2019 15:45:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B043286FF for ; Mon, 22 Apr 2019 15:45:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FBA92870F; Mon, 22 Apr 2019 15:45:31 +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 E76B0286FF for ; Mon, 22 Apr 2019 15:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727518AbfDVPpa (ORCPT ); Mon, 22 Apr 2019 11:45:30 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:44258 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVPpa (ORCPT ); Mon, 22 Apr 2019 11:45:30 -0400 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 x3MFhvEm042577; Mon, 22 Apr 2019 15:45:28 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-2018-07-02; bh=QOq18HhG4Y6KVMpCLkOcJsaCZVZdRxt/tALMsBzDq1g=; b=ZmolB82knQ9i5bdij6VB8nVoP7Uw6jMFbIguTbE+beSTaFPPWaJIxMRlfyd8Kgk00DyP n8iQw+dNB2D+1KrqMH1E/feNh8ZwH0KW2WNUwlz68M961SVAIzaOFo58pYJPMXhVYdoY umNczlnNw1nOnjmn6Pib/5hltIPAsmIb54pB607i05uoQRnvuJ2z8yi9AH6USjwZUpDD diIcrJKIj3K5BxjhZIBUmlTCPEy1IgnBKNzolvzgU0aYgJYuY3assGn23t1WXDUdewyB 0N+hlPiteG6ZYDExr0WDdIimxPB5CqYUi7YyXvglM1whYU/WNDXxmxVELOWY3sbo0fnM ag== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2rytusq0a9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:28 +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 x3MFieeh157530; Mon, 22 Apr 2019 15:45:27 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2s0dwds0xn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:27 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3MFjQ2o017315; Mon, 22 Apr 2019 15:45:26 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2019 08:45:26 -0700 Subject: [PATCH 06/10] misc: fix strncpy length complaints From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 22 Apr 2019 08:45:28 -0700 Message-ID: <155594792809.115924.2016290538799986694.stgit@magnolia> In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220119 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 From: Darrick J. Wong Fix a number of complaints about feeding sizeof(dest) directly to strncpy. We do this by declaring the char arrays to be one larger than necessary and subtracting one, to ensure that we never overfill the buffer. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Reviewed-by: Bill O'Donnell --- mkfs/xfs_mkfs.c | 13 +++++++++++-- quota/edit.c | 9 ++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 3e2ef92d..db3ad38e 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -3270,8 +3270,17 @@ finish_superblock_setup( struct xfs_mount *mp, struct xfs_sb *sbp) { - if (cfg->label) - strncpy(sbp->sb_fname, cfg->label, sizeof(sbp->sb_fname)); + if (cfg->label) { + size_t label_len; + + /* + * Labels are null terminated unless the string fits exactly + * in the label field, so assume sb_fname is zeroed and then + * do a memcpy because the destination isn't a normal C string. + */ + label_len = min(sizeof(sbp->sb_fname), strlen(cfg->label)); + memcpy(sbp->sb_fname, cfg->label, label_len); + } sbp->sb_dblocks = cfg->dblocks; sbp->sb_rblocks = cfg->rtblocks; diff --git a/quota/edit.c b/quota/edit.c index b10a5b34..f9938b8a 100644 --- a/quota/edit.c +++ b/quota/edit.c @@ -368,8 +368,7 @@ restore_file( uint type) { char buffer[512]; - char devbuffer[512]; - char *dev = NULL; + char dev[512]; uint mask; int cnt; uint32_t id; @@ -377,7 +376,11 @@ restore_file( while (fgets(buffer, sizeof(buffer), fp) != NULL) { if (strncmp("fs = ", buffer, 5) == 0) { - dev = strncpy(devbuffer, buffer+5, sizeof(devbuffer)); + /* + * Copy the device name to dev, strip off the trailing + * newline, and move on to the next line. + */ + strncpy(dev, buffer + 5, sizeof(dev) - 1); dev[strlen(dev) - 1] = '\0'; continue; } From patchwork Mon Apr 22 15:45:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10911215 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 9716D161F for ; Mon, 22 Apr 2019 15:45:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88BAC286FF for ; Mon, 22 Apr 2019 15:45:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D4202870F; Mon, 22 Apr 2019 15:45:38 +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 2D77B286FF for ; Mon, 22 Apr 2019 15:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727362AbfDVPph (ORCPT ); Mon, 22 Apr 2019 11:45:37 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:38820 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVPph (ORCPT ); Mon, 22 Apr 2019 11:45:37 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3MFiWl3049444; Mon, 22 Apr 2019 15:45:35 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-2018-07-02; bh=fmdxrdm+0SHVo21szEAjul4tAdqJOv75aYQc0c7h8Dk=; b=xPQoB8hwTT3pivib1Hn8+qHsyymptHLlY7kqXJxkjPxIQ/m7sX3Mp9IgfrnHNIHxjWs0 A47MAuSUFf+gTXGXqw/J38sea+i8D/QCzHQ5nmmVhUdxp1/ybcNm1v6+j8RwsGmvnssL w2rl1eIoUPCTac6X8nCuM9C/9OHXZbHpEIFS9AzFqn40BBfp8mtahTaZT5aucL58DQZ2 qZakPz5hBqZwdXXvgL8S5I/nwffVp8b5cBAT8wlWmrs7QN+4OgBUtO4iVaqZug1swVXW rg3hDV92e/xWj6+OZ7oQpW/dfIFQYh9FwGWoy1e2BcNpFNdD6O3nzOREEH4Mvj4x36SM 1Q== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 2ryrxcq5u6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:34 +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 x3MFij7q157727; Mon, 22 Apr 2019 15:45:34 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2s0dwds10j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:33 +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 x3MFjX1j030498; Mon, 22 Apr 2019 15:45:33 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2019 08:45:33 -0700 Subject: [PATCH 07/10] libxfs: refactor buffer item release code From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 22 Apr 2019 08:45:34 -0700 Message-ID: <155594793429.115924.9115512760848857551.stgit@magnolia> In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220119 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 From: Darrick J. Wong Refactor the buffer item release code into a helper, which we will use in subsequent patches to make the buffer log item lifetime match the kernel equivalents. Signed-off-by: Darrick J. Wong --- libxfs/trans.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libxfs/trans.c b/libxfs/trans.c index 9de77c8b..629501f8 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -505,6 +505,16 @@ libxfs_trans_ordered_buf( return ret; } +static void +xfs_buf_item_put( + struct xfs_buf_log_item *bip) +{ + struct xfs_buf *bp = bip->bli_buf; + + bp->b_log_item = NULL; + kmem_zone_free(xfs_buf_item_zone, bip); +} + void libxfs_trans_brelse( xfs_trans_t *tp, @@ -846,7 +856,6 @@ buf_item_done( bp = bip->bli_buf; ASSERT(bp != NULL); - bp->b_log_item = NULL; /* remove log item */ bp->b_transp = NULL; /* remove xact ptr */ hold = (bip->bli_flags & XFS_BLI_HOLD); @@ -861,8 +870,7 @@ buf_item_done( bip->bli_flags &= ~XFS_BLI_HOLD; else libxfs_putbuf(bp); - /* release the buf item */ - kmem_zone_free(xfs_buf_item_zone, bip); + xfs_buf_item_put(bip); } static void From patchwork Mon Apr 22 15:45:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10911225 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 CE8D414DB for ; Mon, 22 Apr 2019 15:47:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF32C286F2 for ; Mon, 22 Apr 2019 15:47:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B345E286FF; Mon, 22 Apr 2019 15:47:43 +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 60988286F2 for ; Mon, 22 Apr 2019 15:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727463AbfDVPrn (ORCPT ); Mon, 22 Apr 2019 11:47:43 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:40972 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVPrm (ORCPT ); Mon, 22 Apr 2019 11:47:42 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3MFiFJ3049326; Mon, 22 Apr 2019 15:47:40 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-2018-07-02; bh=Xd++3Prbs62/SAh/aX+euktD+mZn9+MO6d+yEiR4lG0=; b=s2egViZ4Hg0wdPBdw/3vFHxXnAimxyoW8YG03Wvj7jDdJ+qPJAZZF+lnuUxV/p/UbGnk eIUl1N1H0oN3ms6sd0GW6DNrcQ9O7Yd+cVEwdccCbS1AZ+j2zxJfB/zMsEVDhzvk83Rh 3dKq5bue5WfkftY4y/lKy5NcrjnMPaZsKnMfZi9/gnlzm6LLuNvgKl0JObRbgJ7tJC3R CEzAbDh96tN9I6Y8KnjciAVhZEdxErr6FuVsSgLMfpcebXneI/JaESN66o0KH3hIEfLS vMVmo94OvFwjbMHX3MqCOyw4MzGbOck/+UGR6kDAvm/14M+Ej0LnBKKWiTl2hTOMXQtk Zw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 2ryrxcq65h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:47:40 +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 x3MFiL0H185553; Mon, 22 Apr 2019 15:45:40 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2s0f0v0krx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:40 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3MFjdW4017477; Mon, 22 Apr 2019 15:45:39 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2019 08:45:39 -0700 Subject: [PATCH 08/10] libxfs: don't touch buffer log item pointer when flushing inode log item From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 22 Apr 2019 08:45:40 -0700 Message-ID: <155594794076.115924.11541140246431884889.stgit@magnolia> In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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-1810050000 definitions=main-1904220119 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 From: Darrick J. Wong When we're flushing an inode log item, it is not necessary to mess with the inode cluster buffer's log item because the iflush code paths pass the inode log item directly. The unconditional reset causes us to leak buffer log items. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Reviewed-by: Bill O'Donnell --- libxfs/trans.c | 2 -- libxfs/util.c | 1 - 2 files changed, 3 deletions(-) diff --git a/libxfs/trans.c b/libxfs/trans.c index 629501f8..d562cdc0 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -826,10 +826,8 @@ inode_item_done( * of whether the flush succeed or not. If we fail the flush, make sure * we still release the buffer reference we currently hold. */ - bp->b_log_item = iip; error = libxfs_iflush_int(ip, bp); ip->i_transp = NULL; /* disassociate from transaction */ - bp->b_log_item = NULL; /* remove log item */ bp->b_transp = NULL; /* remove xact ptr */ if (error) { diff --git a/libxfs/util.c b/libxfs/util.c index ea75fa20..9fe9a367 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -394,7 +394,6 @@ libxfs_iflush_int(xfs_inode_t *ip, xfs_buf_t *bp) xfs_dinode_t *dip; xfs_mount_t *mp; - ASSERT(bp-b_log_item != NULL); ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || ip->i_d.di_nextents > ip->i_df.if_ext_max); ASSERT(ip->i_d.di_version > 1); From patchwork Mon Apr 22 15:45:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10911217 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 C918B14DB for ; Mon, 22 Apr 2019 15:45:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B98E0286F2 for ; Mon, 22 Apr 2019 15:45:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACF5B286FF; Mon, 22 Apr 2019 15:45:50 +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 59416286F2 for ; Mon, 22 Apr 2019 15:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727226AbfDVPpu (ORCPT ); Mon, 22 Apr 2019 11:45:50 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:39020 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVPpt (ORCPT ); Mon, 22 Apr 2019 11:45:49 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3MFi82F049257; Mon, 22 Apr 2019 15:45:47 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-2018-07-02; bh=WcE5dGgM+wrp9GsE8JXIsNnm4NSxG2O/gBdVdPnPcPc=; b=eAG8U7UDHHEeFIP2DG7Y05faLUhxRhIYgjYmD0yrvhCrLbXdHnbX0qsAyJEGclv50T35 74TdPak6sP/0EmXLu49rx+vIc9SLiyFVwicU0IAvgzbnaR+R+XfD4YCf5luSqtK+VK5Y 46cfABSLRT+U3lwIGYcrIlvbi7GnS/yOKktMULAV9MyCID0qYqjdkC94tjsCBQltHNEH X84L4l4VIPKXVkiQz8kFpYs9JKGK4fHf0YOWpWOAmEqVxG+y1P1Q/7o/4trUy/TKq2gx NFMgtFRtj+FTUreaN0MvGl3Ky0fTdWKqTPRvi+Cs3atgc3OIrSachr+VYVbb6LhQLPvX KA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 2ryrxcq5v6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:47 +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 x3MFiea5157423; Mon, 22 Apr 2019 15:45:46 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2s0dwds135-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:46 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x3MFjkIp030596; Mon, 22 Apr 2019 15:45:46 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2019 08:45:45 -0700 Subject: [PATCH 09/10] libxfs: fix buffer log item lifetime weirdness From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 22 Apr 2019 08:45:47 -0700 Message-ID: <155594794719.115924.7816478131558954855.stgit@magnolia> In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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=747 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904220118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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=771 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904220119 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 From: Darrick J. Wong In xfsprogs, the lifetime of xfs_buf log items doesn't match the kernel because we keep them around after comitting or cancelling transactions. This is confusing, so change the lifetime to be consistent. Worse yet, if an inode cluster buffer gets bjoined to a transaction (e.g. someone called xfs_trans_read_buf) we'll leak it when flushing an inode core back to that buffer. Signed-off-by: Darrick J. Wong Reviewed-by: Bill O'Donnell --- libxfs/trans.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libxfs/trans.c b/libxfs/trans.c index d562cdc0..22926236 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -545,6 +545,7 @@ libxfs_trans_brelse( xfs_trans_del_item(&bip->bli_item); if (bip->bli_flags & XFS_BLI_HOLD) bip->bli_flags &= ~XFS_BLI_HOLD; + xfs_buf_item_put(bip); bp->b_transp = NULL; libxfs_putbuf(bp); } @@ -904,6 +905,7 @@ buf_item_unlock( hold = bip->bli_flags & XFS_BLI_HOLD; bip->bli_flags &= ~XFS_BLI_HOLD; + xfs_buf_item_put(bip); if (!hold) libxfs_putbuf(bp); } From patchwork Mon Apr 22 15:45:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10911219 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 4F51E161F for ; Mon, 22 Apr 2019 15:45:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41249286F6 for ; Mon, 22 Apr 2019 15:45:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35FB528707; Mon, 22 Apr 2019 15:45: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=-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 D3E92286F6 for ; Mon, 22 Apr 2019 15:45:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727277AbfDVPp4 (ORCPT ); Mon, 22 Apr 2019 11:45:56 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:39116 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVPp4 (ORCPT ); Mon, 22 Apr 2019 11:45:56 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3MFi3rX049231; Mon, 22 Apr 2019 15:45:53 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-2018-07-02; bh=W4bvcF6F18HRq3kwN1i8zn4ASXQ0HDZma9+L9at4e7E=; b=JV55EsmFAZtX8CHLwizz4a/fVy1eizpVEX1uWzOzCETKmO0gHwmpRTSID7T1RQxjj37W b3O86QiHRzVvi2lM37UfiktQA6ig1Nu7FAYSja1DT1MnI6XSrOh71U4pQqaMvVTFVUvW l5FHDkMNQHiyo4o6HkfSfkRpArM3PSDSawkRb4Ax0uTuMOPJGYo2GI2lNvpkM1KEQDDH ipaoYdonX50TzA80kib5UBomwD4dhuKQTC0Lgp32ATI4nfRolciFroO7tMePHgnrJtOg /UKiT4dc1ts4WHZOZG4mk/ws+xOvOuWB0zTXqABe59Zu7s4B3O1ejtO25PrGlXbo8EfB Sw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 2ryrxcq5vs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:53 +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 x3MFiNZH017456; Mon, 22 Apr 2019 15:45:53 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2s0fv2g7b5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:53 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3MFjqCs014182; Mon, 22 Apr 2019 15:45:52 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2019 08:45:51 -0700 Subject: [PATCH 10/10] libxfs: shorten inode item lifetime From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 22 Apr 2019 08:45:53 -0700 Message-ID: <155594795339.115924.2841573798611518042.stgit@magnolia> In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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=834 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904220118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 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=856 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904220119 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 From: Darrick J. Wong Shorten the inode item lifetime so that we only keep them around while the inode is joined with a transaction. Signed-off-by: Darrick J. Wong Reviewed-by: Bill O'Donnell --- libxfs/rdwr.c | 4 +--- libxfs/trans.c | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index bc2ed38c..a5efc805 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -1428,9 +1428,7 @@ void libxfs_irele( struct xfs_inode *ip) { - if (ip->i_itemp) - kmem_zone_free(xfs_ili_zone, ip->i_itemp); - ip->i_itemp = NULL; + ASSERT(ip->i_itemp == NULL); libxfs_idestroy(ip); kmem_zone_free(xfs_inode_zone, ip); } diff --git a/libxfs/trans.c b/libxfs/trans.c index 22926236..1dcdebf3 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -785,6 +785,16 @@ _("Transaction block reservation exceeded! %u > %u\n"), tp->t_flags |= (XFS_TRANS_SB_DIRTY | XFS_TRANS_DIRTY); } +static void +xfs_inode_item_put( + struct xfs_inode_log_item *iip) +{ + struct xfs_inode *ip = iip->ili_inode; + + ip->i_itemp = NULL; + kmem_zone_free(xfs_ili_zone, iip); +} + /* * Transaction commital code follows (i.e. write to disk in libxfs) @@ -809,7 +819,7 @@ inode_item_done( if (!(iip->ili_fields & XFS_ILOG_ALL)) { ip->i_transp = NULL; /* disassociate from transaction */ iip->ili_flags = 0; /* reset all flags */ - return; + goto free; } /* @@ -819,7 +829,7 @@ inode_item_done( if (error) { fprintf(stderr, _("%s: warning - imap_to_bp failed (%d)\n"), progname, error); - return; + goto free; } /* @@ -835,7 +845,7 @@ inode_item_done( fprintf(stderr, _("%s: warning - iflush_int failed (%d)\n"), progname, error); libxfs_putbuf(bp); - return; + goto free; } libxfs_writebuf(bp, 0); @@ -843,6 +853,8 @@ inode_item_done( fprintf(stderr, "flushing dirty inode %llu, buffer %p\n", ip->i_ino, bp); #endif +free: + xfs_inode_item_put(iip); } static void @@ -920,6 +932,7 @@ inode_item_unlock( ip->i_transp = NULL; iip->ili_flags = 0; + xfs_inode_item_put(iip); } /* Detach and unlock all of the items in a transaction */ From patchwork Tue Apr 23 21:04:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10913747 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 B99A61390 for ; Tue, 23 Apr 2019 21:04:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A749B287EF for ; Tue, 23 Apr 2019 21:04:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AD7828952; Tue, 23 Apr 2019 21:04:15 +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 5314C287EF for ; Tue, 23 Apr 2019 21:04:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726157AbfDWVEP (ORCPT ); Tue, 23 Apr 2019 17:04:15 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:39424 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726083AbfDWVEO (ORCPT ); Tue, 23 Apr 2019 17:04:14 -0400 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 x3NKxn4O076980; Tue, 23 Apr 2019 21:04:12 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-2018-07-02; bh=a07jLjaTGmTRqt2C/xEW7rf6OXxjHGJjM6mX3xMfhRA=; b=M6ol/RhJBnYgUi3fLYJlvh/CPZS7rp/kMnRv5niu8jlxPOF80YpG580vugMSAAo79dYo rzQDGLn4C1X9/sJEtFkhAp1rFXnbjBawzLeW+YyWfDq80awF45WzZ1sHjWq5fXC8lD65 IytDL6rys/rLsYet2+iSd0Hict1hl+TyRJPlZodot04DFvZgNV0ptca5YLEZXdI/6ApP aHhGVkhmramSYeqTkJRFEgw4eZk5IVVNDxGrelMpOuS/mYCevP1+AnrcU3UfrsVIvPgM aD1e31Km6lrVAxiBxGgLoTqwVCsEM0l/qUJs1P+mk4omc/IsdJlcd29A8uFrRBFVH47n 2g== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2ryv2q6mwp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Apr 2019 21:04:12 +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 x3NL2t1a001308; Tue, 23 Apr 2019 21:04:11 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2s0fv3754f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Apr 2019 21:04:11 +0000 Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x3NL4Ari014455; Tue, 23 Apr 2019 21:04:10 GMT Received: from localhost (/10.145.179.89) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 23 Apr 2019 14:04:10 -0700 Date: Tue, 23 Apr 2019 14:04:09 -0700 From: "Darrick J. Wong" To: sandeen@sandeen.net Cc: linux-xfs@vger.kernel.org Subject: [PATCH 11/10] libfrog: fix memory leak in bitmap_free Message-ID: <20190423210409.GC178290@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9236 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=838 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904230149 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9236 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=879 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904230149 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 From: Darrick J. Wong Free the bitmap struct before we null out the caller's pointer. Signed-off-by: Darrick J. Wong Reviewed-by: Bill O'Donnell --- libfrog/bitmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libfrog/bitmap.c b/libfrog/bitmap.c index aecdba0d..450ebe0a 100644 --- a/libfrog/bitmap.c +++ b/libfrog/bitmap.c @@ -104,6 +104,7 @@ bitmap_free( free(ext); } free(bmap->bt_tree); + free(bmap); *bmapp = NULL; }