From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Chinner Subject: [RFC, PATCH 0/5] fsfreeze: fix sb vs bdev freeze/thaw b0rkage Date: Thu, 10 Jun 2010 17:19:49 +1000 Message-ID: <1276154395-24766-1-git-send-email-david@fromorbit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, viro@ZenIV.linux.org.uk, josef@redhat.com, jeffmerkey@gmail.com To: linux-fsdevel@vger.kernel.org Return-path: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org The following series is for to address bugs in the emergency thawing co= de, as well as mismatche=D1=95 with freezing at the block layer and the superb= lock that break the freeze/thaw nesting order. The first two patches fix the emergency thaw infinite loop reported by = Jeff Merkey and the deadlock on sb->s_umount that the infinite loop hid. The= se may be stable kernel candidates. The remainder of the patches address the bdev/sb mismatch and the fact = that sb level freezing does not nest correctly. For all the places that the bde= v interfaces are used, we need a superblock anyway so we may as well make freeze/thaw work only at the sb level. As such, this series moves all t= he nesting code to the sb from the bdev level and removes the freeze_bdev/thaw_bdev interfaces completely. It also converts the emerg= ency thaw to work at the superblock level such that it will now thaw manuall= y frozen filesystems. A *big* outstanding problem still exists - freezing takes an active ref= erence to the superblock, so unmounting an frozen filesystem has some nasty an= d unexpected side effects. The existing code results in an unmountable bl= ock device: # mount /dev/vda /mnt/test # xfs_freeze -f /mnt/test # umount /mnt/test # grep test /proc/mounts # mkfs.xfs -f -l size=3D128m /dev/vda mkfs.xfs: /dev/vda contains a mounted filesystem Usage: mkfs.xfs =2E... # mount /dev/vda /mnt/test mount: /dev/vda already mounted or /mnt/test busy # At this point I can't get access to /dev/vda and needs a reboot to get it and /mnt/test back. This patch series results in the block device being mountable, but remains frozen across unmount/mount: # mount /dev/vda /mnt/test # xfs_freeze -f /mnt/test # umount /mnt/test # grep test /proc/mounts # mkfs.xfs -f -l size=3D128m /dev/vda mkfs.xfs: /dev/vda contains a mounted filesystem Usage: mkfs.xfs =2E... # mount /dev/vda /mnt/test # touch /mnt/test/foo & [1] 2647 # # xfs_freeze -u /mnt/test [1]+ Done sudo touch /mnt/test/foo # umount /mnt/test # mkfs.xfs -f -l size=3D128m /dev/vda meta-data=3D/dev/vda isize=3D256 agcount=3D4, agsize=3D= 262144 blks =3D sectsz=3D512 attr=3D2 data =3D bsize=3D4096 blocks=3D1048576, ima= xpct=3D25 =3D sunit=3D0 swidth=3D0 blks naming =3Dversion 2 bsize=3D4096 ascii-ci=3D0 log =3Dinternal log bsize=3D4096 blocks=3D32768, versi= on=3D2 =3D sectsz=3D512 sunit=3D0 blks, lazy-= count=3D1 realtime =3Dnone extsz=3D4096 blocks=3D0, rtextents= =3D0 # This behaviour is only marginally better than the existing behaviour (at least you can release the references). However, I don't really like either option - we used to disallow umount on a frozen filesystems to avoid this problem. So What is really supposed to happen when we unmount a frozen superblock? Should unmount return EBUSY? Should it be automatically thawed so it doesn't affect block device behaviour after unmount? Something else? Cheers, Dave.