Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752374AbbEKQHp (ORCPT ); Mon, 11 May 2015 12:07:45 -0400 Received: from cantor2.suse.de ([195.135.220.15]:34452 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751300AbbEKQHl (ORCPT ); Mon, 11 May 2015 12:07:41 -0400 Date: Mon, 11 May 2015 18:07:38 +0200 From: David Sterba To: Omar Sandoval Cc: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Qu Wenruo Subject: Re: [PATCH v2 1/6] Btrfs: lock superblock before remounting for rw subvol Message-ID: <20150511160738.GP23255@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Omar Sandoval , Chris Mason , Josef Bacik , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Qu Wenruo References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1225 Lines: 32 On Thu, Apr 09, 2015 at 02:34:51PM -0700, Omar Sandoval wrote: > Since commit 0723a0473fb4 ("btrfs: allow mounting btrfs subvolumes with > different ro/rw options"), when mounting a subvolume read/write when > another subvolume has previously been mounted read-only, we first do a > remount. However, this should be done with the superblock locked, as per > sync_filesystem(): > > /* > * We need to be protected against the filesystem going from > * r/o to r/w or vice versa. > */ > WARN_ON(!rwsem_is_locked(&sb->s_umount)); > > This WARN_ON can easily be hit with: > > mkfs.btrfs -f /dev/vdb > mount /dev/vdb /mnt > btrfs subvol create /mnt/vol1 > btrfs subvol create /mnt/vol2 > umount /mnt > mount -oro,subvol=/vol1 /dev/vdb /mnt > mount -orw,subvol=/vol2 /dev/vdb /mnt2 > > Fixes: 0723a0473fb4 ("btrfs: allow mounting btrfs subvolumes with different ro/rw options") > Signed-off-by: Omar Sandoval Reviewed-by: David Sterba -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/