On 2012-07-24 21:48 Christoph Hellwig <hch@xxxxxxxxxxxxx> Wrote: >On Tue, Jul 24, 2012 at 08:44:27PM +0800, majianpeng wrote: >> On 2012-05-29 16:56 majianpeng <majianpeng@xxxxxxxxx> Wrote: >> >The size of block-device is larger than 16TB, and the os is 32bit. >> >If the offset of read/write is larger then 16TB. The index of address_space will >> >overflow and supply data from low offset instead. > >We can't support > 16TB block device on 32-bit systems with 4k page >size, just like we can't support files that large. > >For filesystems the s_maxbytes limit of MAX_LFS_FILESIZE takes care of >that, but it seems like we miss that check for block devices. > >The proper fix is to add that check (either via s_maxbytes or by >checking MAX_LFS_FILESIZE) to generic_write_checks and >generic_file_aio_read (or a block device specific wrapper) > /* Page cache limit. The filesystems should put that into their s_maxbytes limits, otherwise bad things can happen in VM. */ #if BITS_PER_LONG==32 #define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) #elif BITS_PER_LONG==64 #define MAX_LFS_FILESIZE 0x7fffffffffffffffUL #endif If we used MAX_LFS_FILESIZE to limit the block-device, so in 32bit-os, the size of block is only 8T -1. But in function do_generic_file_read(): >>index = *ppos >> PAGE_CACHE_SHIFT; index is unsigned long type. So the ppos can 16T -1. But the comment said: >>/* Page cache limit. The filesystems should put that into their s_maxbytes >> limits, otherwise bad things can happen in VM. */ Why ? Thanks ! ?韬{.n???檩jg???a?旃???)钋???骅w+h?璀?y/i?⒏??⒎???Щ??m???)钋???痂?^??觥??ザ?v???O璁?f??i?⒏?