diff options
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 318 |
1 files changed, 65 insertions, 253 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index fd9734def551..825cb0ae1b4c 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -57,9 +57,6 @@ static int ocfs2_recover_node(struct ocfs2_super *osb, | |||
57 | static int __ocfs2_recovery_thread(void *arg); | 57 | static int __ocfs2_recovery_thread(void *arg); |
58 | static int ocfs2_commit_cache(struct ocfs2_super *osb); | 58 | static int ocfs2_commit_cache(struct ocfs2_super *osb); |
59 | static int ocfs2_wait_on_mount(struct ocfs2_super *osb); | 59 | static int ocfs2_wait_on_mount(struct ocfs2_super *osb); |
60 | static void ocfs2_handle_cleanup_locks(struct ocfs2_journal *journal, | ||
61 | struct ocfs2_journal_handle *handle); | ||
62 | static void ocfs2_commit_unstarted_handle(struct ocfs2_journal_handle *handle); | ||
63 | static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, | 60 | static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, |
64 | int dirty); | 61 | int dirty); |
65 | static int ocfs2_trylock_journal(struct ocfs2_super *osb, | 62 | static int ocfs2_trylock_journal(struct ocfs2_super *osb, |
@@ -113,46 +110,18 @@ finally: | |||
113 | return status; | 110 | return status; |
114 | } | 111 | } |
115 | 112 | ||
116 | struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb) | ||
117 | { | ||
118 | struct ocfs2_journal_handle *retval = NULL; | ||
119 | |||
120 | retval = kcalloc(1, sizeof(*retval), GFP_NOFS); | ||
121 | if (!retval) { | ||
122 | mlog(ML_ERROR, "Failed to allocate memory for journal " | ||
123 | "handle!\n"); | ||
124 | return NULL; | ||
125 | } | ||
126 | |||
127 | retval->max_buffs = 0; | ||
128 | retval->num_locks = 0; | ||
129 | retval->k_handle = NULL; | ||
130 | |||
131 | INIT_LIST_HEAD(&retval->locks); | ||
132 | INIT_LIST_HEAD(&retval->inode_list); | ||
133 | retval->journal = osb->journal; | ||
134 | |||
135 | return retval; | ||
136 | } | ||
137 | |||
138 | /* pass it NULL and it will allocate a new handle object for you. If | 113 | /* pass it NULL and it will allocate a new handle object for you. If |
139 | * you pass it a handle however, it may still return error, in which | 114 | * you pass it a handle however, it may still return error, in which |
140 | * case it has free'd the passed handle for you. */ | 115 | * case it has free'd the passed handle for you. */ |
141 | struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, | 116 | handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs) |
142 | struct ocfs2_journal_handle *handle, | ||
143 | int max_buffs) | ||
144 | { | 117 | { |
145 | int ret; | ||
146 | journal_t *journal = osb->journal->j_journal; | 118 | journal_t *journal = osb->journal->j_journal; |
147 | 119 | handle_t *handle; | |
148 | mlog_entry("(max_buffs = %d)\n", max_buffs); | ||
149 | 120 | ||
150 | BUG_ON(!osb || !osb->journal->j_journal); | 121 | BUG_ON(!osb || !osb->journal->j_journal); |
151 | 122 | ||
152 | if (ocfs2_is_hard_readonly(osb)) { | 123 | if (ocfs2_is_hard_readonly(osb)) |
153 | ret = -EROFS; | 124 | return ERR_PTR(-EROFS); |
154 | goto done_free; | ||
155 | } | ||
156 | 125 | ||
157 | BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE); | 126 | BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE); |
158 | BUG_ON(max_buffs <= 0); | 127 | BUG_ON(max_buffs <= 0); |
@@ -163,154 +132,41 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, | |||
163 | BUG(); | 132 | BUG(); |
164 | } | 133 | } |
165 | 134 | ||
166 | if (!handle) | ||
167 | handle = ocfs2_alloc_handle(osb); | ||
168 | if (!handle) { | ||
169 | ret = -ENOMEM; | ||
170 | mlog(ML_ERROR, "Failed to allocate memory for journal " | ||
171 | "handle!\n"); | ||
172 | goto done_free; | ||
173 | } | ||
174 | |||
175 | handle->max_buffs = max_buffs; | ||
176 | |||
177 | down_read(&osb->journal->j_trans_barrier); | 135 | down_read(&osb->journal->j_trans_barrier); |
178 | 136 | ||
179 | /* actually start the transaction now */ | 137 | handle = journal_start(journal, max_buffs); |
180 | handle->k_handle = journal_start(journal, max_buffs); | 138 | if (IS_ERR(handle)) { |
181 | if (IS_ERR(handle->k_handle)) { | ||
182 | up_read(&osb->journal->j_trans_barrier); | 139 | up_read(&osb->journal->j_trans_barrier); |
183 | 140 | ||
184 | ret = PTR_ERR(handle->k_handle); | 141 | mlog_errno(PTR_ERR(handle)); |
185 | handle->k_handle = NULL; | ||
186 | mlog_errno(ret); | ||
187 | 142 | ||
188 | if (is_journal_aborted(journal)) { | 143 | if (is_journal_aborted(journal)) { |
189 | ocfs2_abort(osb->sb, "Detected aborted journal"); | 144 | ocfs2_abort(osb->sb, "Detected aborted journal"); |
190 | ret = -EROFS; | 145 | handle = ERR_PTR(-EROFS); |
191 | } | 146 | } |
192 | goto done_free; | 147 | } else { |
148 | if (!ocfs2_mount_local(osb)) | ||
149 | atomic_inc(&(osb->journal->j_num_trans)); | ||
193 | } | 150 | } |
194 | 151 | ||
195 | atomic_inc(&(osb->journal->j_num_trans)); | ||
196 | handle->flags |= OCFS2_HANDLE_STARTED; | ||
197 | |||
198 | mlog_exit_ptr(handle); | ||
199 | return handle; | 152 | return handle; |
200 | |||
201 | done_free: | ||
202 | if (handle) | ||
203 | ocfs2_commit_unstarted_handle(handle); /* will kfree handle */ | ||
204 | |||
205 | mlog_exit(ret); | ||
206 | return ERR_PTR(ret); | ||
207 | } | ||
208 | |||
209 | void ocfs2_handle_add_inode(struct ocfs2_journal_handle *handle, | ||
210 | struct inode *inode) | ||
211 | { | ||
212 | BUG_ON(!handle); | ||
213 | BUG_ON(!inode); | ||
214 | |||
215 | atomic_inc(&inode->i_count); | ||
216 | |||
217 | /* we're obviously changing it... */ | ||
218 | mutex_lock(&inode->i_mutex); | ||
219 | |||
220 | /* sanity check */ | ||
221 | BUG_ON(OCFS2_I(inode)->ip_handle); | ||
222 | BUG_ON(!list_empty(&OCFS2_I(inode)->ip_handle_list)); | ||
223 | |||
224 | OCFS2_I(inode)->ip_handle = handle; | ||
225 | list_move_tail(&(OCFS2_I(inode)->ip_handle_list), &(handle->inode_list)); | ||
226 | } | ||
227 | |||
228 | static void ocfs2_handle_unlock_inodes(struct ocfs2_journal_handle *handle) | ||
229 | { | ||
230 | struct list_head *p, *n; | ||
231 | struct inode *inode; | ||
232 | struct ocfs2_inode_info *oi; | ||
233 | |||
234 | list_for_each_safe(p, n, &handle->inode_list) { | ||
235 | oi = list_entry(p, struct ocfs2_inode_info, | ||
236 | ip_handle_list); | ||
237 | inode = &oi->vfs_inode; | ||
238 | |||
239 | OCFS2_I(inode)->ip_handle = NULL; | ||
240 | list_del_init(&OCFS2_I(inode)->ip_handle_list); | ||
241 | |||
242 | mutex_unlock(&inode->i_mutex); | ||
243 | iput(inode); | ||
244 | } | ||
245 | } | 153 | } |
246 | 154 | ||
247 | /* This is trivial so we do it out of the main commit | 155 | int ocfs2_commit_trans(struct ocfs2_super *osb, |
248 | * paths. Beware, it can be called from start_trans too! */ | 156 | handle_t *handle) |
249 | static void ocfs2_commit_unstarted_handle(struct ocfs2_journal_handle *handle) | ||
250 | { | 157 | { |
251 | mlog_entry_void(); | 158 | int ret; |
252 | 159 | struct ocfs2_journal *journal = osb->journal; | |
253 | BUG_ON(handle->flags & OCFS2_HANDLE_STARTED); | ||
254 | |||
255 | ocfs2_handle_unlock_inodes(handle); | ||
256 | /* You are allowed to add journal locks before the transaction | ||
257 | * has started. */ | ||
258 | ocfs2_handle_cleanup_locks(handle->journal, handle); | ||
259 | |||
260 | kfree(handle); | ||
261 | |||
262 | mlog_exit_void(); | ||
263 | } | ||
264 | |||
265 | void ocfs2_commit_trans(struct ocfs2_journal_handle *handle) | ||
266 | { | ||
267 | handle_t *jbd_handle; | ||
268 | int retval; | ||
269 | struct ocfs2_journal *journal = handle->journal; | ||
270 | |||
271 | mlog_entry_void(); | ||
272 | 160 | ||
273 | BUG_ON(!handle); | 161 | BUG_ON(!handle); |
274 | 162 | ||
275 | if (!(handle->flags & OCFS2_HANDLE_STARTED)) { | 163 | ret = journal_stop(handle); |
276 | ocfs2_commit_unstarted_handle(handle); | 164 | if (ret < 0) |
277 | mlog_exit_void(); | 165 | mlog_errno(ret); |
278 | return; | ||
279 | } | ||
280 | |||
281 | /* release inode semaphores we took during this transaction */ | ||
282 | ocfs2_handle_unlock_inodes(handle); | ||
283 | |||
284 | /* ocfs2_extend_trans may have had to call journal_restart | ||
285 | * which will always commit the transaction, but may return | ||
286 | * error for any number of reasons. If this is the case, we | ||
287 | * clear k_handle as it's not valid any more. */ | ||
288 | if (handle->k_handle) { | ||
289 | jbd_handle = handle->k_handle; | ||
290 | |||
291 | if (handle->flags & OCFS2_HANDLE_SYNC) | ||
292 | jbd_handle->h_sync = 1; | ||
293 | else | ||
294 | jbd_handle->h_sync = 0; | ||
295 | |||
296 | /* actually stop the transaction. if we've set h_sync, | ||
297 | * it'll have been committed when we return */ | ||
298 | retval = journal_stop(jbd_handle); | ||
299 | if (retval < 0) { | ||
300 | mlog_errno(retval); | ||
301 | mlog(ML_ERROR, "Could not commit transaction\n"); | ||
302 | BUG(); | ||
303 | } | ||
304 | |||
305 | handle->k_handle = NULL; /* it's been free'd in journal_stop */ | ||
306 | } | ||
307 | |||
308 | ocfs2_handle_cleanup_locks(journal, handle); | ||
309 | 166 | ||
310 | up_read(&journal->j_trans_barrier); | 167 | up_read(&journal->j_trans_barrier); |
311 | 168 | ||
312 | kfree(handle); | 169 | return ret; |
313 | mlog_exit_void(); | ||
314 | } | 170 | } |
315 | 171 | ||
316 | /* | 172 | /* |
@@ -326,20 +182,18 @@ void ocfs2_commit_trans(struct ocfs2_journal_handle *handle) | |||
326 | * good because transaction ids haven't yet been recorded on the | 182 | * good because transaction ids haven't yet been recorded on the |
327 | * cluster locks associated with this handle. | 183 | * cluster locks associated with this handle. |
328 | */ | 184 | */ |
329 | int ocfs2_extend_trans(struct ocfs2_journal_handle *handle, | 185 | int ocfs2_extend_trans(handle_t *handle, int nblocks) |
330 | int nblocks) | ||
331 | { | 186 | { |
332 | int status; | 187 | int status; |
333 | 188 | ||
334 | BUG_ON(!handle); | 189 | BUG_ON(!handle); |
335 | BUG_ON(!(handle->flags & OCFS2_HANDLE_STARTED)); | ||
336 | BUG_ON(!nblocks); | 190 | BUG_ON(!nblocks); |
337 | 191 | ||
338 | mlog_entry_void(); | 192 | mlog_entry_void(); |
339 | 193 | ||
340 | mlog(0, "Trying to extend transaction by %d blocks\n", nblocks); | 194 | mlog(0, "Trying to extend transaction by %d blocks\n", nblocks); |
341 | 195 | ||
342 | status = journal_extend(handle->k_handle, nblocks); | 196 | status = journal_extend(handle, nblocks); |
343 | if (status < 0) { | 197 | if (status < 0) { |
344 | mlog_errno(status); | 198 | mlog_errno(status); |
345 | goto bail; | 199 | goto bail; |
@@ -347,15 +201,12 @@ int ocfs2_extend_trans(struct ocfs2_journal_handle *handle, | |||
347 | 201 | ||
348 | if (status > 0) { | 202 | if (status > 0) { |
349 | mlog(0, "journal_extend failed, trying journal_restart\n"); | 203 | mlog(0, "journal_extend failed, trying journal_restart\n"); |
350 | status = journal_restart(handle->k_handle, nblocks); | 204 | status = journal_restart(handle, nblocks); |
351 | if (status < 0) { | 205 | if (status < 0) { |
352 | handle->k_handle = NULL; | ||
353 | mlog_errno(status); | 206 | mlog_errno(status); |
354 | goto bail; | 207 | goto bail; |
355 | } | 208 | } |
356 | handle->max_buffs = nblocks; | 209 | } |
357 | } else | ||
358 | handle->max_buffs += nblocks; | ||
359 | 210 | ||
360 | status = 0; | 211 | status = 0; |
361 | bail: | 212 | bail: |
@@ -364,7 +215,7 @@ bail: | |||
364 | return status; | 215 | return status; |
365 | } | 216 | } |
366 | 217 | ||
367 | int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | 218 | int ocfs2_journal_access(handle_t *handle, |
368 | struct inode *inode, | 219 | struct inode *inode, |
369 | struct buffer_head *bh, | 220 | struct buffer_head *bh, |
370 | int type) | 221 | int type) |
@@ -374,7 +225,6 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | |||
374 | BUG_ON(!inode); | 225 | BUG_ON(!inode); |
375 | BUG_ON(!handle); | 226 | BUG_ON(!handle); |
376 | BUG_ON(!bh); | 227 | BUG_ON(!bh); |
377 | BUG_ON(!(handle->flags & OCFS2_HANDLE_STARTED)); | ||
378 | 228 | ||
379 | mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %zu\n", | 229 | mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %zu\n", |
380 | (unsigned long long)bh->b_blocknr, type, | 230 | (unsigned long long)bh->b_blocknr, type, |
@@ -403,11 +253,11 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | |||
403 | switch (type) { | 253 | switch (type) { |
404 | case OCFS2_JOURNAL_ACCESS_CREATE: | 254 | case OCFS2_JOURNAL_ACCESS_CREATE: |
405 | case OCFS2_JOURNAL_ACCESS_WRITE: | 255 | case OCFS2_JOURNAL_ACCESS_WRITE: |
406 | status = journal_get_write_access(handle->k_handle, bh); | 256 | status = journal_get_write_access(handle, bh); |
407 | break; | 257 | break; |
408 | 258 | ||
409 | case OCFS2_JOURNAL_ACCESS_UNDO: | 259 | case OCFS2_JOURNAL_ACCESS_UNDO: |
410 | status = journal_get_undo_access(handle->k_handle, bh); | 260 | status = journal_get_undo_access(handle, bh); |
411 | break; | 261 | break; |
412 | 262 | ||
413 | default: | 263 | default: |
@@ -424,17 +274,15 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | |||
424 | return status; | 274 | return status; |
425 | } | 275 | } |
426 | 276 | ||
427 | int ocfs2_journal_dirty(struct ocfs2_journal_handle *handle, | 277 | int ocfs2_journal_dirty(handle_t *handle, |
428 | struct buffer_head *bh) | 278 | struct buffer_head *bh) |
429 | { | 279 | { |
430 | int status; | 280 | int status; |
431 | 281 | ||
432 | BUG_ON(!(handle->flags & OCFS2_HANDLE_STARTED)); | ||
433 | |||
434 | mlog_entry("(bh->b_blocknr=%llu)\n", | 282 | mlog_entry("(bh->b_blocknr=%llu)\n", |
435 | (unsigned long long)bh->b_blocknr); | 283 | (unsigned long long)bh->b_blocknr); |
436 | 284 | ||
437 | status = journal_dirty_metadata(handle->k_handle, bh); | 285 | status = journal_dirty_metadata(handle, bh); |
438 | if (status < 0) | 286 | if (status < 0) |
439 | mlog(ML_ERROR, "Could not dirty metadata buffer. " | 287 | mlog(ML_ERROR, "Could not dirty metadata buffer. " |
440 | "(bh->b_blocknr=%llu)\n", | 288 | "(bh->b_blocknr=%llu)\n", |
@@ -456,59 +304,6 @@ int ocfs2_journal_dirty_data(handle_t *handle, | |||
456 | return err; | 304 | return err; |
457 | } | 305 | } |
458 | 306 | ||
459 | /* We always assume you're adding a metadata lock at level 'ex' */ | ||
460 | int ocfs2_handle_add_lock(struct ocfs2_journal_handle *handle, | ||
461 | struct inode *inode) | ||
462 | { | ||
463 | int status; | ||
464 | struct ocfs2_journal_lock *lock; | ||
465 | |||
466 | BUG_ON(!inode); | ||
467 | |||
468 | lock = kmem_cache_alloc(ocfs2_lock_cache, GFP_NOFS); | ||
469 | if (!lock) { | ||
470 | status = -ENOMEM; | ||
471 | mlog_errno(-ENOMEM); | ||
472 | goto bail; | ||
473 | } | ||
474 | |||
475 | if (!igrab(inode)) | ||
476 | BUG(); | ||
477 | lock->jl_inode = inode; | ||
478 | |||
479 | list_add_tail(&(lock->jl_lock_list), &(handle->locks)); | ||
480 | handle->num_locks++; | ||
481 | |||
482 | status = 0; | ||
483 | bail: | ||
484 | mlog_exit(status); | ||
485 | return status; | ||
486 | } | ||
487 | |||
488 | static void ocfs2_handle_cleanup_locks(struct ocfs2_journal *journal, | ||
489 | struct ocfs2_journal_handle *handle) | ||
490 | { | ||
491 | struct list_head *p, *n; | ||
492 | struct ocfs2_journal_lock *lock; | ||
493 | struct inode *inode; | ||
494 | |||
495 | list_for_each_safe(p, n, &(handle->locks)) { | ||
496 | lock = list_entry(p, struct ocfs2_journal_lock, | ||
497 | jl_lock_list); | ||
498 | list_del(&lock->jl_lock_list); | ||
499 | handle->num_locks--; | ||
500 | |||
501 | inode = lock->jl_inode; | ||
502 | ocfs2_meta_unlock(inode, 1); | ||
503 | if (atomic_read(&inode->i_count) == 1) | ||
504 | mlog(ML_ERROR, | ||
505 | "Inode %llu, I'm doing a last iput for!", | ||
506 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
507 | iput(inode); | ||
508 | kmem_cache_free(ocfs2_lock_cache, lock); | ||
509 | } | ||
510 | } | ||
511 | |||
512 | #define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * 5) | 307 | #define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * 5) |
513 | 308 | ||
514 | void ocfs2_set_journal_params(struct ocfs2_super *osb) | 309 | void ocfs2_set_journal_params(struct ocfs2_super *osb) |
@@ -562,8 +357,7 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty) | |||
562 | /* Skip recovery waits here - journal inode metadata never | 357 | /* Skip recovery waits here - journal inode metadata never |
563 | * changes in a live cluster so it can be considered an | 358 | * changes in a live cluster so it can be considered an |
564 | * exception to the rule. */ | 359 | * exception to the rule. */ |
565 | status = ocfs2_meta_lock_full(inode, NULL, &bh, 1, | 360 | status = ocfs2_meta_lock_full(inode, &bh, 1, OCFS2_META_LOCK_RECOVERY); |
566 | OCFS2_META_LOCK_RECOVERY); | ||
567 | if (status < 0) { | 361 | if (status < 0) { |
568 | if (status != -ERESTARTSYS) | 362 | if (status != -ERESTARTSYS) |
569 | mlog(ML_ERROR, "Could not get lock on journal!\n"); | 363 | mlog(ML_ERROR, "Could not get lock on journal!\n"); |
@@ -715,9 +509,23 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
715 | 509 | ||
716 | BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0); | 510 | BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0); |
717 | 511 | ||
718 | status = ocfs2_journal_toggle_dirty(osb, 0); | 512 | if (ocfs2_mount_local(osb)) { |
719 | if (status < 0) | 513 | journal_lock_updates(journal->j_journal); |
720 | mlog_errno(status); | 514 | status = journal_flush(journal->j_journal); |
515 | journal_unlock_updates(journal->j_journal); | ||
516 | if (status < 0) | ||
517 | mlog_errno(status); | ||
518 | } | ||
519 | |||
520 | if (status == 0) { | ||
521 | /* | ||
522 | * Do not toggle if flush was unsuccessful otherwise | ||
523 | * will leave dirty metadata in a "clean" journal | ||
524 | */ | ||
525 | status = ocfs2_journal_toggle_dirty(osb, 0); | ||
526 | if (status < 0) | ||
527 | mlog_errno(status); | ||
528 | } | ||
721 | 529 | ||
722 | /* Shutdown the kernel journal system */ | 530 | /* Shutdown the kernel journal system */ |
723 | journal_destroy(journal->j_journal); | 531 | journal_destroy(journal->j_journal); |
@@ -757,7 +565,7 @@ static void ocfs2_clear_journal_error(struct super_block *sb, | |||
757 | } | 565 | } |
758 | } | 566 | } |
759 | 567 | ||
760 | int ocfs2_journal_load(struct ocfs2_journal *journal) | 568 | int ocfs2_journal_load(struct ocfs2_journal *journal, int local) |
761 | { | 569 | { |
762 | int status = 0; | 570 | int status = 0; |
763 | struct ocfs2_super *osb; | 571 | struct ocfs2_super *osb; |
@@ -784,14 +592,18 @@ int ocfs2_journal_load(struct ocfs2_journal *journal) | |||
784 | } | 592 | } |
785 | 593 | ||
786 | /* Launch the commit thread */ | 594 | /* Launch the commit thread */ |
787 | osb->commit_task = kthread_run(ocfs2_commit_thread, osb, "ocfs2cmt"); | 595 | if (!local) { |
788 | if (IS_ERR(osb->commit_task)) { | 596 | osb->commit_task = kthread_run(ocfs2_commit_thread, osb, |
789 | status = PTR_ERR(osb->commit_task); | 597 | "ocfs2cmt"); |
598 | if (IS_ERR(osb->commit_task)) { | ||
599 | status = PTR_ERR(osb->commit_task); | ||
600 | osb->commit_task = NULL; | ||
601 | mlog(ML_ERROR, "unable to launch ocfs2commit thread, " | ||
602 | "error=%d", status); | ||
603 | goto done; | ||
604 | } | ||
605 | } else | ||
790 | osb->commit_task = NULL; | 606 | osb->commit_task = NULL; |
791 | mlog(ML_ERROR, "unable to launch ocfs2commit thread, error=%d", | ||
792 | status); | ||
793 | goto done; | ||
794 | } | ||
795 | 607 | ||
796 | done: | 608 | done: |
797 | mlog_exit(status); | 609 | mlog_exit(status); |
@@ -911,11 +723,12 @@ struct ocfs2_la_recovery_item { | |||
911 | * NOTE: This function can and will sleep on recovery of other nodes | 723 | * NOTE: This function can and will sleep on recovery of other nodes |
912 | * during cluster locking, just like any other ocfs2 process. | 724 | * during cluster locking, just like any other ocfs2 process. |
913 | */ | 725 | */ |
914 | void ocfs2_complete_recovery(void *data) | 726 | void ocfs2_complete_recovery(struct work_struct *work) |
915 | { | 727 | { |
916 | int ret; | 728 | int ret; |
917 | struct ocfs2_super *osb = data; | 729 | struct ocfs2_journal *journal = |
918 | struct ocfs2_journal *journal = osb->journal; | 730 | container_of(work, struct ocfs2_journal, j_recovery_work); |
731 | struct ocfs2_super *osb = journal->j_osb; | ||
919 | struct ocfs2_dinode *la_dinode, *tl_dinode; | 732 | struct ocfs2_dinode *la_dinode, *tl_dinode; |
920 | struct ocfs2_la_recovery_item *item; | 733 | struct ocfs2_la_recovery_item *item; |
921 | struct list_head *p, *n; | 734 | struct list_head *p, *n; |
@@ -1160,8 +973,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
1160 | } | 973 | } |
1161 | SET_INODE_JOURNAL(inode); | 974 | SET_INODE_JOURNAL(inode); |
1162 | 975 | ||
1163 | status = ocfs2_meta_lock_full(inode, NULL, &bh, 1, | 976 | status = ocfs2_meta_lock_full(inode, &bh, 1, OCFS2_META_LOCK_RECOVERY); |
1164 | OCFS2_META_LOCK_RECOVERY); | ||
1165 | if (status < 0) { | 977 | if (status < 0) { |
1166 | mlog(0, "status returned from ocfs2_meta_lock=%d\n", status); | 978 | mlog(0, "status returned from ocfs2_meta_lock=%d\n", status); |
1167 | if (status != -ERESTARTSYS) | 979 | if (status != -ERESTARTSYS) |
@@ -1350,7 +1162,7 @@ static int ocfs2_trylock_journal(struct ocfs2_super *osb, | |||
1350 | SET_INODE_JOURNAL(inode); | 1162 | SET_INODE_JOURNAL(inode); |
1351 | 1163 | ||
1352 | flags = OCFS2_META_LOCK_RECOVERY | OCFS2_META_LOCK_NOQUEUE; | 1164 | flags = OCFS2_META_LOCK_RECOVERY | OCFS2_META_LOCK_NOQUEUE; |
1353 | status = ocfs2_meta_lock_full(inode, NULL, NULL, 1, flags); | 1165 | status = ocfs2_meta_lock_full(inode, NULL, 1, flags); |
1354 | if (status < 0) { | 1166 | if (status < 0) { |
1355 | if (status != -EAGAIN) | 1167 | if (status != -EAGAIN) |
1356 | mlog_errno(status); | 1168 | mlog_errno(status); |
@@ -1433,7 +1245,7 @@ static int ocfs2_queue_orphans(struct ocfs2_super *osb, | |||
1433 | } | 1245 | } |
1434 | 1246 | ||
1435 | mutex_lock(&orphan_dir_inode->i_mutex); | 1247 | mutex_lock(&orphan_dir_inode->i_mutex); |
1436 | status = ocfs2_meta_lock(orphan_dir_inode, NULL, NULL, 0); | 1248 | status = ocfs2_meta_lock(orphan_dir_inode, NULL, 0); |
1437 | if (status < 0) { | 1249 | if (status < 0) { |
1438 | mlog_errno(status); | 1250 | mlog_errno(status); |
1439 | goto out; | 1251 | goto out; |