diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-23 19:36:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-23 19:36:48 -0500 |
commit | eda4b716ea1f2a647a39cebae66b3fae4c4b80e4 (patch) | |
tree | ab4318b72be4635c1213aa0def631e1169307660 /fs | |
parent | 55fb78a3a80348d87b2e3d79f61f8a9252dd86f5 (diff) | |
parent | 7d8f98769e7f4bc29c38789daeb416c6a7d7c241 (diff) |
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
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/aops.c | 7 | ||||
-rw-r--r-- | fs/ocfs2/aops.h | 23 | ||||
-rw-r--r-- | fs/ocfs2/cluster/masklog.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/cluster/masklog.h | 15 | ||||
-rw-r--r-- | fs/ocfs2/dir.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 40 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 15 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2_fs.h | 2 |
8 files changed, 81 insertions, 28 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index f1e962cb3b73..0d7c5540ad66 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -573,11 +573,14 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, | |||
573 | /* this io's submitter should not have unlocked this before we could */ | 573 | /* this io's submitter should not have unlocked this before we could */ |
574 | BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); | 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 | ocfs2_iocb_clear_rw_locked(iocb); | 581 | ocfs2_iocb_clear_rw_locked(iocb); |
577 | 582 | ||
578 | level = ocfs2_iocb_rw_locked_level(iocb); | 583 | level = ocfs2_iocb_rw_locked_level(iocb); |
579 | if (!level) | ||
580 | up_read(&inode->i_alloc_sem); | ||
581 | ocfs2_rw_unlock(inode, level); | 584 | ocfs2_rw_unlock(inode, level); |
582 | 585 | ||
583 | if (is_async) | 586 | if (is_async) |
diff --git a/fs/ocfs2/aops.h b/fs/ocfs2/aops.h index 76bfdfda691a..eceb456037c1 100644 --- a/fs/ocfs2/aops.h +++ b/fs/ocfs2/aops.h | |||
@@ -68,8 +68,27 @@ static inline void ocfs2_iocb_set_rw_locked(struct kiocb *iocb, int level) | |||
68 | else | 68 | else |
69 | clear_bit(1, (unsigned long *)&iocb->private); | 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 | #define ocfs2_iocb_clear_rw_locked(iocb) \ | 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 | #define ocfs2_iocb_rw_locked_level(iocb) \ | 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 | #endif /* OCFS2_FILE_H */ | 94 | #endif /* OCFS2_FILE_H */ |
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c index c7fba396392d..6c61771469af 100644 --- a/fs/ocfs2/cluster/masklog.c +++ b/fs/ocfs2/cluster/masklog.c | |||
@@ -113,10 +113,11 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = { | |||
113 | define_mask(QUOTA), | 113 | define_mask(QUOTA), |
114 | define_mask(REFCOUNT), | 114 | define_mask(REFCOUNT), |
115 | define_mask(BASTS), | 115 | define_mask(BASTS), |
116 | define_mask(RESERVATIONS), | ||
117 | define_mask(CLUSTER), | ||
116 | define_mask(ERROR), | 118 | define_mask(ERROR), |
117 | define_mask(NOTICE), | 119 | define_mask(NOTICE), |
118 | define_mask(KTHREAD), | 120 | define_mask(KTHREAD), |
119 | define_mask(RESERVATIONS), | ||
120 | }; | 121 | }; |
121 | 122 | ||
122 | static struct attribute *mlog_attr_ptrs[MLOG_MAX_BITS] = {NULL, }; | 123 | static struct attribute *mlog_attr_ptrs[MLOG_MAX_BITS] = {NULL, }; |
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h index ea2ed9f56c94..34d6544357d9 100644 --- a/fs/ocfs2/cluster/masklog.h +++ b/fs/ocfs2/cluster/masklog.h | |||
@@ -81,7 +81,7 @@ | |||
81 | #include <linux/sched.h> | 81 | #include <linux/sched.h> |
82 | 82 | ||
83 | /* bits that are frequently given and infrequently matched in the low word */ | 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 | #define ML_ENTRY 0x0000000000000001ULL /* func call entry */ | 85 | #define ML_ENTRY 0x0000000000000001ULL /* func call entry */ |
86 | #define ML_EXIT 0x0000000000000002ULL /* func call exit */ | 86 | #define ML_EXIT 0x0000000000000002ULL /* func call exit */ |
87 | #define ML_TCP 0x0000000000000004ULL /* net cluster/tcp.c */ | 87 | #define ML_TCP 0x0000000000000004ULL /* net cluster/tcp.c */ |
@@ -114,13 +114,14 @@ | |||
114 | #define ML_XATTR 0x0000000020000000ULL /* ocfs2 extended attributes */ | 114 | #define ML_XATTR 0x0000000020000000ULL /* ocfs2 extended attributes */ |
115 | #define ML_QUOTA 0x0000000040000000ULL /* ocfs2 quota operations */ | 115 | #define ML_QUOTA 0x0000000040000000ULL /* ocfs2 quota operations */ |
116 | #define ML_REFCOUNT 0x0000000080000000ULL /* refcount tree operations */ | 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 | /* bits that are infrequently given and frequently matched in the high word */ | 121 | /* bits that are infrequently given and frequently matched in the high word */ |
119 | #define ML_ERROR 0x0000000100000000ULL /* sent to KERN_ERR */ | 122 | #define ML_ERROR 0x1000000000000000ULL /* sent to KERN_ERR */ |
120 | #define ML_NOTICE 0x0000000200000000ULL /* setn to KERN_NOTICE */ | 123 | #define ML_NOTICE 0x2000000000000000ULL /* setn to KERN_NOTICE */ |
121 | #define ML_KTHREAD 0x0000000400000000ULL /* kernel thread activity */ | 124 | #define ML_KTHREAD 0x4000000000000000ULL /* kernel thread activity */ |
122 | #define ML_RESERVATIONS 0x0000000800000000ULL /* ocfs2 alloc reservations */ | ||
123 | #define ML_CLUSTER 0x0000001000000000ULL /* cluster stack */ | ||
124 | 125 | ||
125 | #define MLOG_INITIAL_AND_MASK (ML_ERROR|ML_NOTICE) | 126 | #define MLOG_INITIAL_AND_MASK (ML_ERROR|ML_NOTICE) |
126 | #define MLOG_INITIAL_NOT_MASK (ML_ENTRY|ML_EXIT) | 127 | #define MLOG_INITIAL_NOT_MASK (ML_ENTRY|ML_EXIT) |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index c49f6de0e7ab..d417b3f9b0c7 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -2461,8 +2461,10 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb, | |||
2461 | 2461 | ||
2462 | di->i_dx_root = cpu_to_le64(dr_blkno); | 2462 | di->i_dx_root = cpu_to_le64(dr_blkno); |
2463 | 2463 | ||
2464 | spin_lock(&OCFS2_I(dir)->ip_lock); | ||
2464 | OCFS2_I(dir)->ip_dyn_features |= OCFS2_INDEXED_DIR_FL; | 2465 | OCFS2_I(dir)->ip_dyn_features |= OCFS2_INDEXED_DIR_FL; |
2465 | di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); | 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 | ocfs2_journal_dirty(handle, di_bh); | 2469 | ocfs2_journal_dirty(handle, di_bh); |
2468 | 2470 | ||
@@ -4466,8 +4468,10 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir, | |||
4466 | goto out_commit; | 4468 | goto out_commit; |
4467 | } | 4469 | } |
4468 | 4470 | ||
4471 | spin_lock(&OCFS2_I(dir)->ip_lock); | ||
4469 | OCFS2_I(dir)->ip_dyn_features &= ~OCFS2_INDEXED_DIR_FL; | 4472 | OCFS2_I(dir)->ip_dyn_features &= ~OCFS2_INDEXED_DIR_FL; |
4470 | di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); | 4473 | di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); |
4474 | spin_unlock(&OCFS2_I(dir)->ip_lock); | ||
4471 | di->i_dx_root = cpu_to_le64(0ULL); | 4475 | di->i_dx_root = cpu_to_le64(0ULL); |
4472 | 4476 | ||
4473 | ocfs2_journal_dirty(handle, di_bh); | 4477 | ocfs2_journal_dirty(handle, di_bh); |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index f564b0e5f80d..59f0f6bdfc62 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -2346,7 +2346,8 @@ static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data) | |||
2346 | */ | 2346 | */ |
2347 | static int dlm_is_lockres_migrateable(struct dlm_ctxt *dlm, | 2347 | static int dlm_is_lockres_migrateable(struct dlm_ctxt *dlm, |
2348 | struct dlm_lock_resource *res, | 2348 | struct dlm_lock_resource *res, |
2349 | int *numlocks) | 2349 | int *numlocks, |
2350 | int *hasrefs) | ||
2350 | { | 2351 | { |
2351 | int ret; | 2352 | int ret; |
2352 | int i; | 2353 | int i; |
@@ -2356,6 +2357,9 @@ static int dlm_is_lockres_migrateable(struct dlm_ctxt *dlm, | |||
2356 | 2357 | ||
2357 | assert_spin_locked(&res->spinlock); | 2358 | assert_spin_locked(&res->spinlock); |
2358 | 2359 | ||
2360 | *numlocks = 0; | ||
2361 | *hasrefs = 0; | ||
2362 | |||
2359 | ret = -EINVAL; | 2363 | ret = -EINVAL; |
2360 | if (res->owner == DLM_LOCK_RES_OWNER_UNKNOWN) { | 2364 | if (res->owner == DLM_LOCK_RES_OWNER_UNKNOWN) { |
2361 | mlog(0, "cannot migrate lockres with unknown owner!\n"); | 2365 | mlog(0, "cannot migrate lockres with unknown owner!\n"); |
@@ -2386,7 +2390,13 @@ static int dlm_is_lockres_migrateable(struct dlm_ctxt *dlm, | |||
2386 | } | 2390 | } |
2387 | 2391 | ||
2388 | *numlocks = count; | 2392 | *numlocks = count; |
2389 | mlog(0, "migrateable lockres having %d locks\n", *numlocks); | 2393 | |
2394 | count = find_next_bit(res->refmap, O2NM_MAX_NODES, 0); | ||
2395 | if (count < O2NM_MAX_NODES) | ||
2396 | *hasrefs = 1; | ||
2397 | |||
2398 | mlog(0, "%s: res %.*s, Migrateable, locks %d, refs %d\n", dlm->name, | ||
2399 | res->lockname.len, res->lockname.name, *numlocks, *hasrefs); | ||
2390 | 2400 | ||
2391 | leave: | 2401 | leave: |
2392 | return ret; | 2402 | return ret; |
@@ -2408,7 +2418,7 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm, | |||
2408 | const char *name; | 2418 | const char *name; |
2409 | unsigned int namelen; | 2419 | unsigned int namelen; |
2410 | int mle_added = 0; | 2420 | int mle_added = 0; |
2411 | int numlocks; | 2421 | int numlocks, hasrefs; |
2412 | int wake = 0; | 2422 | int wake = 0; |
2413 | 2423 | ||
2414 | if (!dlm_grab(dlm)) | 2424 | if (!dlm_grab(dlm)) |
@@ -2417,13 +2427,13 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm, | |||
2417 | name = res->lockname.name; | 2427 | name = res->lockname.name; |
2418 | namelen = res->lockname.len; | 2428 | namelen = res->lockname.len; |
2419 | 2429 | ||
2420 | mlog(0, "migrating %.*s to %u\n", namelen, name, target); | 2430 | mlog(0, "%s: Migrating %.*s to %u\n", dlm->name, namelen, name, target); |
2421 | 2431 | ||
2422 | /* | 2432 | /* |
2423 | * ensure this lockres is a proper candidate for migration | 2433 | * ensure this lockres is a proper candidate for migration |
2424 | */ | 2434 | */ |
2425 | spin_lock(&res->spinlock); | 2435 | spin_lock(&res->spinlock); |
2426 | ret = dlm_is_lockres_migrateable(dlm, res, &numlocks); | 2436 | ret = dlm_is_lockres_migrateable(dlm, res, &numlocks, &hasrefs); |
2427 | if (ret < 0) { | 2437 | if (ret < 0) { |
2428 | spin_unlock(&res->spinlock); | 2438 | spin_unlock(&res->spinlock); |
2429 | goto leave; | 2439 | goto leave; |
@@ -2431,10 +2441,8 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm, | |||
2431 | spin_unlock(&res->spinlock); | 2441 | spin_unlock(&res->spinlock); |
2432 | 2442 | ||
2433 | /* no work to do */ | 2443 | /* no work to do */ |
2434 | if (numlocks == 0) { | 2444 | if (numlocks == 0 && !hasrefs) |
2435 | mlog(0, "no locks were found on this lockres! done!\n"); | ||
2436 | goto leave; | 2445 | goto leave; |
2437 | } | ||
2438 | 2446 | ||
2439 | /* | 2447 | /* |
2440 | * preallocate up front | 2448 | * preallocate up front |
@@ -2459,14 +2467,14 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm, | |||
2459 | * find a node to migrate the lockres to | 2467 | * find a node to migrate the lockres to |
2460 | */ | 2468 | */ |
2461 | 2469 | ||
2462 | mlog(0, "picking a migration node\n"); | ||
2463 | spin_lock(&dlm->spinlock); | 2470 | spin_lock(&dlm->spinlock); |
2464 | /* pick a new node */ | 2471 | /* pick a new node */ |
2465 | if (!test_bit(target, dlm->domain_map) || | 2472 | if (!test_bit(target, dlm->domain_map) || |
2466 | target >= O2NM_MAX_NODES) { | 2473 | target >= O2NM_MAX_NODES) { |
2467 | target = dlm_pick_migration_target(dlm, res); | 2474 | target = dlm_pick_migration_target(dlm, res); |
2468 | } | 2475 | } |
2469 | mlog(0, "node %u chosen for migration\n", target); | 2476 | mlog(0, "%s: res %.*s, Node %u chosen for migration\n", dlm->name, |
2477 | namelen, name, target); | ||
2470 | 2478 | ||
2471 | if (target >= O2NM_MAX_NODES || | 2479 | if (target >= O2NM_MAX_NODES || |
2472 | !test_bit(target, dlm->domain_map)) { | 2480 | !test_bit(target, dlm->domain_map)) { |
@@ -2667,7 +2675,7 @@ int dlm_empty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) | |||
2667 | { | 2675 | { |
2668 | int ret; | 2676 | int ret; |
2669 | int lock_dropped = 0; | 2677 | int lock_dropped = 0; |
2670 | int numlocks; | 2678 | int numlocks, hasrefs; |
2671 | 2679 | ||
2672 | spin_lock(&res->spinlock); | 2680 | spin_lock(&res->spinlock); |
2673 | if (res->owner != dlm->node_num) { | 2681 | if (res->owner != dlm->node_num) { |
@@ -2681,8 +2689,8 @@ int dlm_empty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) | |||
2681 | } | 2689 | } |
2682 | 2690 | ||
2683 | /* No need to migrate a lockres having no locks */ | 2691 | /* No need to migrate a lockres having no locks */ |
2684 | ret = dlm_is_lockres_migrateable(dlm, res, &numlocks); | 2692 | ret = dlm_is_lockres_migrateable(dlm, res, &numlocks, &hasrefs); |
2685 | if (ret >= 0 && numlocks == 0) { | 2693 | if (ret >= 0 && numlocks == 0 && !hasrefs) { |
2686 | spin_unlock(&res->spinlock); | 2694 | spin_unlock(&res->spinlock); |
2687 | goto leave; | 2695 | goto leave; |
2688 | } | 2696 | } |
@@ -2915,6 +2923,12 @@ static u8 dlm_pick_migration_target(struct dlm_ctxt *dlm, | |||
2915 | } | 2923 | } |
2916 | queue++; | 2924 | queue++; |
2917 | } | 2925 | } |
2926 | |||
2927 | nodenum = find_next_bit(res->refmap, O2NM_MAX_NODES, 0); | ||
2928 | if (nodenum < O2NM_MAX_NODES) { | ||
2929 | spin_unlock(&res->spinlock); | ||
2930 | return nodenum; | ||
2931 | } | ||
2918 | spin_unlock(&res->spinlock); | 2932 | spin_unlock(&res->spinlock); |
2919 | mlog(0, "have not found a suitable target yet! checking domain map\n"); | 2933 | mlog(0, "have not found a suitable target yet! checking domain map\n"); |
2920 | 2934 | ||
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 77b4c04a2809..f6cba566429d 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -2241,11 +2241,15 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
2241 | 2241 | ||
2242 | mutex_lock(&inode->i_mutex); | 2242 | mutex_lock(&inode->i_mutex); |
2243 | 2243 | ||
2244 | ocfs2_iocb_clear_sem_locked(iocb); | ||
2245 | |||
2244 | relock: | 2246 | relock: |
2245 | /* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */ | 2247 | /* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */ |
2246 | if (direct_io) { | 2248 | if (direct_io) { |
2247 | down_read(&inode->i_alloc_sem); | 2249 | down_read(&inode->i_alloc_sem); |
2248 | have_alloc_sem = 1; | 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 | /* |
@@ -2382,8 +2386,10 @@ out: | |||
2382 | ocfs2_rw_unlock(inode, rw_level); | 2386 | ocfs2_rw_unlock(inode, rw_level); |
2383 | 2387 | ||
2384 | out_sems: | 2388 | out_sems: |
2385 | if (have_alloc_sem) | 2389 | if (have_alloc_sem) { |
2386 | up_read(&inode->i_alloc_sem); | 2390 | up_read(&inode->i_alloc_sem); |
2391 | ocfs2_iocb_clear_sem_locked(iocb); | ||
2392 | } | ||
2387 | 2393 | ||
2388 | mutex_unlock(&inode->i_mutex); | 2394 | mutex_unlock(&inode->i_mutex); |
2389 | 2395 | ||
@@ -2527,6 +2533,8 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
2527 | goto bail; | 2533 | goto bail; |
2528 | } | 2534 | } |
2529 | 2535 | ||
2536 | ocfs2_iocb_clear_sem_locked(iocb); | ||
2537 | |||
2530 | /* | 2538 | /* |
2531 | * buffered reads protect themselves in ->readpage(). O_DIRECT reads | 2539 | * buffered reads protect themselves in ->readpage(). O_DIRECT reads |
2532 | * need locks to protect pending reads from racing with truncate. | 2540 | * need locks to protect pending reads from racing with truncate. |
@@ -2534,6 +2542,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
2534 | if (filp->f_flags & O_DIRECT) { | 2542 | if (filp->f_flags & O_DIRECT) { |
2535 | down_read(&inode->i_alloc_sem); | 2543 | down_read(&inode->i_alloc_sem); |
2536 | have_alloc_sem = 1; | 2544 | have_alloc_sem = 1; |
2545 | ocfs2_iocb_set_sem_locked(iocb); | ||
2537 | 2546 | ||
2538 | ret = ocfs2_rw_lock(inode, 0); | 2547 | ret = ocfs2_rw_lock(inode, 0); |
2539 | if (ret < 0) { | 2548 | if (ret < 0) { |
@@ -2575,8 +2584,10 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
2575 | } | 2584 | } |
2576 | 2585 | ||
2577 | bail: | 2586 | bail: |
2578 | if (have_alloc_sem) | 2587 | if (have_alloc_sem) { |
2579 | up_read(&inode->i_alloc_sem); | 2588 | up_read(&inode->i_alloc_sem); |
2589 | ocfs2_iocb_clear_sem_locked(iocb); | ||
2590 | } | ||
2580 | if (rw_level != -1) | 2591 | if (rw_level != -1) |
2581 | ocfs2_rw_unlock(inode, rw_level); | 2592 | ocfs2_rw_unlock(inode, rw_level); |
2582 | mlog_exit(ret); | 2593 | mlog_exit(ret); |
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index c2e4f8222e2f..bf2e7764920e 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -350,7 +350,7 @@ enum { | |||
350 | #define OCFS2_LAST_LOCAL_SYSTEM_INODE LOCAL_GROUP_QUOTA_SYSTEM_INODE | 350 | #define OCFS2_LAST_LOCAL_SYSTEM_INODE LOCAL_GROUP_QUOTA_SYSTEM_INODE |
351 | NUM_SYSTEM_INODES | 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 | #define NUM_LOCAL_SYSTEM_INODES \ | 354 | #define NUM_LOCAL_SYSTEM_INODES \ |
355 | (NUM_SYSTEM_INODES - OCFS2_FIRST_LOCAL_SYSTEM_INODE) | 355 | (NUM_SYSTEM_INODES - OCFS2_FIRST_LOCAL_SYSTEM_INODE) |
356 | 356 | ||