Return-Path: Received: from mail-pg0-f67.google.com ([74.125.83.67]:35958 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751392AbdFIALr (ORCPT ); Thu, 8 Jun 2017 20:11:47 -0400 Received: by mail-pg0-f67.google.com with SMTP id v18so6042575pgb.3 for ; Thu, 08 Jun 2017 17:11:46 -0700 (PDT) Date: Thu, 8 Jun 2017 17:11:39 -0700 (PDT) From: Richard Narron To: Al Viro cc: Linus Torvalds , Will B , linux-fsdevel , Evgeniy Dushistov Subject: Re: UFS s_maxbytes bogosity In-Reply-To: <20170608022057.GX6365@ZenIV.linux.org.uk> Message-ID: References: <20170604213736.GM6365@ZenIV.linux.org.uk> <20170604215838.GA24416@ZenIV.linux.org.uk> <20170604220602.GN6365@ZenIV.linux.org.uk> <20170605001142.GP6365@ZenIV.linux.org.uk> <20170605034936.GQ6365@ZenIV.linux.org.uk> <20170607234837.GA20362@ZenIV.linux.org.uk> <20170608022057.GX6365@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, 8 Jun 2017, Al Viro wrote: > The nasty cases are around short files, especially short files with holes. > Linear writes as done by cp(1) will do nothing worse than bogus i_blocks > (and possibly mangled counters in cylinder groups). Random write access > to short files, OTOH, steps into a lot more codepaths... > > As for ->i_blocks, it triggers this: > > root@kvm1:/mnt# df .; mkdir a; rmdir a; df . > Filesystem 1K-blocks Used Available Use% Mounted on > /dev/loop0 507420 4504 462340 1% /mnt > Filesystem 1K-blocks Used Available Use% Mounted on > /dev/loop0 507420 4536 462308 1% /mnt > > Note the 32Kb (== one block on that ufs2) leaked here. > Every iteration will leak another one. Similar for long > symlinks... > Test results don't look pretty on FreeBSD. (I will also test OpenBSD and NetBSD.) Freebsd: #newfs ada0s2d Linux: #mount -t ufs -o rw,ufstype=ufs2 /dev/sda18 /fbsdd cd /fbsdd #df . Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda18 20307184 8 18682632 1% /fbsdd #mkdir a #rmdir a #df . Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda18 20307184 40 18682600 1% /fbsdd #umount /dev/sda18 FreeBSD: # fsck -n /dev/ada0s2d ** /dev/ada0s2d (NO WRITE) ** Last Mounted on /diskd ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups FREE BLK COUNT(S) WRONG IN SUPERBLK SALVAGE? no SUMMARY INFORMATION BAD SALVAGE? no BLK(S) MISSING IN BIT MAPS SALVAGE? no 2 files, 2 used, 5076786 free (26 frags, 634595 blocks, 0.0% fragmentation)