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 'gfs2-v5.19-rc4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 updates from Andreas Gruenbacher:

- Instantiate glocks ouside of the glock state engine, in the contect
of the process taking the glock. This moves unnecessary complexity
out of the core glock code. Clean up the instantiate logic to be more
sensible.

- In gfs2_glock_async_wait(), cancel pending locking request upon
failure. Make sure all glocks are left in a consistent state.

- Various other minor cleanups and fixes.

* tag 'gfs2-v5.19-rc4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
gfs2: List traversal in do_promote is safe
gfs2: do_promote glock holder stealing fix
gfs2: Use better variable name
gfs2: Make go_instantiate take a glock
gfs2: Add new go_held glock operation
gfs2: Revert 'Fix "truncate in progress" hang'
gfs2: Instantiate glocks ouside of glock state engine
gfs2: Fix up gfs2_glock_async_wait
gfs2: Minor gfs2_glock_nq_m cleanup
gfs2: Fix spelling mistake in comment
gfs2: Rewrap overlong comment in do_promote
gfs2: Remove redundant NULL check before kfree

+116 -192
+1 -1
fs/gfs2/dir.c
··· 2016 2016 l_blocks++; 2017 2017 } 2018 2018 2019 - gfs2_rlist_alloc(&rlist); 2019 + gfs2_rlist_alloc(&rlist, LM_ST_EXCLUSIVE, LM_FLAG_NODE_SCOPE); 2020 2020 2021 2021 for (x = 0; x < rlist.rl_rgrps; x++) { 2022 2022 struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(rlist.rl_ghs[x].gh_gl);
+1 -2
fs/gfs2/file.c
··· 1066 1066 gfs2_glock_dq(gh); 1067 1067 out_uninit: 1068 1068 gfs2_holder_uninit(gh); 1069 - if (statfs_gh) 1070 - kfree(statfs_gh); 1069 + kfree(statfs_gh); 1071 1070 from->count = orig_count - written; 1072 1071 return written ? written : ret; 1073 1072 }
+82 -128
fs/gfs2/glock.c
··· 405 405 /** 406 406 * demote_incompat_holders - demote incompatible demoteable holders 407 407 * @gl: the glock we want to promote 408 - * @new_gh: the new holder to be promoted 408 + * @current_gh: the newly promoted holder 409 + * 410 + * We're passing the newly promoted holder in @current_gh, but actually, any of 411 + * the strong holders would do. 409 412 */ 410 413 static void demote_incompat_holders(struct gfs2_glock *gl, 411 - struct gfs2_holder *new_gh) 414 + struct gfs2_holder *current_gh) 412 415 { 413 416 struct gfs2_holder *gh, *tmp; 414 417 ··· 427 424 */ 428 425 if (!test_bit(HIF_HOLDER, &gh->gh_iflags)) 429 426 return; 427 + if (gh == current_gh) 428 + continue; 430 429 if (test_bit(HIF_MAY_DEMOTE, &gh->gh_iflags) && 431 - !may_grant(gl, new_gh, gh)) { 430 + !may_grant(gl, current_gh, gh)) { 432 431 /* 433 432 * We should not recurse into do_promote because 434 433 * __gfs2_glock_dq only calls handle_callback, ··· 483 478 * gfs2_instantiate - Call the glops instantiate function 484 479 * @gh: The glock holder 485 480 * 486 - * Returns: 0 if instantiate was successful, 2 if type specific operation is 487 - * underway, or error. 481 + * Returns: 0 if instantiate was successful, or error. 488 482 */ 489 483 int gfs2_instantiate(struct gfs2_holder *gh) 490 484 { ··· 493 489 494 490 again: 495 491 if (!test_bit(GLF_INSTANTIATE_NEEDED, &gl->gl_flags)) 496 - return 0; 492 + goto done; 497 493 498 494 /* 499 495 * Since we unlock the lockref lock, we set a flag to indicate ··· 512 508 goto again; 513 509 } 514 510 515 - ret = glops->go_instantiate(gh); 511 + ret = glops->go_instantiate(gl); 516 512 if (!ret) 517 513 clear_bit(GLF_INSTANTIATE_NEEDED, &gl->gl_flags); 518 514 clear_and_wake_up_bit(GLF_INSTANTIATE_IN_PROG, &gl->gl_flags); 519 - return ret; 515 + if (ret) 516 + return ret; 517 + 518 + done: 519 + if (glops->go_held) 520 + return glops->go_held(gh); 521 + return 0; 520 522 } 521 523 522 524 /** 523 525 * do_promote - promote as many requests as possible on the current queue 524 526 * @gl: The glock 525 527 * 526 - * Returns: 1 if there is a blocked holder at the head of the list, or 2 527 - * if a type specific operation is underway. 528 + * Returns: 1 if there is a blocked holder at the head of the list 528 529 */ 529 530 530 531 static int do_promote(struct gfs2_glock *gl) 531 - __releases(&gl->gl_lockref.lock) 532 - __acquires(&gl->gl_lockref.lock) 533 532 { 534 - struct gfs2_holder *gh, *tmp, *first_gh; 533 + struct gfs2_holder *gh, *current_gh; 535 534 bool incompat_holders_demoted = false; 536 - bool lock_released; 537 - int ret; 538 535 539 - restart: 540 - first_gh = find_first_strong_holder(gl); 541 - list_for_each_entry_safe(gh, tmp, &gl->gl_holders, gh_list) { 542 - lock_released = false; 536 + current_gh = find_first_strong_holder(gl); 537 + list_for_each_entry(gh, &gl->gl_holders, gh_list) { 543 538 if (test_bit(HIF_HOLDER, &gh->gh_iflags)) 544 539 continue; 545 - if (!may_grant(gl, first_gh, gh)) { 540 + if (!may_grant(gl, current_gh, gh)) { 546 541 /* 547 - * If we get here, it means we may not grant this holder for 548 - * some reason. If this holder is the head of the list, it 549 - * means we have a blocked holder at the head, so return 1. 542 + * If we get here, it means we may not grant this 543 + * holder for some reason. If this holder is at the 544 + * head of the list, it means we have a blocked holder 545 + * at the head, so return 1. 550 546 */ 551 547 if (list_is_first(&gh->gh_list, &gl->gl_holders)) 552 548 return 1; 553 549 do_error(gl, 0); 554 550 break; 555 551 } 556 - if (!incompat_holders_demoted) { 557 - demote_incompat_holders(gl, first_gh); 558 - incompat_holders_demoted = true; 559 - first_gh = gh; 560 - } 561 - if (test_bit(GLF_INSTANTIATE_NEEDED, &gl->gl_flags) && 562 - !(gh->gh_flags & GL_SKIP) && gl->gl_ops->go_instantiate) { 563 - lock_released = true; 564 - spin_unlock(&gl->gl_lockref.lock); 565 - ret = gfs2_instantiate(gh); 566 - spin_lock(&gl->gl_lockref.lock); 567 - if (ret) { 568 - if (ret == 1) 569 - return 2; 570 - gh->gh_error = ret; 571 - list_del_init(&gh->gh_list); 572 - trace_gfs2_glock_queue(gh, 0); 573 - gfs2_holder_wake(gh); 574 - goto restart; 575 - } 576 - } 577 552 set_bit(HIF_HOLDER, &gh->gh_iflags); 578 553 trace_gfs2_promote(gh); 579 554 gfs2_holder_wake(gh); 580 - /* 581 - * If we released the gl_lockref.lock the holders list may have 582 - * changed. For that reason, we start again at the start of 583 - * the holders queue. 584 - */ 585 - if (lock_released) 586 - goto restart; 555 + if (!incompat_holders_demoted) { 556 + current_gh = gh; 557 + demote_incompat_holders(gl, current_gh); 558 + incompat_holders_demoted = true; 559 + } 587 560 } 588 561 return 0; 589 562 } ··· 638 657 const struct gfs2_glock_operations *glops = gl->gl_ops; 639 658 struct gfs2_holder *gh; 640 659 unsigned state = ret & LM_OUT_ST_MASK; 641 - int rv; 642 660 643 661 spin_lock(&gl->gl_lockref.lock); 644 662 trace_gfs2_glock_state_change(gl, state); ··· 695 715 gfs2_demote_wake(gl); 696 716 if (state != LM_ST_UNLOCKED) { 697 717 if (glops->go_xmote_bh) { 718 + int rv; 719 + 698 720 spin_unlock(&gl->gl_lockref.lock); 699 721 rv = glops->go_xmote_bh(gl); 700 722 spin_lock(&gl->gl_lockref.lock); ··· 705 723 goto out; 706 724 } 707 725 } 708 - rv = do_promote(gl); 709 - if (rv == 2) 710 - goto out_locked; 726 + do_promote(gl); 711 727 } 712 728 out: 713 729 clear_bit(GLF_LOCK, &gl->gl_flags); 714 - out_locked: 715 730 spin_unlock(&gl->gl_lockref.lock); 716 731 } 717 732 ··· 865 886 __acquires(&gl->gl_lockref.lock) 866 887 { 867 888 struct gfs2_holder *gh = NULL; 868 - int ret; 869 889 870 890 if (test_and_set_bit(GLF_LOCK, &gl->gl_flags)) 871 891 return; ··· 883 905 } else { 884 906 if (test_bit(GLF_DEMOTE, &gl->gl_flags)) 885 907 gfs2_demote_wake(gl); 886 - ret = do_promote(gl); 887 - if (ret == 0) 908 + if (do_promote(gl) == 0) 888 909 goto out_unlock; 889 - if (ret == 2) 890 - goto out; 891 910 gh = find_first_waiter(gl); 892 911 gl->gl_target = gh->gh_state; 893 912 if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) 894 913 do_error(gl, 0); /* Fail queued try locks */ 895 914 } 896 915 do_xmote(gl, gh, gl->gl_target); 897 - out: 898 916 return; 899 917 900 918 out_sched: ··· 1288 1314 } 1289 1315 1290 1316 /** 1317 + * gfs2_glock_holder_ready - holder is ready and its error code can be collected 1318 + * @gh: the glock holder 1319 + * 1320 + * Called when a glock holder no longer needs to be waited for because it is 1321 + * now either held (HIF_HOLDER set; gh_error == 0), or acquiring the lock has 1322 + * failed (gh_error != 0). 1323 + */ 1324 + 1325 + int gfs2_glock_holder_ready(struct gfs2_holder *gh) 1326 + { 1327 + if (gh->gh_error || (gh->gh_flags & GL_SKIP)) 1328 + return gh->gh_error; 1329 + gh->gh_error = gfs2_instantiate(gh); 1330 + if (gh->gh_error) 1331 + gfs2_glock_dq(gh); 1332 + return gh->gh_error; 1333 + } 1334 + 1335 + /** 1291 1336 * gfs2_glock_wait - wait on a glock acquisition 1292 1337 * @gh: the glock holder 1293 1338 * ··· 1320 1327 might_sleep(); 1321 1328 wait_on_bit(&gh->gh_iflags, HIF_WAIT, TASK_UNINTERRUPTIBLE); 1322 1329 gfs2_glock_update_hold_time(gh->gh_gl, start_time); 1323 - return gh->gh_error; 1330 + return gfs2_glock_holder_ready(gh); 1324 1331 } 1325 1332 1326 1333 static int glocks_pending(unsigned int num_gh, struct gfs2_holder *ghs) ··· 1348 1355 struct gfs2_sbd *sdp = ghs[0].gh_gl->gl_name.ln_sbd; 1349 1356 int i, ret = 0, timeout = 0; 1350 1357 unsigned long start_time = jiffies; 1351 - bool keep_waiting; 1352 1358 1353 1359 might_sleep(); 1354 1360 /* ··· 1357 1365 for (i = 0; i < num_gh; i++) 1358 1366 timeout += ghs[i].gh_gl->gl_hold_time << 1; 1359 1367 1360 - wait_for_dlm: 1361 1368 if (!wait_event_timeout(sdp->sd_async_glock_wait, 1362 - !glocks_pending(num_gh, ghs), timeout)) 1369 + !glocks_pending(num_gh, ghs), timeout)) { 1363 1370 ret = -ESTALE; /* request timed out. */ 1364 - 1365 - /* 1366 - * If dlm granted all our requests, we need to adjust the glock 1367 - * minimum hold time values according to how long we waited. 1368 - * 1369 - * If our request timed out, we need to repeatedly release any held 1370 - * glocks we acquired thus far to allow dlm to acquire the remaining 1371 - * glocks without deadlocking. We cannot currently cancel outstanding 1372 - * glock acquisitions. 1373 - * 1374 - * The HIF_WAIT bit tells us which requests still need a response from 1375 - * dlm. 1376 - * 1377 - * If dlm sent us any errors, we return the first error we find. 1378 - */ 1379 - keep_waiting = false; 1380 - for (i = 0; i < num_gh; i++) { 1381 - /* Skip holders we have already dequeued below. */ 1382 - if (!gfs2_holder_queued(&ghs[i])) 1383 - continue; 1384 - /* Skip holders with a pending DLM response. */ 1385 - if (test_bit(HIF_WAIT, &ghs[i].gh_iflags)) { 1386 - keep_waiting = true; 1387 - continue; 1388 - } 1389 - 1390 - if (test_bit(HIF_HOLDER, &ghs[i].gh_iflags)) { 1391 - if (ret == -ESTALE) 1392 - gfs2_glock_dq(&ghs[i]); 1393 - else 1394 - gfs2_glock_update_hold_time(ghs[i].gh_gl, 1395 - start_time); 1396 - } 1397 - if (!ret) 1398 - ret = ghs[i].gh_error; 1371 + goto out; 1399 1372 } 1400 1373 1401 - if (keep_waiting) 1402 - goto wait_for_dlm; 1374 + for (i = 0; i < num_gh; i++) { 1375 + struct gfs2_holder *gh = &ghs[i]; 1376 + int ret2; 1403 1377 1404 - /* 1405 - * At this point, we've either acquired all locks or released them all. 1406 - */ 1378 + if (test_bit(HIF_HOLDER, &gh->gh_iflags)) { 1379 + gfs2_glock_update_hold_time(gh->gh_gl, 1380 + start_time); 1381 + } 1382 + ret2 = gfs2_glock_holder_ready(gh); 1383 + if (!ret) 1384 + ret = ret2; 1385 + } 1386 + 1387 + out: 1388 + if (ret) { 1389 + for (i = 0; i < num_gh; i++) { 1390 + struct gfs2_holder *gh = &ghs[i]; 1391 + 1392 + gfs2_glock_dq(gh); 1393 + } 1394 + } 1407 1395 return ret; 1408 1396 } 1409 1397 ··· 1462 1490 1463 1491 if (gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)) { 1464 1492 if (test_bit(GLF_LOCK, &gl->gl_flags)) { 1465 - struct gfs2_holder *first_gh; 1493 + struct gfs2_holder *current_gh; 1466 1494 1467 - first_gh = find_first_strong_holder(gl); 1468 - try_futile = !may_grant(gl, first_gh, gh); 1495 + current_gh = find_first_strong_holder(gl); 1496 + try_futile = !may_grant(gl, current_gh, gh); 1469 1497 } 1470 1498 if (test_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags)) 1471 1499 goto fail; ··· 1751 1779 } 1752 1780 1753 1781 /** 1754 - * nq_m_sync - synchonously acquire more than one glock in deadlock free order 1782 + * nq_m_sync - synchronously acquire more than one glock in deadlock free order 1755 1783 * @num_gh: the number of structures 1756 1784 * @ghs: an array of struct gfs2_holder structures 1757 1785 * @p: placeholder for the holder structure to pass back ··· 1772 1800 sort(p, num_gh, sizeof(struct gfs2_holder *), glock_compare, NULL); 1773 1801 1774 1802 for (x = 0; x < num_gh; x++) { 1775 - p[x]->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC); 1776 - 1777 1803 error = gfs2_glock_nq(p[x]); 1778 1804 if (error) { 1779 1805 while (x--) ··· 1788 1818 * @num_gh: the number of structures 1789 1819 * @ghs: an array of struct gfs2_holder structures 1790 1820 * 1791 - * 1792 1821 * Returns: 0 on success (all glocks acquired), 1793 1822 * errno on failure (no glocks acquired) 1794 1823 */ ··· 1802 1833 case 0: 1803 1834 return 0; 1804 1835 case 1: 1805 - ghs->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC); 1806 1836 return gfs2_glock_nq(ghs); 1807 1837 default: 1808 1838 if (num_gh <= 4) ··· 2211 2243 atomic_read(&sdp->sd_glock_disposal) == 0, 2212 2244 HZ * 600); 2213 2245 glock_hash_walk(dump_glock_func, sdp); 2214 - } 2215 - 2216 - void gfs2_glock_finish_truncate(struct gfs2_inode *ip) 2217 - { 2218 - struct gfs2_glock *gl = ip->i_gl; 2219 - int ret; 2220 - 2221 - ret = gfs2_truncatei_resume(ip); 2222 - gfs2_glock_assert_withdraw(gl, ret == 0); 2223 - 2224 - spin_lock(&gl->gl_lockref.lock); 2225 - clear_bit(GLF_LOCK, &gl->gl_flags); 2226 - run_queue(gl, 1); 2227 - spin_unlock(&gl->gl_lockref.lock); 2228 2246 } 2229 2247 2230 2248 static const char *state2str(unsigned state)
+1 -1
fs/gfs2/glock.h
··· 213 213 extern int gfs2_glock_nq(struct gfs2_holder *gh); 214 214 extern int gfs2_glock_poll(struct gfs2_holder *gh); 215 215 extern int gfs2_instantiate(struct gfs2_holder *gh); 216 + extern int gfs2_glock_holder_ready(struct gfs2_holder *gh); 216 217 extern int gfs2_glock_wait(struct gfs2_holder *gh); 217 218 extern int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs); 218 219 extern void gfs2_glock_dq(struct gfs2_holder *gh); ··· 274 273 extern bool gfs2_delete_work_queued(const struct gfs2_glock *gl); 275 274 extern void gfs2_flush_delete_work(struct gfs2_sbd *sdp); 276 275 extern void gfs2_gl_hash_clear(struct gfs2_sbd *sdp); 277 - extern void gfs2_glock_finish_truncate(struct gfs2_inode *ip); 278 276 extern void gfs2_glock_thaw(struct gfs2_sbd *sdp); 279 277 extern void gfs2_glock_add_to_lru(struct gfs2_glock *gl); 280 278 extern void gfs2_glock_free(struct gfs2_glock *gl);
+15 -16
fs/gfs2/glops.c
··· 485 485 * Returns: errno 486 486 */ 487 487 488 - static int inode_go_instantiate(struct gfs2_holder *gh) 488 + static int inode_go_instantiate(struct gfs2_glock *gl) 489 + { 490 + struct gfs2_inode *ip = gl->gl_object; 491 + 492 + if (!ip) /* no inode to populate - read it in later */ 493 + return 0; 494 + 495 + return gfs2_inode_refresh(ip); 496 + } 497 + 498 + static int inode_go_held(struct gfs2_holder *gh) 489 499 { 490 500 struct gfs2_glock *gl = gh->gh_gl; 491 - struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; 492 501 struct gfs2_inode *ip = gl->gl_object; 493 502 int error = 0; 494 503 495 504 if (!ip) /* no inode to populate - read it in later */ 496 - goto out; 497 - 498 - error = gfs2_inode_refresh(ip); 499 - if (error) 500 - goto out; 505 + return 0; 501 506 502 507 if (gh->gh_state != LM_ST_DEFERRED) 503 508 inode_dio_wait(&ip->i_inode); 504 509 505 510 if ((ip->i_diskflags & GFS2_DIF_TRUNC_IN_PROG) && 506 511 (gl->gl_state == LM_ST_EXCLUSIVE) && 507 - (gh->gh_state == LM_ST_EXCLUSIVE)) { 508 - spin_lock(&sdp->sd_trunc_lock); 509 - if (list_empty(&ip->i_trunc_list)) 510 - list_add(&ip->i_trunc_list, &sdp->sd_trunc_list); 511 - spin_unlock(&sdp->sd_trunc_lock); 512 - wake_up(&sdp->sd_quota_wait); 513 - error = 1; 514 - } 512 + (gh->gh_state == LM_ST_EXCLUSIVE)) 513 + error = gfs2_truncatei_resume(ip); 515 514 516 - out: 517 515 return error; 518 516 } 519 517 ··· 735 737 .go_inval = inode_go_inval, 736 738 .go_demote_ok = inode_go_demote_ok, 737 739 .go_instantiate = inode_go_instantiate, 740 + .go_held = inode_go_held, 738 741 .go_dump = inode_go_dump, 739 742 .go_type = LM_TYPE_INODE, 740 743 .go_flags = GLOF_ASPACE | GLOF_LRU | GLOF_LVB,
+2 -4
fs/gfs2/incore.h
··· 219 219 int (*go_xmote_bh)(struct gfs2_glock *gl); 220 220 void (*go_inval) (struct gfs2_glock *gl, int flags); 221 221 int (*go_demote_ok) (const struct gfs2_glock *gl); 222 - int (*go_instantiate) (struct gfs2_holder *gh); 222 + int (*go_instantiate) (struct gfs2_glock *gl); 223 + int (*go_held)(struct gfs2_holder *gh); 223 224 void (*go_dump)(struct seq_file *seq, struct gfs2_glock *gl, 224 225 const char *fs_id_buf); 225 226 void (*go_callback)(struct gfs2_glock *gl, bool remote); ··· 397 396 atomic_t i_sizehint; /* hint of the write size */ 398 397 struct rw_semaphore i_rw_mutex; 399 398 struct list_head i_ordered; 400 - struct list_head i_trunc_list; 401 399 __be64 *i_hash_cache; 402 400 u32 i_entries; 403 401 u32 i_diskflags; ··· 784 784 struct mutex sd_quota_mutex; 785 785 struct mutex sd_quota_sync_mutex; 786 786 wait_queue_head_t sd_quota_wait; 787 - struct list_head sd_trunc_list; 788 - spinlock_t sd_trunc_lock; 789 787 790 788 unsigned int sd_quota_slots; 791 789 unsigned long *sd_quota_bitmap;
+1 -1
fs/gfs2/lock_dlm.c
··· 1058 1058 1059 1059 /* 1060 1060 * Expand static jid arrays if necessary (by increments of RECOVER_SIZE_INC) 1061 - * to accomodate the largest slot number. (NB dlm slot numbers start at 1, 1061 + * to accommodate the largest slot number. (NB dlm slot numbers start at 1, 1062 1062 * gfs2 jids start at 0, so jid = slot - 1) 1063 1063 */ 1064 1064
-1
fs/gfs2/main.c
··· 38 38 inode_init_once(&ip->i_inode); 39 39 atomic_set(&ip->i_sizehint, 0); 40 40 init_rwsem(&ip->i_rw_mutex); 41 - INIT_LIST_HEAD(&ip->i_trunc_list); 42 41 INIT_LIST_HEAD(&ip->i_ordered); 43 42 ip->i_qadata = NULL; 44 43 gfs2_holder_mark_uninitialized(&ip->i_rgd_gh);
-2
fs/gfs2/ops_fstype.c
··· 106 106 mutex_init(&sdp->sd_quota_mutex); 107 107 mutex_init(&sdp->sd_quota_sync_mutex); 108 108 init_waitqueue_head(&sdp->sd_quota_wait); 109 - INIT_LIST_HEAD(&sdp->sd_trunc_list); 110 - spin_lock_init(&sdp->sd_trunc_lock); 111 109 spin_lock_init(&sdp->sd_bitmap_lock); 112 110 113 111 INIT_LIST_HEAD(&sdp->sd_sc_inodes_list);
+1 -27
fs/gfs2/quota.c
··· 1517 1517 } 1518 1518 } 1519 1519 1520 - static void quotad_check_trunc_list(struct gfs2_sbd *sdp) 1521 - { 1522 - struct gfs2_inode *ip; 1523 - 1524 - while(1) { 1525 - ip = NULL; 1526 - spin_lock(&sdp->sd_trunc_lock); 1527 - if (!list_empty(&sdp->sd_trunc_list)) { 1528 - ip = list_first_entry(&sdp->sd_trunc_list, 1529 - struct gfs2_inode, i_trunc_list); 1530 - list_del_init(&ip->i_trunc_list); 1531 - } 1532 - spin_unlock(&sdp->sd_trunc_lock); 1533 - if (ip == NULL) 1534 - return; 1535 - gfs2_glock_finish_truncate(ip); 1536 - } 1537 - } 1538 - 1539 1520 void gfs2_wake_up_statfs(struct gfs2_sbd *sdp) { 1540 1521 if (!sdp->sd_statfs_force_sync) { 1541 1522 sdp->sd_statfs_force_sync = 1; ··· 1539 1558 unsigned long quotad_timeo = 0; 1540 1559 unsigned long t = 0; 1541 1560 DEFINE_WAIT(wait); 1542 - int empty; 1543 1561 1544 1562 while (!kthread_should_stop()) { 1545 1563 ··· 1559 1579 quotad_check_timeo(sdp, "sync", gfs2_quota_sync, t, 1560 1580 &quotad_timeo, &tune->gt_quota_quantum); 1561 1581 1562 - /* Check for & recover partially truncated inodes */ 1563 - quotad_check_trunc_list(sdp); 1564 - 1565 1582 try_to_freeze(); 1566 1583 1567 1584 bypass: 1568 1585 t = min(quotad_timeo, statfs_timeo); 1569 1586 1570 1587 prepare_to_wait(&sdp->sd_quota_wait, &wait, TASK_INTERRUPTIBLE); 1571 - spin_lock(&sdp->sd_trunc_lock); 1572 - empty = list_empty(&sdp->sd_trunc_list); 1573 - spin_unlock(&sdp->sd_trunc_lock); 1574 - if (empty && !sdp->sd_statfs_force_sync) 1588 + if (!sdp->sd_statfs_force_sync) 1575 1589 t -= schedule_timeout(t); 1576 1590 else 1577 1591 t = 0;
+7 -5
fs/gfs2/rgrp.c
··· 1196 1196 * Returns: errno 1197 1197 */ 1198 1198 1199 - int gfs2_rgrp_go_instantiate(struct gfs2_holder *gh) 1199 + int gfs2_rgrp_go_instantiate(struct gfs2_glock *gl) 1200 1200 { 1201 - struct gfs2_glock *gl = gh->gh_gl; 1202 1201 struct gfs2_rgrpd *rgd = gl->gl_object; 1203 1202 struct gfs2_sbd *sdp = rgd->rd_sbd; 1204 1203 unsigned int length = rgd->rd_length; ··· 2719 2720 * gfs2_rlist_alloc - all RGs have been added to the rlist, now allocate 2720 2721 * and initialize an array of glock holders for them 2721 2722 * @rlist: the list of resource groups 2723 + * @state: the state we're requesting 2724 + * @flags: the modifier flags 2722 2725 * 2723 2726 * FIXME: Don't use NOFAIL 2724 2727 * 2725 2728 */ 2726 2729 2727 - void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist) 2730 + void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist, 2731 + unsigned int state, u16 flags) 2728 2732 { 2729 2733 unsigned int x; 2730 2734 ··· 2735 2733 sizeof(struct gfs2_holder), 2736 2734 GFP_NOFS | __GFP_NOFAIL); 2737 2735 for (x = 0; x < rlist->rl_rgrps; x++) 2738 - gfs2_holder_init(rlist->rl_rgd[x]->rd_gl, LM_ST_EXCLUSIVE, 2739 - LM_FLAG_NODE_SCOPE, &rlist->rl_ghs[x]); 2736 + gfs2_holder_init(rlist->rl_rgd[x]->rd_gl, state, flags, 2737 + &rlist->rl_ghs[x]); 2740 2738 } 2741 2739 2742 2740 /**
+3 -2
fs/gfs2/rgrp.h
··· 31 31 extern void gfs2_clear_rgrpd(struct gfs2_sbd *sdp); 32 32 extern int gfs2_rindex_update(struct gfs2_sbd *sdp); 33 33 extern void gfs2_free_clones(struct gfs2_rgrpd *rgd); 34 - extern int gfs2_rgrp_go_instantiate(struct gfs2_holder *gh); 34 + extern int gfs2_rgrp_go_instantiate(struct gfs2_glock *gl); 35 35 extern void gfs2_rgrp_brelse(struct gfs2_rgrpd *rgd); 36 36 37 37 extern struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip); ··· 64 64 65 65 extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist, 66 66 u64 block); 67 - extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist); 67 + extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist, 68 + unsigned int state, u16 flags); 68 69 extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist); 69 70 extern u64 gfs2_ri_total(struct gfs2_sbd *sdp); 70 71 extern void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_rgrpd *rgd,
+1 -1
fs/gfs2/super.c
··· 1196 1196 gfs2_glock_dq(gh); 1197 1197 return false; 1198 1198 } 1199 - return true; 1199 + return gfs2_glock_holder_ready(gh) == 0; 1200 1200 } 1201 1201 1202 1202 /**
+1 -1
fs/gfs2/xattr.c
··· 1313 1313 else 1314 1314 goto out; 1315 1315 1316 - gfs2_rlist_alloc(&rlist); 1316 + gfs2_rlist_alloc(&rlist, LM_ST_EXCLUSIVE, LM_FLAG_NODE_SCOPE); 1317 1317 1318 1318 for (x = 0; x < rlist.rl_rgrps; x++) { 1319 1319 rgd = gfs2_glock2rgrp(rlist.rl_ghs[x].gh_gl);