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); }