Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp130785imm; Tue, 7 Aug 2018 15:26:04 -0700 (PDT) X-Google-Smtp-Source: AA+uWPylaAuZ6+r9gS6u0R8TE3bHNRFTFarmyaWpS4KiZOEmF04eOWWl9xgjyqT60+gYSoLUAMvV X-Received: by 2002:a63:5a13:: with SMTP id o19-v6mr182429pgb.195.1533680764773; Tue, 07 Aug 2018 15:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533680764; cv=none; d=google.com; s=arc-20160816; b=ezDGqbqFb1wkovRaYUBWKfqkgxoDS7KcpjEKqreY/b9MPcdy/8DwkNUyVFDMjEZnHK RcnumZ8QMpdVN5VeYL8mup3TfXgWtKpd93+K9kcdh7FXI6fh1uiQyImN09F0HpwLIchN 73uEHzWAvL1yTLZCLWba5D/ALmvnxNMDwWpyRINiPvoez53FAdTAbbfWZW1DUxGaSqtL vdnarLX4TXB0ENVo4LzuH2Ss9WyNYE5OirxviyTM08e1YByqNeIzXfqbf7BXu2s/+mlq CL4e1gnugPYS1uTY6GKHbaqWNrl2eSd9IZCALvQkOWmPtI0G+U29jiCKb6zymsiaf9n8 6kAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :arc-authentication-results; bh=ExMTFS2SlX9j2aqoxZ4CYwP2wjwF3NmQTlXXLkiZbv8=; b=g54KhcIbihX/TVIlBPDfRtFW6aP5sIL1MkPT+L93hLki0mjvrItOBRxr+KYu79drra YCOYC1JB4fC2NFB8FooGcy6xiMHjo/dfTeZubRmEHDYS4iR+a8EpdLYIA3NzcNST6W8y oUZ8qZ2VbOsWqYLx/3BDDa/19/XBza5irtB6DKnQbmnPzUStsQGbYVA7xPV+f6rl6Pw5 PKS+Uzwh9HCEEDFkS5Z2Dr3mbEQpF2Vonng/SOnrjih0HM3Bqba4bUY/OXWIaxh2bEwR /JjgrcX+4XN7n1RsccTK0yZJDheUeSvaPoOgIEvz+ypEU7G0X8+ECQZRyCtIpN3pvXSG C6oA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n24-v6si2564231pgb.665.2018.08.07.15.25.50; Tue, 07 Aug 2018 15:26:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726893AbeHHAld (ORCPT + 99 others); Tue, 7 Aug 2018 20:41:33 -0400 Received: from orthanc.universe-factory.net ([104.238.176.138]:54450 "EHLO orthanc.universe-factory.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbeHHAld (ORCPT ); Tue, 7 Aug 2018 20:41:33 -0400 X-Greylist: delayed 459 seconds by postgrey-1.27 at vger.kernel.org; Tue, 07 Aug 2018 20:41:30 EDT Received: from [IPv6:2001:19f0:6c01:100::2] (unknown [IPv6:2001:19f0:6c01:100::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by orthanc.universe-factory.net (Postfix) with ESMTPSA id A0DFF1F627; Wed, 8 Aug 2018 00:17:20 +0200 (CEST) Subject: Re: [PATCH 4.14 222/246] ext4: fix check to prevent initializing reserved inodes To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Eric Whitney , Theodore Tso References: <20180801165011.700991984@linuxfoundation.org> <20180801165022.329322870@linuxfoundation.org> From: Matthias Schiffer Openpgp: preference=signencrypt Autocrypt: addr=mschiffer@universe-factory.net; prefer-encrypt=mutual; keydata= xsFNBFLNIUUBEADtyPGKZY/BVjqAp68oV5xpY557+KDgXN4jDrdtANDDMjIDakbXAD1A1zqX LUREvXMsKA/vacGF2I4/0kwsQhNeOzhGPsBa8y785WFQjxq4LsBJpC4QfDvcheIl4BeKoHzf UYDp4hgPBrKcaRRoBODMwp1FZmJxhRVtiQ2m6piemksF1Wpx+6wZlcw4YhQdEnw7QZByYYgA Bv7ZoxSQZzyeR/Py0G5/zg9ABLcTF56UWq+ZkiLEMg/5K5hzUKLYC4h/xNV58mNHBho0k/D4 jPmCjXy7bouDzKZjnu+CIsMoW9RjGH393GNCc+F3Xuo35g3L4lZ89AdNhZ0zeMLJCTx5uYOQ N5YZP2eHW2PlVZpwtDOR0zWoy1c0q6DniYtn0HGStVLuP+MQxuRe2RloJE7fDRfz7/OfOU6m BVkRyMCCPwWYXyEs2y8m4akXDvBCPTNMMEPRIy3qcAN4HnOrmnc24qfQzYp9ajFt1YrXMqQy SQgcTzuVYkYVnEMFBhN6P2EKoKU+6Mee01UFb7Ww8atiqG3U0oxsXbOIVLrrno6JONdYeAvy YuZbAxJivU3/RkGLSygZV53EUCfyoNldDuUL7Gujtn/R2/CsBPM+RH8oOVuh3od2Frf0PP8p 9yYoa2RD7PfX4WXdNfYv0OWgFgpz0leup9xhoUNE9RknpbLlUwARAQABzTJNYXR0aGlhcyBT Y2hpZmZlciA8bXNjaGlmZmVyQHVuaXZlcnNlLWZhY3RvcnkubmV0PsLBlwQTAQoAQQIbAwUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBGZk572mtmmIHsUudRbvP2TLIB2cBQJbadyu BQkMXyJpAAoJEBbvP2TLIB2cnZ8P/09MRF+62+0dgBVwYAHUUrNSuY6gAQZ1BPnjgG7hJqZx WbCxAxJzqT0sqyuNiIoocOOX32aOaV6Gr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 2018 00:17:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180801165022.329322870@linuxfoundation.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="0p6Rx2lXy1GO57c4J9dGs6YQzfSXg3D5e" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --0p6Rx2lXy1GO57c4J9dGs6YQzfSXg3D5e Content-Type: multipart/mixed; boundary="P1nSmdVm3pEvIydrOOrBtjiIk4qjFrfC0"; protected-headers="v1" From: Matthias Schiffer To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Eric Whitney , Theodore Tso Message-ID: <0360c726-c139-345b-a478-82b33a7aa804@universe-factory.net> Subject: Re: [PATCH 4.14 222/246] ext4: fix check to prevent initializing reserved inodes References: <20180801165011.700991984@linuxfoundation.org> <20180801165022.329322870@linuxfoundation.org> In-Reply-To: <20180801165022.329322870@linuxfoundation.org> --P1nSmdVm3pEvIydrOOrBtjiIk4qjFrfC0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: quoted-printable On 08/01/2018 06:52 PM, Greg Kroah-Hartman wrote: > 4.14-stable review patch. If anyone has any objections, please let me = know. It seems this patch is still missing from the 4.4.y and 4.9.y branches. Matthias >=20 > ------------------ >=20 > From: Theodore Ts'o >=20 > commit 5012284700775a4e6e3fbe7eac4c543c4874b559 upstream. >=20 > Commit 8844618d8aa7: "ext4: only look at the bg_flags field if it is > valid" will complain if block group zero does not have the > EXT4_BG_INODE_ZEROED flag set. Unfortunately, this is not correct, > since a freshly created file system has this flag cleared. It gets > almost immediately after the file system is mounted read-write --- but > the following somewhat unlikely sequence will end up triggering a > false positive report of a corrupted file system: >=20 > mkfs.ext4 /dev/vdc > mount -o ro /dev/vdc /vdc > mount -o remount,rw /dev/vdc >=20 > Instead, when initializing the inode table for block group zero, test > to make sure that itable_unused count is not too large, since that is > the case that will result in some or all of the reserved inodes > getting cleared. >=20 > This fixes the failures reported by Eric Whiteney when running > generic/230 and generic/231 in the the nojournal test case. >=20 > Fixes: 8844618d8aa7 ("ext4: only look at the bg_flags field if it is va= lid") > Reported-by: Eric Whitney > Signed-off-by: Theodore Ts'o > Signed-off-by: Greg Kroah-Hartman >=20 > --- > fs/ext4/ialloc.c | 5 ++++- > fs/ext4/super.c | 8 +------- > 2 files changed, 5 insertions(+), 8 deletions(-) >=20 > --- a/fs/ext4/ialloc.c > +++ b/fs/ext4/ialloc.c > @@ -1397,7 +1397,10 @@ int ext4_init_inode_table(struct super_b > ext4_itable_unused_count(sb, gdp)), > sbi->s_inodes_per_block); > =20 > - if ((used_blks < 0) || (used_blks > sbi->s_itb_per_group)) { > + if ((used_blks < 0) || (used_blks > sbi->s_itb_per_group) || > + ((group =3D=3D 0) && ((EXT4_INODES_PER_GROUP(sb) - > + ext4_itable_unused_count(sb, gdp)) < > + EXT4_FIRST_INO(sb)))) { > ext4_error(sb, "Something is wrong with group %u: " > "used itable blocks: %d; " > "itable unused count: %u", > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -3103,14 +3103,8 @@ static ext4_group_t ext4_has_uninit_itab > if (!gdp) > continue; > =20 > - if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED)) > - continue; > - if (group !=3D 0) > + if (!(gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED))) > break; > - ext4_error(sb, "Inode table for bg 0 marked as " > - "needing zeroing"); > - if (sb_rdonly(sb)) > - return ngroups; > } > =20 > return group; >=20 >=20 --P1nSmdVm3pEvIydrOOrBtjiIk4qjFrfC0-- --0p6Rx2lXy1GO57c4J9dGs6YQzfSXg3D5e Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEZmTnvaa2aYgexS51Fu8/ZMsgHZwFAltqGnoACgkQFu8/ZMsg HZxLfBAA28d0lfOeipTqOn2rqS9QUJ0oAtXKsHl+wO4mptLQob3+x25nYtsvnksO t1AUMpHJThRXn6asDhZyTsP43D42eezQxZyfIjbzCz4Btx200wHiFmuTE0rAc9gL qi22jjWXjQA0/KUTDA6o+Qs9nikrQSHMEk0EaE2Oq1OJPBZcBpim/KERCdbpMl1N 1S19lylk1eydM6GLi7UmQb2V4C+mr5MEZrtc9V6mo/GymsKZrG3SABjERME+ciEQ HOSfUDrjtMGUxgea+Sy/z+3b1AvEjIfPagkre2kvyz951CkSOuCi//wvA4X1akQY kQ5qg9bu43Mhe4d3DXGbAKPZUjrv1QSRYKu2nYVSuguMZ793KEKdQ5hRLE26zAoD j6PPnh4ieiyllnxdTOQH36IAvP1OQgDt+C0U38jfysC7F9tzxjqjpLrOAiVd1icZ nq1r7fI4HiltMn0FBE0/UsRf+LDM6azRlCjDoBoxUHkkSblQLo3tuYCP4HsO7sm5 KOs/o19Oot0MQKEgrDDzOZ11sUkYhDd7/xaKdlAPQpHsjUlIk/3bcE6/HGWC82O2 BFQIjSbcCb+5pcSLqcFUxClWTKTfjB/OBfgKi6h4TevQVLdg5ygszOtn/TGYflEL SqB5HTP+PoWZQD20sMdZxxEVLdd1ZXQglPHgEu9mJMJb6bfViG0= =JbDc -----END PGP SIGNATURE----- --0p6Rx2lXy1GO57c4J9dGs6YQzfSXg3D5e--