Details
-
Bug
-
Resolution: Fixed
-
Major
-
Lustre 2.8.0
-
3
-
9223372036854775807
Description
See the !HAVE_LDISKFS_MAP_BLOCKS version of osd_ldiskfs_map_ext_inode_pages(). The extent_max_page_index comparison is not applied to the first page in the IO and IIUC the comparison should be against fp->index + clen rather than fp->index + i.
static int osd_ldiskfs_map_ext_inode_pages(struct inode *inode, struct page **page, int pages, unsigned long *blocks, int create) { int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits; int rc = 0, i = 0; struct page *fp = NULL; int clen = 0; pgoff_t extent_max_page_index; extent_max_page_index = inode->i_sb->s_maxbytes >> PAGE_SHIFT; CDEBUG(D_OTHER, "inode %lu: map %d pages from %lu\n", inode->i_ino, pages, (*page)->index); /* pages are sorted already. so, we just have to find * contig. space and process them properly */ while (i < pages) { if (fp == NULL) { /* start new extent */ fp = *page++; clen = 1; i++; continue; } else if (fp->index + clen == (*page)->index) { /* continue the extent */ page++; clen++; i++; continue; } if (fp->index + i >= extent_max_page_index) GOTO(cleanup, rc = -EFBIG);
The other version of osd_ldiskfs_map_inode_pages() looks better but also uses i instead of clen.
In practice this is OK because clients respect llli_maxbytes/lsm_maxbytes/ocd_maxbytes. If client checks are disabled then it's easy to submit IOs that exceed the 16T - 4K limits and cause LBUGs in osd_do_bio(). However dynamic layouts and HSM restore introduce TOCTTOU issues with lli_maxbytes based checks.
Attachments
Issue Links
- is duplicated by
-
LU-3732 osd_io.c:320:osd_do_bio()) ASSERTION( iobuf->dr_rw == 0 ) failed: page_idx 4, block_idx 4, i 0
- Closed