Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752263AbcCARrE (ORCPT ); Tue, 1 Mar 2016 12:47:04 -0500 Received: from mail-oi0-f47.google.com ([209.85.218.47]:35989 "EHLO mail-oi0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbcCARrC (ORCPT ); Tue, 1 Mar 2016 12:47:02 -0500 Subject: Re: [PATCH v2 block/for-linus] writeback: flush inode cgroup wb switches instead of pinning super_block To: Tejun Heo , Tahsin Erdogan References: <20160215210047.GN3965@htj.duckdns.org> <20160216182457.GO3741@mtj.duckdns.org> <20160217205721.GE14140@quack.suse.cz> <20160217210744.GA6479@mtj.duckdns.org> <20160217223009.GN14140@quack.suse.cz> <20160217230231.GC6479@mtj.duckdns.org> <20160229204724.GV3965@htj.duckdns.org> <20160229232853.GD3965@htj.duckdns.org> Cc: Jan Kara , cgroups@vger.kernel.org, "Theodore Ts'o" , Nauman Rafique , linux-kernel@vger.kernel.org, Jan Kara , Al Viro From: Jens Axboe Message-ID: <56D5D592.2020800@kernel.dk> Date: Tue, 1 Mar 2016 10:46:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160229232853.GD3965@htj.duckdns.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1288 Lines: 26 On 02/29/2016 04:28 PM, Tejun Heo wrote: > If cgroup writeback is in use, inodes can be scheduled for > asynchronous wb switching. Before 5ff8eaac1636 ("writeback: keep > superblock pinned during cgroup writeback association switches"), this > could race with umount leading to super_block being destroyed while > inodes are pinned for wb switching. 5ff8eaac1636 fixed it by bumping > s_active while wb switches are in flight; however, this allowed > in-flight wb switches to make umounts asynchronous when the userland > expected synchronosity - e.g. fsck immediately following umount may > fail because the device is still busy. > > This patch removes the problematic super_block pinning and instead > makes generic_shutdown_super() flush in-flight wb switches. wb > switches are now executed on a dedicated isw_wq so that they can be > flushed and isw_nr_in_flight keeps track of the number of in-flight wb > switches so that flushing can be avoided in most cases. > > v2: Move cgroup_writeback_umount() further below and add MS_ACTIVE > check in inode_switch_wbs() as Jan an Al suggested. I queued this up for 4.5, but I'm feeling a bit uneasy about it. But it's either that, or revert 5ff8eaac1636 and fix it for real in 4.6. Jan/Tejun, what do you think? -- Jens Axboe