From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox Subject: Re: [PATCH v10 00/62] Convert page cache to XArray Date: Wed, 4 Apr 2018 20:52:00 -0700 Message-ID: <20180405035200.GE9301@bombadil.infradead.org> References: <20180330034245.10462-1-willy@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1f3vwv-0003Ro-VA for linux-f2fs-devel@lists.sourceforge.net; Thu, 05 Apr 2018 03:52:33 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1f3vwq-009VeR-DV for linux-f2fs-devel@lists.sourceforge.net; Thu, 05 Apr 2018 03:52:33 +0000 Content-Disposition: inline In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Mike Kravetz Cc: linux-nilfs@vger.kernel.org, Jan Kara , Jeff Layton , Matthew Wilcox , James Simmons , Jaegeuk Kim , Andreas Dilger , Nicholas Piggin , linux-f2fs-devel@lists.sourceforge.net, Oleg Drokin , linux-mm@kvack.org, Ryusuke Konishi , linux-fsdevel@vger.kernel.org, Lukas Czerner , Ross Zwisler , Christoph Hellwig , Goldwyn Rodrigues On Wed, Apr 04, 2018 at 09:35:46AM -0700, Mike Kravetz wrote: > Running with this XArray series on top of next-20180329 consistently 'hangs' > on shutdown looping (?forever?) in tag_pages_for_writeback/xas_for_each_tag. > All I have to do is make sure there is some activity on the ext4 fs before > shutdown. Not sure if this is a 'next-20180329' issue or XArray issue. > But the fact that we are looping in xas_for_each_tag looks suspicious. Thanks for your help debugging this! Particularly collecting the xa_dump. I got bit by the undefined behaviour of shifting by BITS_PER_LONG, but of course it was subtle. The userspace testing framework wasn't catching this for a couple of reasons; I'll work on making sure it catches this kind of thing in the future. I'll fold this in and post a v11 later this week or early next week. diff --git a/include/linux/xarray.h b/include/linux/xarray.h index eac04922eba2..f5b7e507a86f 100644 --- a/include/linux/xarray.h +++ b/include/linux/xarray.h @@ -904,9 +929,12 @@ static inline unsigned int xas_find_chunk(struct xa_state *xas, bool advance, if (advance) offset++; if (XA_CHUNK_SIZE == BITS_PER_LONG) { - unsigned long data = *addr & (~0UL << offset); - if (data) - return __ffs(data); + if (offset < XA_CHUNK_SIZE) { + unsigned long data = *addr & (~0UL << offset); + + if (data) + return __ffs(data); + } return XA_CHUNK_SIZE; } ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot