Received: from list by lists.gnu.org with archive (Exim 4.71) id 1cheCZ-0006t4-8h for mharc-grub-devel@gnu.org; Sat, 25 Feb 2017 10:24:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cheCW-0006sn-UD for grub-devel@gnu.org; Sat, 25 Feb 2017 10:24:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cheCT-0005Wo-LW for grub-devel@gnu.org; Sat, 25 Feb 2017 10:24:00 -0500 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:33299) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cheCT-0005Wc-Bw for grub-devel@gnu.org; Sat, 25 Feb 2017 10:23:57 -0500 Received: by mail-lf0-x234.google.com with SMTP id l12so19017082lfe.0 for ; Sat, 25 Feb 2017 07:23:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=+808Q1eqHUzS6cjobs0FubAoacI4+tYL84UtKm/h7ZM=; b=E6NU8YvwqZqGkbBxWAwB3MeSUQNCkrYzKHrGMXLdZxdC1NsjFXHib/Mm6VNyaXluiW BDPReHbV1dLCBoiWBPO6WJqFf8FUxLiIXppAn9F1aMElLt7CpGOIhBAjkQ3uMktWQ/LG oQsa6XziTZuxByMJS/sDlyprVXphMoXF0tfPcstmS46VSjuKvRsrDxcVWcqheVNRYEom ZDC/cRFYGhoKGOy39S0AgHmF21mRGtvzjGokBWf6fsEpF6oeFYto7uwxYFzyjxQ2F64E 5G7VgzGS0izmh5Ml3HeygdQlJkY82JiciE0BQO/dK006ykqDXIteRHaoSNmWG5KtgfSD x8qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=+808Q1eqHUzS6cjobs0FubAoacI4+tYL84UtKm/h7ZM=; b=sQTeyuSdofAbJRFGbKxSkPOZr8FVAEhaFcIspgS4pgV/D7He3YDzRY/tkXg/GLKVnk N1WDRtj0/uTb7lmKqTHcmxUMX5/qwZldYWam1kHVO854TZUjKVXSa6KIa2FJvkgt0OZq tQVz0i4ks0AKo/dRM0mbZVN1rd7X5q5IRQKB83EpQwsixh8U7OiOEAL/oGP0QULKEYUM dl+zXJWorCWg6KMB4GZHSKcF0Qutf55QrqrWTp+tflfqossj4Pa8i/I3BIEBbdisXcLw 15JFtBQpfnm6z/599dQ7m2aEUT2sbfXlq7xRBtZvx+K57EmBNpEBMYql654kg/Qdmn6a Ai8Q== X-Gm-Message-State: AMke39lGEYaw1EbsnKKqxX69ZBGLtIMdklrFSuc0OHTZQMMd4OG5YPYfdtDO/LBwSni+Gw== X-Received: by 10.25.159.16 with SMTP id i16mr2360538lfe.54.1488036235753; Sat, 25 Feb 2017 07:23:55 -0800 (PST) Received: from [192.168.1.6] (ppp109-252-90-129.pppoe.spdop.ru. [109.252.90.129]) by smtp.gmail.com with ESMTPSA id v13sm848868lfi.6.2017.02.25.07.23.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Feb 2017 07:23:55 -0800 (PST) Subject: Re: [PATCH] squash4: fix handling of fragments and sparse files To: grub-devel@gnu.org References: <9b1cfa75-4908-a49f-6186-981ea98ed115@gmail.com> <1487405803-2360-1-git-send-email-arvidjaar@gmail.com> <433d08cb-5793-9949-1aec-274ea8267fbd@gmail.com> From: Andrei Borzenkov Message-ID: <043cefd9-3f7c-16ce-a3f5-ff7d819adaf9@gmail.com> Date: Sat, 25 Feb 2017 18:23:54 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <433d08cb-5793-9949-1aec-274ea8267fbd@gmail.com> Content-Type: multipart/mixed; boundary="------------CA1A66B644574CB8058ECACD" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::234 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Feb 2017 15:24:02 -0000 This is a multi-part message in MIME format. --------------CA1A66B644574CB8058ECACD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 24.02.2017 19:19, Andrei Borzenkov пишет: >> How do you create those files reliably? Feel free to add any files to >> grub-fs-tester. Feel free to commit without tests, we can add tests later. >> > > I would say, we need to generally create less "nice" test files > > 1. Generate test files that are not exact multiple of filesystem block. > This would cover squash tail packing and may uncover similar issues in > other drivers as well. > > 2. Generate sparse files by seeking beyond end of file. We already had > similar problem with indirect ext* blocks that was not caught by tests. > We should produce holes both for direct and indirect blocks (we may pick > common offset or make it fs-specific if necessary). > > 3. We need to produce really small files also to test inlining. Again we > can pick common size or make it fs-specific. > > Assuming we generate files as described, for squash4 just call it with > -always-use-fragments to force tail packing. -nopad may be interesting > as well to stress our driver even more. > > Attached patch implements 1 + -always-use-fragments. It reliably causes squash4 test to fail without my patch. I can change BLOCKCNT for squash4 only, but I think it makes sense to do globally. sparse files need some tweaking in garbage-gen, will look into it. --------------CA1A66B644574CB8058ECACD Content-Type: text/x-patch; name="squash4-tests.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="squash4-tests.patch" From: Andrei Borzenkov Subject: [PATCH] grub-fs-tester: improve squash4 tests 1. Make sure files are not multiple of block size. This will ensure tail packing for squash4 and may also trigger more codes paths in other filesystems. 2. Call mksquashfs with -always-use-fragments to force tail packing. --- tests/util/grub-fs-tester.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in index f363d6f..a9771f3 100644 --- a/tests/util/grub-fs-tester.in +++ b/tests/util/grub-fs-tester.in @@ -913,6 +913,8 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + *) BLOCKCNT=5242880;; esac + # Make sure file is not exact multiple of block size + : $((BLOCKCNT--)) case x"$fs" in x"ntfscomp") setfattr -h -v 0x00000800 -n system.ntfs_attrib_be "$MNTPOINTRW/$OSDIR";; @@ -998,8 +1000,8 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + x"romfs") genromfs -V "$FSLABEL" -f "${FSIMAGES[0]}" -d "$MASTER" ;; xsquash4_*) - echo mksquashfs "$MASTER" "${FSIMAGES[0]}" -comp "${fs/squash4_/}" -b $BLKSIZE - mksquashfs "$MASTER" "${FSIMAGES[0]}" -comp "${fs/squash4_/}" -b $BLKSIZE ;; + echo mksquashfs "$MASTER" "${FSIMAGES[0]}" -always-use-fragments -nopad -comp "${fs/squash4_/}" -b $BLKSIZE + mksquashfs "$MASTER" "${FSIMAGES[0]}" -always-use-fragments -nopad -comp "${fs/squash4_/}" -b $BLKSIZE ;; x"bfs") sleep 1 fusermount -u "$MNTPOINTRW" -- tg: (892dfbe..) u/squash4-tests (depends on: master) --------------CA1A66B644574CB8058ECACD--