Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752701AbdHXKU2 (ORCPT ); Thu, 24 Aug 2017 06:20:28 -0400 Received: from wdc011.relay.arandomserver.com ([208.43.115.130]:58537 "EHLO wdc011.relay.arandomserver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751554AbdHXKUV (ORCPT ); Thu, 24 Aug 2017 06:20:21 -0400 Subject: Re: Kernels v4.9+ cause short reads of block devices To: Andreas Dilger , Linus Torvalds Cc: Al Viro , Linux Kernel Mailing List , Wei Fang , linux-fsdevel , Mark Fasheh , Joel Becker , Dave Kleikamp References: <1ae53e17-e455-4f17-0280-b0dae183a449@nazar.ca> From: Doug Nazar Message-ID: <75bc3c58-c699-f7f2-4fc2-a8e2aefeddb5@nazar.ca> Date: Thu, 24 Aug 2017 06:20:05 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Thunderbird/54.0a2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: 173.192.232.254 X-SpamExperts-Domain: wdc006.hawkhost.com X-SpamExperts-Username: relay Authentication-Results: arandomserver.com; auth=pass (login) smtp.auth=relay@wdc006.hawkhost.com X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.04) X-Recommended-Action: accept X-Filter-ID: PqwsvolAWURa0gwxuN3S5YEa3T7JuZT23fGO2rGt3ZiXrQymdGY8qNmNJwTfl2xJ192kNgbkumUo HMCUQ8HXGkAwPN4M+BNtq20Hh3O6Az8x54JCQSpSh9ixc9o3H3wVCZryIsNFvaBrlzs70sT7iKmx j3Zz/WM/IwRyPjIHIwADkw/Aelbw+5pdlZBsRNjJL5LHiCNyIuMYBZ07J8rOIh5e973vehgRRMJd d1x498TXjvP9AzEJVJsem/RJfnxwK7n9JUG0tkF/jEO0NY30aYoNYUbVrTtEe3GW4LV9k5TlgTl6 fJxyntEfhZCKje4ZEejqcvF9whXmqNO3rZfNMqIdXj9EdeaBLWNm5S1nFwnQ08vWrPDgMXSp0PD/ +0YjMeeCQkEqUofYsXPaNx98FfQeXbCuryvNiGYRcw2pVekSMBaNT3w80AsNCBGDGO97IEtG728p gJVaMtT8neN4serbNA2aSNJ3zapHOjLoiyHW5j/4CzrmNymzPa3B4u6viTf5rRxafI3VERBHrL3V 0w7knaJOHXyb74CkvMRWnDsj+EHzOAOcJGTZeiAp3tyaP9NmbLEzYUBlJj1Mw1Gk9U21bJJYEvQ+ mjkfiZQwN2Ycnj95DBfxzNqou21wZgZ/vfLvzYWTBDhTssaXQYgNf1fgqDNXxZTBdyz2DdhKjV2t I4g+l6rCWbY0MZcgnbHsF7a8xU3eZ693aRr6FKdtTEat6v5OMq1/dYjI7gDgNzTZD2uIfON/kRX7 ZplMWMlIQnTIgDfxZ2/WGqYvyOVteVOdo6Dvr8fbMJVJ9/erL6/4IvMfhB2h/z0m0D607pH+VXNB UORgL0uLRkDHuXSHidPXbq2a4s/zFvgNEngpi7ot0PoBYiEmrDsN7ePvCGIms97CLYoqc3ZnfZwj wvluSuKzs9Yq0B+1Oib5A/jMFxotdqgpPMsqDaq4fet1H0lBoLJ9onZQlGkzfzJE/lh06cevS9dk bmuqFg5WgMK810Zxbnk/weVmnW9NBckaDXjBYCTwuapYHJC4Tg2AsI28yvwZX3ClPmHYCrTsUXTc QkdtV+jo8MKtaDx3m3wb6tFP+Llyif8VudsrJLYWDoF6R0BED+MkntG6EfGPDiYucqpi9/qZ5FKN PSXHUV7en3JbDJKayXVo2A0DPawkWPB6dg== X-Report-Abuse-To: spam@se001.arandomserver.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1589 Lines: 38 On 8/23/17 5:01 PM, Andreas Dilger wrote: > Doug, > I noticed while checking for other implications of changing MAX_LFS_FILESIZE > that fs/jfs/super.c is also working around this limit. If you are going > to submit a patch for this, it also makes sense to fix jfs_fill_super() to > use MAX_LFS_FILESIZE instead of JFS rolling its own, something like: > > /* logical blocks are represented by 40 bits in pxd_t, etc. > * and page cache is indexed by long. */ > sb->s_maxbytes = min((u64)sb->s_blocksize) << 40, > MAX_LFS_FILESIZE); > > It also looks like ocfs2_max_file_offset() is trying to avoid overflowing > the old 31-bit limit, and isn't using MAX_LFS_FILESIZE directly, so it will > now be wrong. It looks like it could use "bitshift = 32; trim = bytes;", > but Joel or Mark should confirm. > > Finally, there is a check in fs/super.c::mount_fs() that is verifying > s_maxbytes is not set too large, but this has been present since 2.6.32 > and should probably be removed at this point, or changed to a BUG_ON() > (see commit 42cb56ae2ab for details). I don't have any issue trying to write patches for those, but I have no domain knowledge in the area or any way to test them. From a quick glance, jfs is locked to PSIZE (4096) so should be ok. OCFS looks a little complex, and since it's a shared fs, little hesitant. The check in fs/super.c, maybe that should be: sb->s_maxbytes > MAX_LFS_FILESIZE Actually, little confused, the comment says unsigned, but loff_t looks like its long long. Maybe cast to u64 and check greater than? Doug