diff options
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/alloc.c | 27 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 12 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmthread.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmunlock.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/dlmglue.c | 11 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2.h | 3 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 8 | ||||
-rw-r--r-- | fs/ocfs2/xattr.c | 27 |
8 files changed, 71 insertions, 24 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 60fe74035db5..3a9e5deed74d 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -4796,6 +4796,29 @@ out: | |||
4796 | return ret; | 4796 | return ret; |
4797 | } | 4797 | } |
4798 | 4798 | ||
4799 | static int ocfs2_replace_extent_rec(struct inode *inode, | ||
4800 | handle_t *handle, | ||
4801 | struct ocfs2_path *path, | ||
4802 | struct ocfs2_extent_list *el, | ||
4803 | int split_index, | ||
4804 | struct ocfs2_extent_rec *split_rec) | ||
4805 | { | ||
4806 | int ret; | ||
4807 | |||
4808 | ret = ocfs2_path_bh_journal_access(handle, inode, path, | ||
4809 | path_num_items(path) - 1); | ||
4810 | if (ret) { | ||
4811 | mlog_errno(ret); | ||
4812 | goto out; | ||
4813 | } | ||
4814 | |||
4815 | el->l_recs[split_index] = *split_rec; | ||
4816 | |||
4817 | ocfs2_journal_dirty(handle, path_leaf_bh(path)); | ||
4818 | out: | ||
4819 | return ret; | ||
4820 | } | ||
4821 | |||
4799 | /* | 4822 | /* |
4800 | * Mark part or all of the extent record at split_index in the leaf | 4823 | * Mark part or all of the extent record at split_index in the leaf |
4801 | * pointed to by path as written. This removes the unwritten | 4824 | * pointed to by path as written. This removes the unwritten |
@@ -4885,7 +4908,9 @@ static int __ocfs2_mark_extent_written(struct inode *inode, | |||
4885 | 4908 | ||
4886 | if (ctxt.c_contig_type == CONTIG_NONE) { | 4909 | if (ctxt.c_contig_type == CONTIG_NONE) { |
4887 | if (ctxt.c_split_covers_rec) | 4910 | if (ctxt.c_split_covers_rec) |
4888 | el->l_recs[split_index] = *split_rec; | 4911 | ret = ocfs2_replace_extent_rec(inode, handle, |
4912 | path, el, | ||
4913 | split_index, split_rec); | ||
4889 | else | 4914 | else |
4890 | ret = ocfs2_split_and_insert(inode, handle, path, et, | 4915 | ret = ocfs2_split_and_insert(inode, handle, path, et, |
4891 | &last_eb_bh, split_index, | 4916 | &last_eb_bh, split_index, |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 54e182a27caf..0a2813947853 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -1849,12 +1849,12 @@ int dlm_assert_master_handler(struct o2net_msg *msg, u32 len, void *data, | |||
1849 | if (!mle) { | 1849 | if (!mle) { |
1850 | if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN && | 1850 | if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN && |
1851 | res->owner != assert->node_idx) { | 1851 | res->owner != assert->node_idx) { |
1852 | mlog(ML_ERROR, "assert_master from " | 1852 | mlog(ML_ERROR, "DIE! Mastery assert from %u, " |
1853 | "%u, but current owner is " | 1853 | "but current owner is %u! (%.*s)\n", |
1854 | "%u! (%.*s)\n", | 1854 | assert->node_idx, res->owner, namelen, |
1855 | assert->node_idx, res->owner, | 1855 | name); |
1856 | namelen, name); | 1856 | __dlm_print_one_lock_resource(res); |
1857 | goto kill; | 1857 | BUG(); |
1858 | } | 1858 | } |
1859 | } else if (mle->type != DLM_MLE_MIGRATION) { | 1859 | } else if (mle->type != DLM_MLE_MIGRATION) { |
1860 | if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN) { | 1860 | if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN) { |
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c index d1295203029f..4060bb328bc8 100644 --- a/fs/ocfs2/dlm/dlmthread.c +++ b/fs/ocfs2/dlm/dlmthread.c | |||
@@ -181,8 +181,7 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm, | |||
181 | 181 | ||
182 | spin_lock(&res->spinlock); | 182 | spin_lock(&res->spinlock); |
183 | /* This ensures that clear refmap is sent after the set */ | 183 | /* This ensures that clear refmap is sent after the set */ |
184 | __dlm_wait_on_lockres_flags(res, (DLM_LOCK_RES_SETREF_INPROG | | 184 | __dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_SETREF_INPROG); |
185 | DLM_LOCK_RES_MIGRATING)); | ||
186 | spin_unlock(&res->spinlock); | 185 | spin_unlock(&res->spinlock); |
187 | 186 | ||
188 | /* clear our bit from the master's refmap, ignore errors */ | 187 | /* clear our bit from the master's refmap, ignore errors */ |
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c index 86ca085ef324..fcf879ed6930 100644 --- a/fs/ocfs2/dlm/dlmunlock.c +++ b/fs/ocfs2/dlm/dlmunlock.c | |||
@@ -117,11 +117,11 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, | |||
117 | else | 117 | else |
118 | BUG_ON(res->owner == dlm->node_num); | 118 | BUG_ON(res->owner == dlm->node_num); |
119 | 119 | ||
120 | spin_lock(&dlm->spinlock); | 120 | spin_lock(&dlm->ast_lock); |
121 | /* We want to be sure that we're not freeing a lock | 121 | /* We want to be sure that we're not freeing a lock |
122 | * that still has AST's pending... */ | 122 | * that still has AST's pending... */ |
123 | in_use = !list_empty(&lock->ast_list); | 123 | in_use = !list_empty(&lock->ast_list); |
124 | spin_unlock(&dlm->spinlock); | 124 | spin_unlock(&dlm->ast_lock); |
125 | if (in_use) { | 125 | if (in_use) { |
126 | mlog(ML_ERROR, "lockres %.*s: Someone is calling dlmunlock " | 126 | mlog(ML_ERROR, "lockres %.*s: Someone is calling dlmunlock " |
127 | "while waiting for an ast!", res->lockname.len, | 127 | "while waiting for an ast!", res->lockname.len, |
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 206a2370876a..7219a86d34cc 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -320,9 +320,14 @@ static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb, | |||
320 | struct ocfs2_lock_res *lockres); | 320 | struct ocfs2_lock_res *lockres); |
321 | static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres, | 321 | static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres, |
322 | int convert); | 322 | int convert); |
323 | #define ocfs2_log_dlm_error(_func, _err, _lockres) do { \ | 323 | #define ocfs2_log_dlm_error(_func, _err, _lockres) do { \ |
324 | mlog(ML_ERROR, "DLM error %d while calling %s on resource %s\n", \ | 324 | if ((_lockres)->l_type != OCFS2_LOCK_TYPE_DENTRY) \ |
325 | _err, _func, _lockres->l_name); \ | 325 | mlog(ML_ERROR, "DLM error %d while calling %s on resource %s\n", \ |
326 | _err, _func, _lockres->l_name); \ | ||
327 | else \ | ||
328 | mlog(ML_ERROR, "DLM error %d while calling %s on resource %.*s%08x\n", \ | ||
329 | _err, _func, OCFS2_DENTRY_LOCK_INO_START - 1, (_lockres)->l_name, \ | ||
330 | (unsigned int)ocfs2_get_dentry_lock_ino(_lockres)); \ | ||
326 | } while (0) | 331 | } while (0) |
327 | static int ocfs2_downconvert_thread(void *arg); | 332 | static int ocfs2_downconvert_thread(void *arg); |
328 | static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, | 333 | static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index 077384135f4e..946d3c34b90b 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -341,6 +341,9 @@ struct ocfs2_super | |||
341 | struct ocfs2_node_map osb_recovering_orphan_dirs; | 341 | struct ocfs2_node_map osb_recovering_orphan_dirs; |
342 | unsigned int *osb_orphan_wipes; | 342 | unsigned int *osb_orphan_wipes; |
343 | wait_queue_head_t osb_wipe_event; | 343 | wait_queue_head_t osb_wipe_event; |
344 | |||
345 | /* used to protect metaecc calculation check of xattr. */ | ||
346 | spinlock_t osb_xattr_lock; | ||
344 | }; | 347 | }; |
345 | 348 | ||
346 | #define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) | 349 | #define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index b1cb38fbe807..7ac83a81ee55 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1537,6 +1537,13 @@ static int ocfs2_get_sector(struct super_block *sb, | |||
1537 | unlock_buffer(*bh); | 1537 | unlock_buffer(*bh); |
1538 | ll_rw_block(READ, 1, bh); | 1538 | ll_rw_block(READ, 1, bh); |
1539 | wait_on_buffer(*bh); | 1539 | wait_on_buffer(*bh); |
1540 | if (!buffer_uptodate(*bh)) { | ||
1541 | mlog_errno(-EIO); | ||
1542 | brelse(*bh); | ||
1543 | *bh = NULL; | ||
1544 | return -EIO; | ||
1545 | } | ||
1546 | |||
1540 | return 0; | 1547 | return 0; |
1541 | } | 1548 | } |
1542 | 1549 | ||
@@ -1747,6 +1754,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1747 | INIT_LIST_HEAD(&osb->blocked_lock_list); | 1754 | INIT_LIST_HEAD(&osb->blocked_lock_list); |
1748 | osb->blocked_lock_count = 0; | 1755 | osb->blocked_lock_count = 0; |
1749 | spin_lock_init(&osb->osb_lock); | 1756 | spin_lock_init(&osb->osb_lock); |
1757 | spin_lock_init(&osb->osb_xattr_lock); | ||
1750 | ocfs2_init_inode_steal_slot(osb); | 1758 | ocfs2_init_inode_steal_slot(osb); |
1751 | 1759 | ||
1752 | atomic_set(&osb->alloc_stats.moves, 0); | 1760 | atomic_set(&osb->alloc_stats.moves, 0); |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 915039fffe6e..4ddd788add67 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -82,13 +82,14 @@ struct ocfs2_xattr_set_ctxt { | |||
82 | 82 | ||
83 | #define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root)) | 83 | #define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root)) |
84 | #define OCFS2_XATTR_INLINE_SIZE 80 | 84 | #define OCFS2_XATTR_INLINE_SIZE 80 |
85 | #define OCFS2_XATTR_HEADER_GAP 4 | ||
85 | #define OCFS2_XATTR_FREE_IN_IBODY (OCFS2_MIN_XATTR_INLINE_SIZE \ | 86 | #define OCFS2_XATTR_FREE_IN_IBODY (OCFS2_MIN_XATTR_INLINE_SIZE \ |
86 | - sizeof(struct ocfs2_xattr_header) \ | 87 | - sizeof(struct ocfs2_xattr_header) \ |
87 | - sizeof(__u32)) | 88 | - OCFS2_XATTR_HEADER_GAP) |
88 | #define OCFS2_XATTR_FREE_IN_BLOCK(ptr) ((ptr)->i_sb->s_blocksize \ | 89 | #define OCFS2_XATTR_FREE_IN_BLOCK(ptr) ((ptr)->i_sb->s_blocksize \ |
89 | - sizeof(struct ocfs2_xattr_block) \ | 90 | - sizeof(struct ocfs2_xattr_block) \ |
90 | - sizeof(struct ocfs2_xattr_header) \ | 91 | - sizeof(struct ocfs2_xattr_header) \ |
91 | - sizeof(__u32)) | 92 | - OCFS2_XATTR_HEADER_GAP) |
92 | 93 | ||
93 | static struct ocfs2_xattr_def_value_root def_xv = { | 94 | static struct ocfs2_xattr_def_value_root def_xv = { |
94 | .xv.xr_list.l_count = cpu_to_le16(1), | 95 | .xv.xr_list.l_count = cpu_to_le16(1), |
@@ -274,10 +275,12 @@ static int ocfs2_read_xattr_bucket(struct ocfs2_xattr_bucket *bucket, | |||
274 | bucket->bu_blocks, bucket->bu_bhs, 0, | 275 | bucket->bu_blocks, bucket->bu_bhs, 0, |
275 | NULL); | 276 | NULL); |
276 | if (!rc) { | 277 | if (!rc) { |
278 | spin_lock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock); | ||
277 | rc = ocfs2_validate_meta_ecc_bhs(bucket->bu_inode->i_sb, | 279 | rc = ocfs2_validate_meta_ecc_bhs(bucket->bu_inode->i_sb, |
278 | bucket->bu_bhs, | 280 | bucket->bu_bhs, |
279 | bucket->bu_blocks, | 281 | bucket->bu_blocks, |
280 | &bucket_xh(bucket)->xh_check); | 282 | &bucket_xh(bucket)->xh_check); |
283 | spin_unlock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock); | ||
281 | if (rc) | 284 | if (rc) |
282 | mlog_errno(rc); | 285 | mlog_errno(rc); |
283 | } | 286 | } |
@@ -310,9 +313,11 @@ static void ocfs2_xattr_bucket_journal_dirty(handle_t *handle, | |||
310 | { | 313 | { |
311 | int i; | 314 | int i; |
312 | 315 | ||
316 | spin_lock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock); | ||
313 | ocfs2_compute_meta_ecc_bhs(bucket->bu_inode->i_sb, | 317 | ocfs2_compute_meta_ecc_bhs(bucket->bu_inode->i_sb, |
314 | bucket->bu_bhs, bucket->bu_blocks, | 318 | bucket->bu_bhs, bucket->bu_blocks, |
315 | &bucket_xh(bucket)->xh_check); | 319 | &bucket_xh(bucket)->xh_check); |
320 | spin_unlock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock); | ||
316 | 321 | ||
317 | for (i = 0; i < bucket->bu_blocks; i++) | 322 | for (i = 0; i < bucket->bu_blocks; i++) |
318 | ocfs2_journal_dirty(handle, bucket->bu_bhs[i]); | 323 | ocfs2_journal_dirty(handle, bucket->bu_bhs[i]); |
@@ -1507,7 +1512,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode, | |||
1507 | last += 1; | 1512 | last += 1; |
1508 | } | 1513 | } |
1509 | 1514 | ||
1510 | free = min_offs - ((void *)last - xs->base) - sizeof(__u32); | 1515 | free = min_offs - ((void *)last - xs->base) - OCFS2_XATTR_HEADER_GAP; |
1511 | if (free < 0) | 1516 | if (free < 0) |
1512 | return -EIO; | 1517 | return -EIO; |
1513 | 1518 | ||
@@ -2190,7 +2195,7 @@ static int ocfs2_xattr_can_be_in_inode(struct inode *inode, | |||
2190 | last += 1; | 2195 | last += 1; |
2191 | } | 2196 | } |
2192 | 2197 | ||
2193 | free = min_offs - ((void *)last - xs->base) - sizeof(__u32); | 2198 | free = min_offs - ((void *)last - xs->base) - OCFS2_XATTR_HEADER_GAP; |
2194 | if (free < 0) | 2199 | if (free < 0) |
2195 | return 0; | 2200 | return 0; |
2196 | 2201 | ||
@@ -2592,8 +2597,9 @@ static int __ocfs2_xattr_set_handle(struct inode *inode, | |||
2592 | 2597 | ||
2593 | if (!ret) { | 2598 | if (!ret) { |
2594 | /* Update inode ctime. */ | 2599 | /* Update inode ctime. */ |
2595 | ret = ocfs2_journal_access(ctxt->handle, inode, xis->inode_bh, | 2600 | ret = ocfs2_journal_access_di(ctxt->handle, inode, |
2596 | OCFS2_JOURNAL_ACCESS_WRITE); | 2601 | xis->inode_bh, |
2602 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
2597 | if (ret) { | 2603 | if (ret) { |
2598 | mlog_errno(ret); | 2604 | mlog_errno(ret); |
2599 | goto out; | 2605 | goto out; |
@@ -5060,8 +5066,8 @@ try_again: | |||
5060 | xh_free_start = le16_to_cpu(xh->xh_free_start); | 5066 | xh_free_start = le16_to_cpu(xh->xh_free_start); |
5061 | header_size = sizeof(struct ocfs2_xattr_header) + | 5067 | header_size = sizeof(struct ocfs2_xattr_header) + |
5062 | count * sizeof(struct ocfs2_xattr_entry); | 5068 | count * sizeof(struct ocfs2_xattr_entry); |
5063 | max_free = OCFS2_XATTR_BUCKET_SIZE - | 5069 | max_free = OCFS2_XATTR_BUCKET_SIZE - header_size - |
5064 | le16_to_cpu(xh->xh_name_value_len) - header_size; | 5070 | le16_to_cpu(xh->xh_name_value_len) - OCFS2_XATTR_HEADER_GAP; |
5065 | 5071 | ||
5066 | mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size " | 5072 | mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size " |
5067 | "of %u which exceed block size\n", | 5073 | "of %u which exceed block size\n", |
@@ -5094,7 +5100,7 @@ try_again: | |||
5094 | need = 0; | 5100 | need = 0; |
5095 | } | 5101 | } |
5096 | 5102 | ||
5097 | free = xh_free_start - header_size; | 5103 | free = xh_free_start - header_size - OCFS2_XATTR_HEADER_GAP; |
5098 | /* | 5104 | /* |
5099 | * We need to make sure the new name/value pair | 5105 | * We need to make sure the new name/value pair |
5100 | * can exist in the same block. | 5106 | * can exist in the same block. |
@@ -5127,7 +5133,8 @@ try_again: | |||
5127 | } | 5133 | } |
5128 | 5134 | ||
5129 | xh_free_start = le16_to_cpu(xh->xh_free_start); | 5135 | xh_free_start = le16_to_cpu(xh->xh_free_start); |
5130 | free = xh_free_start - header_size; | 5136 | free = xh_free_start - header_size |
5137 | - OCFS2_XATTR_HEADER_GAP; | ||
5131 | if (xh_free_start % blocksize < need) | 5138 | if (xh_free_start % blocksize < need) |
5132 | free -= xh_free_start % blocksize; | 5139 | free -= xh_free_start % blocksize; |
5133 | 5140 | ||