Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag '5.8-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
"Six cifs/smb3 fixes, three of them for stable.

Fixes xfstests 451, 313 and 316"

* tag '5.8-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
cifs: misc: Use array_size() in if-statement controlling expression
cifs: update ctime and mtime during truncate
cifs/smb3: Fix data inconsistent when punch hole
cifs/smb3: Fix data inconsistent when zero file range
cifs: Fix double add page to memcg when cifs_readpages
cifs: Fix cached_fid refcnt leak in open_shroot

+35 -13
+7 -4
fs/cifs/file.c
··· 4336 4336 break; 4337 4337 4338 4338 __SetPageLocked(page); 4339 - if (add_to_page_cache_locked(page, mapping, page->index, gfp)) { 4339 + rc = add_to_page_cache_locked(page, mapping, page->index, gfp); 4340 + if (rc) { 4340 4341 __ClearPageLocked(page); 4341 4342 break; 4342 4343 } ··· 4353 4352 struct list_head *page_list, unsigned num_pages) 4354 4353 { 4355 4354 int rc; 4355 + int err = 0; 4356 4356 struct list_head tmplist; 4357 4357 struct cifsFileInfo *open_file = file->private_data; 4358 4358 struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file); ··· 4398 4396 * the order of declining indexes. When we put the pages in 4399 4397 * the rdata->pages, then we want them in increasing order. 4400 4398 */ 4401 - while (!list_empty(page_list)) { 4399 + while (!list_empty(page_list) && !err) { 4402 4400 unsigned int i, nr_pages, bytes, rsize; 4403 4401 loff_t offset; 4404 4402 struct page *page, *tpage; ··· 4431 4429 return 0; 4432 4430 } 4433 4431 4434 - rc = readpages_get_pages(mapping, page_list, rsize, &tmplist, 4432 + nr_pages = 0; 4433 + err = readpages_get_pages(mapping, page_list, rsize, &tmplist, 4435 4434 &nr_pages, &offset, &bytes); 4436 - if (rc) { 4435 + if (!nr_pages) { 4437 4436 add_credits_and_wake_if(server, credits, 0); 4438 4437 break; 4439 4438 }
+9
fs/cifs/inode.c
··· 2535 2535 if (rc == 0) { 2536 2536 cifsInode->server_eof = attrs->ia_size; 2537 2537 cifs_setsize(inode, attrs->ia_size); 2538 + 2539 + /* 2540 + * The man page of truncate says if the size changed, 2541 + * then the st_ctime and st_mtime fields for the file 2542 + * are updated. 2543 + */ 2544 + attrs->ia_ctime = attrs->ia_mtime = current_time(inode); 2545 + attrs->ia_valid |= ATTR_CTIME | ATTR_MTIME; 2546 + 2538 2547 cifs_truncate_page(inode->i_mapping, inode->i_size); 2539 2548 } 2540 2549
+7 -9
fs/cifs/misc.c
··· 844 844 struct bio_vec *bv = NULL; 845 845 846 846 if (iov_iter_is_kvec(iter)) { 847 - memcpy(&ctx->iter, iter, sizeof(struct iov_iter)); 847 + memcpy(&ctx->iter, iter, sizeof(*iter)); 848 848 ctx->len = count; 849 849 iov_iter_advance(iter, count); 850 850 return 0; 851 851 } 852 852 853 - if (max_pages * sizeof(struct bio_vec) <= CIFS_AIO_KMALLOC_LIMIT) 854 - bv = kmalloc_array(max_pages, sizeof(struct bio_vec), 855 - GFP_KERNEL); 853 + if (array_size(max_pages, sizeof(*bv)) <= CIFS_AIO_KMALLOC_LIMIT) 854 + bv = kmalloc_array(max_pages, sizeof(*bv), GFP_KERNEL); 856 855 857 856 if (!bv) { 858 - bv = vmalloc(array_size(max_pages, sizeof(struct bio_vec))); 857 + bv = vmalloc(array_size(max_pages, sizeof(*bv))); 859 858 if (!bv) 860 859 return -ENOMEM; 861 860 } 862 861 863 - if (max_pages * sizeof(struct page *) <= CIFS_AIO_KMALLOC_LIMIT) 864 - pages = kmalloc_array(max_pages, sizeof(struct page *), 865 - GFP_KERNEL); 862 + if (array_size(max_pages, sizeof(*pages)) <= CIFS_AIO_KMALLOC_LIMIT) 863 + pages = kmalloc_array(max_pages, sizeof(*pages), GFP_KERNEL); 866 864 867 865 if (!pages) { 868 - pages = vmalloc(array_size(max_pages, sizeof(struct page *))); 866 + pages = vmalloc(array_size(max_pages, sizeof(*pages))); 869 867 if (!pages) { 870 868 kvfree(bv); 871 869 return -ENOMEM;
+12
fs/cifs/smb2ops.c
··· 763 763 /* close extra handle outside of crit sec */ 764 764 SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); 765 765 } 766 + rc = 0; 766 767 goto oshr_free; 767 768 } 768 769 ··· 3188 3187 trace_smb3_zero_enter(xid, cfile->fid.persistent_fid, tcon->tid, 3189 3188 ses->Suid, offset, len); 3190 3189 3190 + /* 3191 + * We zero the range through ioctl, so we need remove the page caches 3192 + * first, otherwise the data may be inconsistent with the server. 3193 + */ 3194 + truncate_pagecache_range(inode, offset, offset + len - 1); 3191 3195 3192 3196 /* if file not oplocked can't be sure whether asking to extend size */ 3193 3197 if (!CIFS_CACHE_READ(cifsi)) ··· 3258 3252 free_xid(xid); 3259 3253 return rc; 3260 3254 } 3255 + 3256 + /* 3257 + * We implement the punch hole through ioctl, so we need remove the page 3258 + * caches first, otherwise the data may be inconsistent with the server. 3259 + */ 3260 + truncate_pagecache_range(inode, offset, offset + len - 1); 3261 3261 3262 3262 cifs_dbg(FYI, "Offset %lld len %lld\n", offset, len); 3263 3263