Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753338AbcDRRrn (ORCPT ); Mon, 18 Apr 2016 13:47:43 -0400 Received: from sandeen.net ([63.231.237.45]:43979 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbcDRRrm (ORCPT ); Mon, 18 Apr 2016 13:47:42 -0400 Subject: Re: [PATCH] fs: add the FIGETFROZEN ioctl call To: Florian Margaine , Dave Chinner References: <20160415021737.GZ567@dastard> <5714FB36.6020704@sandeen.net> <1461000003.6411.1.camel@margaine.com> Cc: Alexander Viro , Jeff Layton , "J. Bruce Fields" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org From: Eric Sandeen Message-ID: <57151DBB.3010105@sandeen.net> Date: Mon, 18 Apr 2016 13:47:39 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <1461000003.6411.1.camel@margaine.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1529 Lines: 42 On 4/18/16 1:20 PM, Florian Margaine wrote: > On Mon, 2016-04-18 at 11:20 -0400, Eric Sandeen wrote: >> > >> > On 4/14/16 10:17 PM, Dave Chinner wrote: >>> > > On Thu, Apr 14, 2016 at 09:57:07AM +0200, Florian Margaine wrote: >>>> > > > This lets userland get the filesystem freezing status, aka >>>> > > > whether the >>>> > > > filesystem is frozen or not. This is so that an application can >>>> > > > know if >>>> > > > it should freeze the filesystem or if it isn't necessary when >>>> > > > taking a >>>> > > > snapshot. >>> > > >>> > > freezing nests, so there is no reason for avoiding a freeze when >>> > > doing a snapshot. >> > >> > Sadly, no: >> > >> > # xfs_freeze -f /mnt/test >> > # xfs_freeze -f /mnt/test >> > xfs_freeze: cannot freeze filesystem at /mnt/test: Device or resource >> > busy >> > >> > It used to, but it was broken^Wchanged quite some time ago. > I guess I can provide a patch for this. Silently making it a no-op if > the FS is already frozen in ioctl_fsfreeze() should be good enough? That doesn't work, because you can go: Process A: Freeze Process A: Start snapshotting Process B: Freeze; already frozen, no-op Process B: Start snapshotting Process A: Snapshot done, unfreeze Process B: Now B is snapshotting an unfrozen filesystem Freeze needs to be nested so that two freeze calls require two thaw calls to make the filesystem active again, so that any given process calling freeze can be reasonably sure that it will stay frozen until it calls unfreeze at some later point. -Eric