Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1251966pxx; Tue, 27 Oct 2020 11:52:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOlOIhAdgOu9aebPwbiic1mBu+Z3aKcHrbdbIF97kBT6iH7aOP8wmfZS7xfZyXoa23Q89g X-Received: by 2002:a05:6402:17ad:: with SMTP id j13mr723056edy.347.1603824777868; Tue, 27 Oct 2020 11:52:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603824777; cv=none; d=google.com; s=arc-20160816; b=fGlLf3556pMQ+74utowcw4KAOxJhonECghuuzY//NdlpKdwf6W/93Q4ipVZhrCzY/Q HamPD4WS5ZYPgrhLrdCB4iX0TYV/AL/INiRWDVBarMEKB6punx8NPG/v6gKalsRKMIjU jt7nP71ygYHT3ow0ey1w1DLkjp0e7QqF5o2lRMDUi5gqyCp8wFcxcmKgHEoKxuQcRrfR 7KKxDzwhfxSD74sIWtnLV5S7opY2YciuW/ZpkF1eOHwWcpV/CyAeEZ6he/C4CTs8A5o2 ouX/7U+2fwJzSsIa2UYxW4A7pzI/AJtVL/5yBsAkbHcscjvfdhvLhd9xAm7rmbvYxhVw HsbA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+kBse2eRDVxELM6VXAS3ixQe6oHwi0wCXnT8vb0k/7Q=; b=x31OR2M2PyOqqXbPZ0hJVn0EY1K4Q7AG2AAXTJYqeemV5bKtuyhNIKvq0HNSilh780 5gMynagP1T2strGiJ9JBmOYiHjjZWfdI+fuvgl8jWqTGnm+USl7xtk7p2QfRUhtevkij InNdJ1ZmjMZV0+rELbcfh4DgDX+DZXRTSdmG5D8SiVhXHn3F7/LRE00XeaxDIqQQSMk9 QeyrOSRhfUYUGn9uwGEGHS18YxMSRNmv4kC9Np4GGa8HXhCNJV2VpPrE5H+4VO4d2kFk yFHE1QvE1aL9qXnTmWaVO7bIQlC3NbuLkO9XNtIc3xoOzA2t2azPJvunigWOgna74iAA Vv9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Peywlc+2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o5si1606241edz.212.2020.10.27.11.52.35; Tue, 27 Oct 2020 11:52:57 -0700 (PDT) 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=Peywlc+2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2444371AbgJ0Aii (ORCPT + 99 others); Mon, 26 Oct 2020 20:38:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:47752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408755AbgJZXth (ORCPT ); Mon, 26 Oct 2020 19:49:37 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8BE342075B; Mon, 26 Oct 2020 23:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756176; bh=+NwHXhlGzd5i8K77Rhgue2pCfD0yCHRoE8gcXo1uYcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Peywlc+2e68GtRpo/rtWAmoiVecxCRFx8qlINqa7MQAkrRtkk5iVPkkUT7AbMZxwJ 1oPkvbDUHRN8SpWTq57G5ICgdOkRPCW3z3iAVwA6n2jd2lzKjHo9smBmV6SQiVCvCJ pWNww3zSYt/mssk4craqs+Es+E8YcUuoFRa5RcvE= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chandan Babu R , "Darrick J . Wong" , Sasha Levin , linux-xfs@vger.kernel.org Subject: [PATCH AUTOSEL 5.9 024/147] xfs: Set xfs_buf's b_ops member when zeroing bitmap/summary files Date: Mon, 26 Oct 2020 19:47:02 -0400 Message-Id: <20201026234905.1022767-24-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026234905.1022767-1-sashal@kernel.org> References: <20201026234905.1022767-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chandan Babu R [ Upstream commit c54e14d155f5fdbac73a8cd4bd2678cb252149dc ] In xfs_growfs_rt(), we enlarge bitmap and summary files by allocating new blocks for both files. For each of the new blocks allocated, we allocate an xfs_buf, zero the payload, log the contents and commit the transaction. Hence these buffers will eventually find themselves appended to list at xfs_ail->ail_buf_list. Later, xfs_growfs_rt() loops across all of the new blocks belonging to the bitmap inode to set the bitmap values to 1. In doing so, it allocates a new transaction and invokes the following sequence of functions, - xfs_rtfree_range() - xfs_rtmodify_range() - xfs_rtbuf_get() We pass '&xfs_rtbuf_ops' as the ops pointer to xfs_trans_read_buf(). - xfs_trans_read_buf() We find the xfs_buf of interest in per-ag hash table, invoke xfs_buf_reverify() which ends up assigning '&xfs_rtbuf_ops' to xfs_buf->b_ops. On the other hand, if xfs_growfs_rt_alloc() had allocated a few blocks for the bitmap inode and returned with an error, all the xfs_bufs corresponding to the new bitmap blocks that have been allocated would continue to be on xfs_ail->ail_buf_list list without ever having a non-NULL value assigned to their b_ops members. An AIL flush operation would then trigger the following warning message to be printed on the console, XFS (loop0): _xfs_buf_ioapply: no buf ops on daddr 0x58 len 8 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ CPU: 3 PID: 449 Comm: xfsaild/loop0 Not tainted 5.8.0-rc4-chandan-00038-g4d8c2b9de9ab-dirty #37 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack+0x57/0x70 _xfs_buf_ioapply+0x37c/0x3b0 ? xfs_rw_bdev+0x1e0/0x1e0 ? xfs_buf_delwri_submit_buffers+0xd4/0x210 __xfs_buf_submit+0x6d/0x1f0 xfs_buf_delwri_submit_buffers+0xd4/0x210 xfsaild+0x2c8/0x9e0 ? __switch_to_asm+0x42/0x70 ? xfs_trans_ail_cursor_first+0x80/0x80 kthread+0xfe/0x140 ? kthread_park+0x90/0x90 ret_from_fork+0x22/0x30 This message indicates that the xfs_buf had its b_ops member set to NULL. This commit fixes the issue by assigning "&xfs_rtbuf_ops" to b_ops member of each of the xfs_bufs logged by xfs_growfs_rt_alloc(). Signed-off-by: Chandan Babu R Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Sasha Levin --- fs/xfs/xfs_rtalloc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 04b953c3ffa75..48be55b18c494 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -838,6 +838,7 @@ xfs_growfs_rt_alloc( goto out_trans_cancel; xfs_trans_buf_set_type(tp, bp, buf_type); + bp->b_ops = &xfs_rtbuf_ops; memset(bp->b_addr, 0, mp->m_sb.sb_blocksize); xfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1); /* -- 2.25.1