Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932641AbdCIPao (ORCPT ); Thu, 9 Mar 2017 10:30:44 -0500 Received: from mx2.suse.de ([195.135.220.15]:57404 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754975AbdCIPaM (ORCPT ); Thu, 9 Mar 2017 10:30:12 -0500 Date: Thu, 9 Mar 2017 16:29:29 +0100 From: David Sterba To: Qu Wenruo Cc: "Reshetova, Elena" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-btrfs@vger.kernel.org" , "peterz@infradead.org" , "gregkh@linuxfoundation.org" , "jbacik@fb.com" , "clm@fb.com" , "dsterba@suse.com" Subject: Re: [PATCH 00/17] fs, btrfs refcount conversions Message-ID: <20170309152929.GG14605@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Qu Wenruo , "Reshetova, Elena" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-btrfs@vger.kernel.org" , "peterz@infradead.org" , "gregkh@linuxfoundation.org" , "jbacik@fb.com" , "clm@fb.com" , "dsterba@suse.com" References: <1488531326-21271-1-git-send-email-elena.reshetova@intel.com> <7849485b-89a5-485b-dfcb-e6c8f6ef0aa0@cn.fujitsu.com> <2236FBA76BA1254E88B949DDB74E612B41C54E80@IRSMSX102.ger.corp.intel.com> <2236FBA76BA1254E88B949DDB74E612B41C555E6@IRSMSX102.ger.corp.intel.com> <2b9ad52c-34fa-1c54-0374-01d443530f63@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2b9ad52c-34fa-1c54-0374-01d443530f63@cn.fujitsu.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1288 Lines: 33 On Tue, Mar 07, 2017 at 03:49:52PM +0800, Qu Wenruo wrote: > >>> If the patches pass all tests on your side, could you please take them in and > >> propagate further? > >>> I will continue with other kernel subsystems. > >> > >> The patchset itself looks like a common cleanup, while I did encounter > >> several cases (almost all scrub tests) causing kernel warning due to > >> underflow. > > > > Oh, could you please send me the warning outputs? I can hopefully analyze and fix them. > > Attached. Which is the generated by running btrfs/070 test case. > And I canceled the case almost instantly, so output is not much, but > still contains enough info. > > Both refcount_inc() and refcount_sub_and_test() are causing warning. > > So now I'm not sure which is the cause, btrfs or bad use of refcount? We we do atomic_inc to get the first reference after initialization in scrub_pages, instead of atomic_set (or an equivalent): 2266 spage = kzalloc(sizeof(*spage), GFP_KERNEL); 2267 if (!spage) { ... 2274 } ... 2276 scrub_page_get(spage); so the references are 0 and refcount_inc will catch that, the fix is simple. The refcount_sub_and_test reports seem to catch a bug in refcounting, I'm analyzing it right now.