Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3851912pxb; Tue, 17 Nov 2020 05:24:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwD8X0m5U83b53LCEL9grq0P1Ha47MpbY0cUhWVM0kSpvrB6okPj/+wFKWGlPQMSn7gRIcj X-Received: by 2002:a17:906:7e55:: with SMTP id z21mr18882152ejr.154.1605619459176; Tue, 17 Nov 2020 05:24:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619459; cv=none; d=google.com; s=arc-20160816; b=SAzgR3Jq9lUEl6bONIE79rSsokFwY1h4DCYXYq/wdxHCkS+zuGVdnyI4hClPK6XgUo 9Kv77bST9aelGLiDIIqc9w5lzPA6UXK/8H2eRi0HJ5QR9Y65ZLqW/rLLV/kbOkmkxN4Q nkbUbMpbnkkM7UHRNEYEyJmglknU8vFegtDFt2FcqVx0r2Rxruq9dm349styoBZ+S1EG IYjjVIDB6o98Vfcrh1Ez4C0JnKvYqiPxxWaYzq7Zd+ASKg3INjNgOBkABjXINlz5/L9P hLSRiEXZpVuV5FAOmhCUN5EutZBqb/yA9GEM5fvGGcAMEUHNzzKLgwcrSEgY4h4pUi6f fnRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NEuSGe1Dz7Ag0qamzvpweTIGAoz/mlGuUjm9Qrh+7PU=; b=biAUrX/NKGitwD9DzF3e9RohM4KxH/xbbDmU8iwNvHcGD7Z6ADAfPeEJuPSNk7VIjA d6gxG4fnt9to8WBnLRT1hxjuO0EdTS+KAlKAI3cDT6iF9ty2Z9yAHEN8wAKFvMaq/6Gm yZRIbmCxksa7aB7tllQPkbjMgkszlThkfuu1GHcRKPjar4fIN6VGV6j2QrKLn2+rsZBe 7tXgez8Dzoetit3iEcKdEuOrXFyJDBqQajPl+2enmJvZb5PoioePt2PHJpHPu5LCBXpp RWQUdzqfEI6PHvG4ixwOccr7zUWshz/o1snn3B943UcE8Wqt//dRzWC3TsvOOVDZawqT gFZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ieI8egw1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k6si13482211eds.482.2020.11.17.05.23.56; Tue, 17 Nov 2020 05:24:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ieI8egw1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730400AbgKQNTX (ORCPT + 99 others); Tue, 17 Nov 2020 08:19:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:51786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730745AbgKQNTA (ORCPT ); Tue, 17 Nov 2020 08:19:00 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F17C2225B; Tue, 17 Nov 2020 13:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619140; bh=kW6BdGEdt/qVS4A1JYuP8GKZc0CMpt5ud0hNVAooEno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ieI8egw1ygRGJw0zrYIM7lwdXv5802BZh9LCDtmODUCScOsdM417S/+XqcF4Lkr2Y oCDuZmK3wntgnLwn7IEC4YY3zBZNRgV+/a+HzQrg+V+KdN5z9ss2niPKYTWH5rVg3T WBc6S6eSkMNnGCnGZ6QZqtLk/v149pFU0tG3w+gE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Brian Foster , Sasha Levin Subject: [PATCH 4.19 011/101] xfs: set xefi_discard when creating a deferred agfl free log intent item Date: Tue, 17 Nov 2020 14:04:38 +0100 Message-Id: <20201117122113.651550678@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122113.128215851@linuxfoundation.org> References: <20201117122113.128215851@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Darrick J. Wong [ Upstream commit 2c334e12f957cd8c6bb66b4aa3f79848b7c33cab ] Make sure that we actually initialize xefi_discard when we're scheduling a deferred free of an AGFL block. This was (eventually) found by the UBSAN while I was banging on realtime rmap problems, but it exists in the upstream codebase. While we're at it, rearrange the structure to reduce the struct size from 64 to 56 bytes. Fixes: fcb762f5de2e ("xfs: add bmapi nodiscard flag") Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Signed-off-by: Sasha Levin --- fs/xfs/libxfs/xfs_alloc.c | 1 + fs/xfs/libxfs/xfs_bmap.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index 1eb7933dac83e..b3a9043b0c9ee 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -2213,6 +2213,7 @@ xfs_defer_agfl_block( new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno); new->xefi_blockcount = 1; new->xefi_oinfo = *oinfo; + new->xefi_skip_discard = false; trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1); diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h index 488dc8860fd7c..50242ba3cdb72 100644 --- a/fs/xfs/libxfs/xfs_bmap.h +++ b/fs/xfs/libxfs/xfs_bmap.h @@ -52,9 +52,9 @@ struct xfs_extent_free_item { xfs_fsblock_t xefi_startblock;/* starting fs block number */ xfs_extlen_t xefi_blockcount;/* number of blocks in extent */ + bool xefi_skip_discard; struct list_head xefi_list; struct xfs_owner_info xefi_oinfo; /* extent owner */ - bool xefi_skip_discard; }; #define XFS_BMAP_MAX_NMAP 4 -- 2.27.0