From: "Zhang, Hongchao" Subject: an issue of ext4 Date: Wed, 5 Mar 2014 12:33:32 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="_002_CF3D3A3F283Dhongchaozhangintelcom_" Cc: "Dilger, Andreas" , "linux-ext4@vger.kernel.org" To: "tytso@mit.edu" Return-path: Received: from mga02.intel.com ([134.134.136.20]:55389 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752100AbaCEMdg (ORCPT ); Wed, 5 Mar 2014 07:33:36 -0500 Content-Language: en-US Sender: linux-ext4-owner@vger.kernel.org List-ID: --_002_CF3D3A3F283Dhongchaozhangintelcom_ Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable Hi, in ext4_fill_super, the variables related to statfs should be initialized a= fter journal recovery is completed. otherwise, if a large number of blocks were being allocated before the file= system crashed, then the blocks and inode counters may become negative during use and report incorrect valu= es to statfs call. Thanks Hongchao --_002_CF3D3A3F283Dhongchaozhangintelcom_ Content-Type: application/octet-stream; name="statfs-issue.patch" Content-Description: statfs-issue.patch Content-Disposition: attachment; filename="statfs-issue.patch"; size=1737; creation-date="Wed, 05 Mar 2014 12:33:32 GMT"; modification-date="Wed, 05 Mar 2014 12:33:32 GMT" Content-ID: <2543D2D71710D34F88104305C90C0F18@intel.com> Content-Transfer-Encoding: base64 ZGlmZiAtcCAtdSBsaW51eC0zLjEzLjUub3JpZy9mcy9leHQ0L3N1cGVyLmMgbGludXgtMy4xMy41 L2ZzL2V4dDQvc3VwZXIuYwotLS0gbGludXgtMy4xMy41Lm9yaWcvZnMvZXh0NC9zdXBlci5jCisr KyBsaW51eC0zLjEzLjUvZnMvZXh0NC9zdXBlci5jCkBAIC0zODcxLDI3ICszODcxLDYgQEAgc3Rh dGljIGludCBleHQ0X2ZpbGxfc3VwZXIoc3RydWN0IHN1cGVyXwogCS8qIFJlZ2lzdGVyIGV4dGVu dCBzdGF0dXMgdHJlZSBzaHJp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WV4dDRfY291 bnRfZnJlZV9jbHVzdGVycyhzYikpOworCWlmICghZXJyKSB7CisJCWVyciA9IHBlcmNwdV9jb3Vu dGVyX2luaXQoJnNiaS0+c19mcmVlaW5vZGVzX2NvdW50ZXIsCisJCQkJZXh0NF9jb3VudF9mcmVl X2lub2RlcyhzYikpOworCX0KKwlpZiAoIWVycikgeworCQllcnIgPSBwZXJjcHVfY291bnRlcl9p bml0KCZzYmktPnNfZGlyc19jb3VudGVyLAorCQkJCWV4dDRfY291bnRfZGlycyhzYikpOworCX0K KwlpZiAoIWVycikgeworCQllcnIgPSBwZXJjcHVfY291bnRlcl9pbml0KCZzYmktPnNfZGlydHlj bHVzdGVyc19jb3VudGVyLCAwKTsKKwl9CisJaWYgKCFlcnIpIHsKKwkJZXJyID0gcGVyY3B1X2Nv dW50ZXJfaW5pdCgmc2JpLT5zX2V4dGVudF9jYWNoZV9jbnQsIDApOworCX0KKwlpZiAoZXJyKSB7 CisJCWV4dDRfbXNnKHNiLCBLRVJOX0VSUiwgImluc3VmZmljaWVudCBtZW1vcnkiKTsKKwkJZ290 byBmYWlsZWRfbW91bnQzOworCX0KKwogCWlmIChFWFQ0X0hBU19JTkNPTVBBVF9GRUFUVVJFKHNi LCBFWFQ0X0ZFQVRVUkVfSU5DT01QQVRfNjRCSVQpICYmCiAJICAgICFqYmQyX2pvdXJuYWxfc2V0 X2ZlYXR1cmVzKEVYVDRfU0Ioc2IpLT5zX2pvdXJuYWwsIDAsIDAsCiAJCQkJICAgICAgIEpCRDJf RkVBVFVSRV9JTkNPTVBBVF82NEJJVCkpIHsK --_002_CF3D3A3F283Dhongchaozhangintelcom_--