From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751311AbdIMXbW (ORCPT ); Wed, 13 Sep 2017 19:31:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:34020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751125AbdIMXbR (ORCPT ); Wed, 13 Sep 2017 19:31:17 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECC87218F9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jaegeuk@kernel.org Date: Wed, 13 Sep 2017 16:31:16 -0700 From: Jaegeuk Kim To: Al Viro Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [PATCH] vfs: introduce UMOUNT_WAIT which waits for umount completion Message-ID: <20170913233116.GA45354@jaegeuk-macbookpro.roam.corp.google.com> References: <20170913200941.39420-1-jaegeuk@kernel.org> <20170913230426.GN5426@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170913230426.GN5426@ZenIV.linux.org.uk> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Al, On 09/14, Al Viro wrote: > On Wed, Sep 13, 2017 at 01:09:41PM -0700, Jaegeuk Kim wrote: > > + if (!retval && (flags & UMOUNT_WAIT)) { > > + if (likely(!(current->flags & PF_KTHREAD))) > > + task_work_run(); > > This is complete crap. The same damn thing will be done by > caller of sys_umount() pretty much immediately afterwards. > I'm not sure what it is that you are trying to paper over, > but this is just plain wrong. Okay. > What _is_ the semantics of UMOUNT_WAIT? What does it guarantee, > and what would be supplying it to umount(2)? When android tries to reboot the system, it calls umount(2) without any flag. Then, mntput_no_expire() will add delayed_mntput_work() which finally does cleanup_mnt() later. In the mean time, android proceeded to shutdown all the UFS devices, but filesystem would be still alive and tries to trigger some I/Os. At this moment, I'd like to avoid EIO, since ext4 can issue kernel panic because of error=panic. So, what I'm trying to do is 1) adding a flag to wait for umount() completion, 2) issuing umount(2) with UMOUNT_WAIT in android. Then, it can guarantee there'd be no I/Os after sucessful umount(). Could you please correct me? Thanks,