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 branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2:
ocfs2: Fix system inodes cache overflow.
ocfs2: Hold ip_lock when set/clear flags for indexed dir.
ocfs2: Adjust masklog flag values
Ocfs2: Teach 'coherency=full' O_DIRECT writes to correctly up_read i_alloc_sem.
ocfs2/dlm: Migrate lockres with no locks if it has a reference

+81 -28
+5 -2
fs/ocfs2/aops.c
··· 573 573 /* this io's submitter should not have unlocked this before we could */ 574 574 BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); 575 575 576 + if (ocfs2_iocb_is_sem_locked(iocb)) { 577 + up_read(&inode->i_alloc_sem); 578 + ocfs2_iocb_clear_sem_locked(iocb); 579 + } 580 + 576 581 ocfs2_iocb_clear_rw_locked(iocb); 577 582 578 583 level = ocfs2_iocb_rw_locked_level(iocb); 579 - if (!level) 580 - up_read(&inode->i_alloc_sem); 581 584 ocfs2_rw_unlock(inode, level); 582 585 583 586 if (is_async)
+21 -2
fs/ocfs2/aops.h
··· 68 68 else 69 69 clear_bit(1, (unsigned long *)&iocb->private); 70 70 } 71 + 72 + /* 73 + * Using a named enum representing lock types in terms of #N bit stored in 74 + * iocb->private, which is going to be used for communication bewteen 75 + * ocfs2_dio_end_io() and ocfs2_file_aio_write/read(). 76 + */ 77 + enum ocfs2_iocb_lock_bits { 78 + OCFS2_IOCB_RW_LOCK = 0, 79 + OCFS2_IOCB_RW_LOCK_LEVEL, 80 + OCFS2_IOCB_SEM, 81 + OCFS2_IOCB_NUM_LOCKS 82 + }; 83 + 71 84 #define ocfs2_iocb_clear_rw_locked(iocb) \ 72 - clear_bit(0, (unsigned long *)&iocb->private) 85 + clear_bit(OCFS2_IOCB_RW_LOCK, (unsigned long *)&iocb->private) 73 86 #define ocfs2_iocb_rw_locked_level(iocb) \ 74 - test_bit(1, (unsigned long *)&iocb->private) 87 + test_bit(OCFS2_IOCB_RW_LOCK_LEVEL, (unsigned long *)&iocb->private) 88 + #define ocfs2_iocb_set_sem_locked(iocb) \ 89 + set_bit(OCFS2_IOCB_SEM, (unsigned long *)&iocb->private) 90 + #define ocfs2_iocb_clear_sem_locked(iocb) \ 91 + clear_bit(OCFS2_IOCB_SEM, (unsigned long *)&iocb->private) 92 + #define ocfs2_iocb_is_sem_locked(iocb) \ 93 + test_bit(OCFS2_IOCB_SEM, (unsigned long *)&iocb->private) 75 94 #endif /* OCFS2_FILE_H */
+2 -1
fs/ocfs2/cluster/masklog.c
··· 113 113 define_mask(QUOTA), 114 114 define_mask(REFCOUNT), 115 115 define_mask(BASTS), 116 + define_mask(RESERVATIONS), 117 + define_mask(CLUSTER), 116 118 define_mask(ERROR), 117 119 define_mask(NOTICE), 118 120 define_mask(KTHREAD), 119 - define_mask(RESERVATIONS), 120 121 }; 121 122 122 123 static struct attribute *mlog_attr_ptrs[MLOG_MAX_BITS] = {NULL, };
+8 -7
fs/ocfs2/cluster/masklog.h
··· 81 81 #include <linux/sched.h> 82 82 83 83 /* bits that are frequently given and infrequently matched in the low word */ 84 - /* NOTE: If you add a flag, you need to also update mlog.c! */ 84 + /* NOTE: If you add a flag, you need to also update masklog.c! */ 85 85 #define ML_ENTRY 0x0000000000000001ULL /* func call entry */ 86 86 #define ML_EXIT 0x0000000000000002ULL /* func call exit */ 87 87 #define ML_TCP 0x0000000000000004ULL /* net cluster/tcp.c */ ··· 114 114 #define ML_XATTR 0x0000000020000000ULL /* ocfs2 extended attributes */ 115 115 #define ML_QUOTA 0x0000000040000000ULL /* ocfs2 quota operations */ 116 116 #define ML_REFCOUNT 0x0000000080000000ULL /* refcount tree operations */ 117 - #define ML_BASTS 0x0000001000000000ULL /* dlmglue asts and basts */ 117 + #define ML_BASTS 0x0000000100000000ULL /* dlmglue asts and basts */ 118 + #define ML_RESERVATIONS 0x0000000200000000ULL /* ocfs2 alloc reservations */ 119 + #define ML_CLUSTER 0x0000000400000000ULL /* cluster stack */ 120 + 118 121 /* bits that are infrequently given and frequently matched in the high word */ 119 - #define ML_ERROR 0x0000000100000000ULL /* sent to KERN_ERR */ 120 - #define ML_NOTICE 0x0000000200000000ULL /* setn to KERN_NOTICE */ 121 - #define ML_KTHREAD 0x0000000400000000ULL /* kernel thread activity */ 122 - #define ML_RESERVATIONS 0x0000000800000000ULL /* ocfs2 alloc reservations */ 123 - #define ML_CLUSTER 0x0000001000000000ULL /* cluster stack */ 122 + #define ML_ERROR 0x1000000000000000ULL /* sent to KERN_ERR */ 123 + #define ML_NOTICE 0x2000000000000000ULL /* setn to KERN_NOTICE */ 124 + #define ML_KTHREAD 0x4000000000000000ULL /* kernel thread activity */ 124 125 125 126 #define MLOG_INITIAL_AND_MASK (ML_ERROR|ML_NOTICE) 126 127 #define MLOG_INITIAL_NOT_MASK (ML_ENTRY|ML_EXIT)
+4
fs/ocfs2/dir.c
··· 2461 2461 2462 2462 di->i_dx_root = cpu_to_le64(dr_blkno); 2463 2463 2464 + spin_lock(&OCFS2_I(dir)->ip_lock); 2464 2465 OCFS2_I(dir)->ip_dyn_features |= OCFS2_INDEXED_DIR_FL; 2465 2466 di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); 2467 + spin_unlock(&OCFS2_I(dir)->ip_lock); 2466 2468 2467 2469 ocfs2_journal_dirty(handle, di_bh); 2468 2470 ··· 4468 4466 goto out_commit; 4469 4467 } 4470 4468 4469 + spin_lock(&OCFS2_I(dir)->ip_lock); 4471 4470 OCFS2_I(dir)->ip_dyn_features &= ~OCFS2_INDEXED_DIR_FL; 4472 4471 di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); 4472 + spin_unlock(&OCFS2_I(dir)->ip_lock); 4473 4473 di->i_dx_root = cpu_to_le64(0ULL); 4474 4474 4475 4475 ocfs2_journal_dirty(handle, di_bh);
+27 -13
fs/ocfs2/dlm/dlmmaster.c
··· 2346 2346 */ 2347 2347 static int dlm_is_lockres_migrateable(struct dlm_ctxt *dlm, 2348 2348 struct dlm_lock_resource *res, 2349 - int *numlocks) 2349 + int *numlocks, 2350 + int *hasrefs) 2350 2351 { 2351 2352 int ret; 2352 2353 int i; ··· 2356 2355 struct dlm_lock *lock; 2357 2356 2358 2357 assert_spin_locked(&res->spinlock); 2358 + 2359 + *numlocks = 0; 2360 + *hasrefs = 0; 2359 2361 2360 2362 ret = -EINVAL; 2361 2363 if (res->owner == DLM_LOCK_RES_OWNER_UNKNOWN) { ··· 2390 2386 } 2391 2387 2392 2388 *numlocks = count; 2393 - mlog(0, "migrateable lockres having %d locks\n", *numlocks); 2389 + 2390 + count = find_next_bit(res->refmap, O2NM_MAX_NODES, 0); 2391 + if (count < O2NM_MAX_NODES) 2392 + *hasrefs = 1; 2393 + 2394 + mlog(0, "%s: res %.*s, Migrateable, locks %d, refs %d\n", dlm->name, 2395 + res->lockname.len, res->lockname.name, *numlocks, *hasrefs); 2394 2396 2395 2397 leave: 2396 2398 return ret; ··· 2418 2408 const char *name; 2419 2409 unsigned int namelen; 2420 2410 int mle_added = 0; 2421 - int numlocks; 2411 + int numlocks, hasrefs; 2422 2412 int wake = 0; 2423 2413 2424 2414 if (!dlm_grab(dlm)) ··· 2427 2417 name = res->lockname.name; 2428 2418 namelen = res->lockname.len; 2429 2419 2430 - mlog(0, "migrating %.*s to %u\n", namelen, name, target); 2420 + mlog(0, "%s: Migrating %.*s to %u\n", dlm->name, namelen, name, target); 2431 2421 2432 2422 /* 2433 2423 * ensure this lockres is a proper candidate for migration 2434 2424 */ 2435 2425 spin_lock(&res->spinlock); 2436 - ret = dlm_is_lockres_migrateable(dlm, res, &numlocks); 2426 + ret = dlm_is_lockres_migrateable(dlm, res, &numlocks, &hasrefs); 2437 2427 if (ret < 0) { 2438 2428 spin_unlock(&res->spinlock); 2439 2429 goto leave; ··· 2441 2431 spin_unlock(&res->spinlock); 2442 2432 2443 2433 /* no work to do */ 2444 - if (numlocks == 0) { 2445 - mlog(0, "no locks were found on this lockres! done!\n"); 2434 + if (numlocks == 0 && !hasrefs) 2446 2435 goto leave; 2447 - } 2448 2436 2449 2437 /* 2450 2438 * preallocate up front ··· 2467 2459 * find a node to migrate the lockres to 2468 2460 */ 2469 2461 2470 - mlog(0, "picking a migration node\n"); 2471 2462 spin_lock(&dlm->spinlock); 2472 2463 /* pick a new node */ 2473 2464 if (!test_bit(target, dlm->domain_map) || 2474 2465 target >= O2NM_MAX_NODES) { 2475 2466 target = dlm_pick_migration_target(dlm, res); 2476 2467 } 2477 - mlog(0, "node %u chosen for migration\n", target); 2468 + mlog(0, "%s: res %.*s, Node %u chosen for migration\n", dlm->name, 2469 + namelen, name, target); 2478 2470 2479 2471 if (target >= O2NM_MAX_NODES || 2480 2472 !test_bit(target, dlm->domain_map)) { ··· 2675 2667 { 2676 2668 int ret; 2677 2669 int lock_dropped = 0; 2678 - int numlocks; 2670 + int numlocks, hasrefs; 2679 2671 2680 2672 spin_lock(&res->spinlock); 2681 2673 if (res->owner != dlm->node_num) { ··· 2689 2681 } 2690 2682 2691 2683 /* No need to migrate a lockres having no locks */ 2692 - ret = dlm_is_lockres_migrateable(dlm, res, &numlocks); 2693 - if (ret >= 0 && numlocks == 0) { 2684 + ret = dlm_is_lockres_migrateable(dlm, res, &numlocks, &hasrefs); 2685 + if (ret >= 0 && numlocks == 0 && !hasrefs) { 2694 2686 spin_unlock(&res->spinlock); 2695 2687 goto leave; 2696 2688 } ··· 2922 2914 } 2923 2915 } 2924 2916 queue++; 2917 + } 2918 + 2919 + nodenum = find_next_bit(res->refmap, O2NM_MAX_NODES, 0); 2920 + if (nodenum < O2NM_MAX_NODES) { 2921 + spin_unlock(&res->spinlock); 2922 + return nodenum; 2925 2923 } 2926 2924 spin_unlock(&res->spinlock); 2927 2925 mlog(0, "have not found a suitable target yet! checking domain map\n");
+13 -2
fs/ocfs2/file.c
··· 2241 2241 2242 2242 mutex_lock(&inode->i_mutex); 2243 2243 2244 + ocfs2_iocb_clear_sem_locked(iocb); 2245 + 2244 2246 relock: 2245 2247 /* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */ 2246 2248 if (direct_io) { 2247 2249 down_read(&inode->i_alloc_sem); 2248 2250 have_alloc_sem = 1; 2251 + /* communicate with ocfs2_dio_end_io */ 2252 + ocfs2_iocb_set_sem_locked(iocb); 2249 2253 } 2250 2254 2251 2255 /* ··· 2386 2382 ocfs2_rw_unlock(inode, rw_level); 2387 2383 2388 2384 out_sems: 2389 - if (have_alloc_sem) 2385 + if (have_alloc_sem) { 2390 2386 up_read(&inode->i_alloc_sem); 2387 + ocfs2_iocb_clear_sem_locked(iocb); 2388 + } 2391 2389 2392 2390 mutex_unlock(&inode->i_mutex); 2393 2391 ··· 2533 2527 goto bail; 2534 2528 } 2535 2529 2530 + ocfs2_iocb_clear_sem_locked(iocb); 2531 + 2536 2532 /* 2537 2533 * buffered reads protect themselves in ->readpage(). O_DIRECT reads 2538 2534 * need locks to protect pending reads from racing with truncate. ··· 2542 2534 if (filp->f_flags & O_DIRECT) { 2543 2535 down_read(&inode->i_alloc_sem); 2544 2536 have_alloc_sem = 1; 2537 + ocfs2_iocb_set_sem_locked(iocb); 2545 2538 2546 2539 ret = ocfs2_rw_lock(inode, 0); 2547 2540 if (ret < 0) { ··· 2584 2575 } 2585 2576 2586 2577 bail: 2587 - if (have_alloc_sem) 2578 + if (have_alloc_sem) { 2588 2579 up_read(&inode->i_alloc_sem); 2580 + ocfs2_iocb_clear_sem_locked(iocb); 2581 + } 2589 2582 if (rw_level != -1) 2590 2583 ocfs2_rw_unlock(inode, rw_level); 2591 2584 mlog_exit(ret);
+1 -1
fs/ocfs2/ocfs2_fs.h
··· 350 350 #define OCFS2_LAST_LOCAL_SYSTEM_INODE LOCAL_GROUP_QUOTA_SYSTEM_INODE 351 351 NUM_SYSTEM_INODES 352 352 }; 353 - #define NUM_GLOBAL_SYSTEM_INODES OCFS2_LAST_GLOBAL_SYSTEM_INODE 353 + #define NUM_GLOBAL_SYSTEM_INODES OCFS2_FIRST_LOCAL_SYSTEM_INODE 354 354 #define NUM_LOCAL_SYSTEM_INODES \ 355 355 (NUM_SYSTEM_INODES - OCFS2_FIRST_LOCAL_SYSTEM_INODE) 356 356