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

Merge branch 'xfs-misc-fixes-for-3.18-2' into for-next

+71 -14
-1
fs/xfs/libxfs/xfs_da_format.c
··· 270 270 { 271 271 __uint8_t ftype = dep->name[dep->namelen]; 272 272 273 - ASSERT(ftype < XFS_DIR3_FT_MAX); 274 273 if (ftype >= XFS_DIR3_FT_MAX) 275 274 return XFS_DIR3_FT_UNKNOWN; 276 275 return ftype;
+1 -1
fs/xfs/xfs_bmap_util.c
··· 1646 1646 return 0; 1647 1647 } 1648 1648 1649 - int 1649 + static int 1650 1650 xfs_swap_extent_flush( 1651 1651 struct xfs_inode *ip) 1652 1652 {
+1 -1
fs/xfs/xfs_buf_item.c
··· 501 501 * buffer being bad.. 502 502 */ 503 503 504 - DEFINE_RATELIMIT_STATE(xfs_buf_write_fail_rl_state, 30 * HZ, 10); 504 + static DEFINE_RATELIMIT_STATE(xfs_buf_write_fail_rl_state, 30 * HZ, 10); 505 505 506 506 STATIC uint 507 507 xfs_buf_item_push(
-1
fs/xfs/xfs_icache.c
··· 33 33 #include "xfs_trace.h" 34 34 #include "xfs_icache.h" 35 35 #include "xfs_bmap_util.h" 36 - #include "xfs_quota.h" 37 36 #include "xfs_dquot_item.h" 38 37 #include "xfs_dquot.h" 39 38
+30
fs/xfs/xfs_iops.c
··· 849 849 return error; 850 850 truncate_setsize(inode, newsize); 851 851 852 + /* 853 + * The "we can't serialise against page faults" pain gets worse. 854 + * 855 + * If the file is mapped then we have to clean the page at the old EOF 856 + * when extending the file. Extending the file can expose changes the 857 + * underlying page mapping (e.g. from beyond EOF to a hole or 858 + * unwritten), and so on the next attempt to write to that page we need 859 + * to remap it for write. i.e. we need .page_mkwrite() to be called. 860 + * Hence we need to clean the page to clean the pte and so a new write 861 + * fault will be triggered appropriately. 862 + * 863 + * If we do it before we change the inode size, then we can race with a 864 + * page fault that maps the page with exactly the same problem. If we do 865 + * it after we change the file size, then a new page fault can come in 866 + * and allocate space before we've run the rest of the truncate 867 + * transaction. That's kinda grotesque, but it's better than have data 868 + * over a hole, and so that's the lesser evil that has been chosen here. 869 + * 870 + * The real solution, however, is to have some mechanism for locking out 871 + * page faults while a truncate is in progress. 872 + */ 873 + if (newsize > oldsize && mapping_mapped(VFS_I(ip)->i_mapping)) { 874 + error = filemap_write_and_wait_range( 875 + VFS_I(ip)->i_mapping, 876 + round_down(oldsize, PAGE_CACHE_SIZE), 877 + round_up(oldsize, PAGE_CACHE_SIZE) - 1); 878 + if (error) 879 + return error; 880 + } 881 + 852 882 tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_SIZE); 853 883 error = xfs_trans_reserve(tp, &M_RES(mp)->tr_itruncate, 0, 0); 854 884 if (error)
+38 -9
fs/xfs/xfs_log_cil.c
··· 463 463 spin_unlock(&cil->xc_push_lock); 464 464 goto out_skip; 465 465 } 466 - spin_unlock(&cil->xc_push_lock); 467 466 468 467 469 468 /* check for a previously pushed seqeunce */ 470 - if (push_seq < cil->xc_ctx->sequence) 469 + if (push_seq < cil->xc_ctx->sequence) { 470 + spin_unlock(&cil->xc_push_lock); 471 471 goto out_skip; 472 + } 473 + 474 + /* 475 + * We are now going to push this context, so add it to the committing 476 + * list before we do anything else. This ensures that anyone waiting on 477 + * this push can easily detect the difference between a "push in 478 + * progress" and "CIL is empty, nothing to do". 479 + * 480 + * IOWs, a wait loop can now check for: 481 + * the current sequence not being found on the committing list; 482 + * an empty CIL; and 483 + * an unchanged sequence number 484 + * to detect a push that had nothing to do and therefore does not need 485 + * waiting on. If the CIL is not empty, we get put on the committing 486 + * list before emptying the CIL and bumping the sequence number. Hence 487 + * an empty CIL and an unchanged sequence number means we jumped out 488 + * above after doing nothing. 489 + * 490 + * Hence the waiter will either find the commit sequence on the 491 + * committing list or the sequence number will be unchanged and the CIL 492 + * still dirty. In that latter case, the push has not yet started, and 493 + * so the waiter will have to continue trying to check the CIL 494 + * committing list until it is found. In extreme cases of delay, the 495 + * sequence may fully commit between the attempts the wait makes to wait 496 + * on the commit sequence. 497 + */ 498 + list_add(&ctx->committing, &cil->xc_committing); 499 + spin_unlock(&cil->xc_push_lock); 472 500 473 501 /* 474 502 * pull all the log vectors off the items in the CIL, and ··· 560 532 */ 561 533 spin_lock(&cil->xc_push_lock); 562 534 cil->xc_current_sequence = new_ctx->sequence; 563 - list_add(&ctx->committing, &cil->xc_committing); 564 535 spin_unlock(&cil->xc_push_lock); 565 536 up_write(&cil->xc_ctx_lock); 566 537 ··· 882 855 * Hence by the time we have got here it our sequence may not have been 883 856 * pushed yet. This is true if the current sequence still matches the 884 857 * push sequence after the above wait loop and the CIL still contains 885 - * dirty objects. 858 + * dirty objects. This is guaranteed by the push code first adding the 859 + * context to the committing list before emptying the CIL. 886 860 * 887 - * When the push occurs, it will empty the CIL and atomically increment 888 - * the currect sequence past the push sequence and move it into the 889 - * committing list. Of course, if the CIL is clean at the time of the 890 - * push, it won't have pushed the CIL at all, so in that case we should 891 - * try the push for this sequence again from the start just in case. 861 + * Hence if we don't find the context in the committing list and the 862 + * current sequence number is unchanged then the CIL contents are 863 + * significant. If the CIL is empty, if means there was nothing to push 864 + * and that means there is nothing to wait for. If the CIL is not empty, 865 + * it means we haven't yet started the push, because if it had started 866 + * we would have found the context on the committing list. 892 867 */ 893 868 if (sequence == cil->xc_current_sequence && 894 869 !list_empty(&cil->xc_cil)) {
+1 -1
fs/xfs/xfs_rtalloc.c
··· 46 46 * Keeps track of a current summary block, so we don't keep reading 47 47 * it from the buffer cache. 48 48 */ 49 - int 49 + static int 50 50 xfs_rtget_summary( 51 51 xfs_mount_t *mp, /* file system mount structure */ 52 52 xfs_trans_t *tp, /* transaction pointer */