diff options
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r-- | fs/xfs/xfs_log.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 4c86a26330a..b3ac3805d3c 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -498,11 +498,14 @@ xfs_log_reserve(xfs_mount_t *mp, | |||
498 | * Return error or zero. | 498 | * Return error or zero. |
499 | */ | 499 | */ |
500 | int | 500 | int |
501 | xfs_log_mount(xfs_mount_t *mp, | 501 | xfs_log_mount( |
502 | xfs_buftarg_t *log_target, | 502 | xfs_mount_t *mp, |
503 | xfs_daddr_t blk_offset, | 503 | xfs_buftarg_t *log_target, |
504 | int num_bblks) | 504 | xfs_daddr_t blk_offset, |
505 | int num_bblks) | ||
505 | { | 506 | { |
507 | int error; | ||
508 | |||
506 | if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) | 509 | if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) |
507 | cmn_err(CE_NOTE, "XFS mounting filesystem %s", mp->m_fsname); | 510 | cmn_err(CE_NOTE, "XFS mounting filesystem %s", mp->m_fsname); |
508 | else { | 511 | else { |
@@ -515,11 +518,21 @@ xfs_log_mount(xfs_mount_t *mp, | |||
515 | mp->m_log = xlog_alloc_log(mp, log_target, blk_offset, num_bblks); | 518 | mp->m_log = xlog_alloc_log(mp, log_target, blk_offset, num_bblks); |
516 | 519 | ||
517 | /* | 520 | /* |
521 | * Initialize the AIL now we have a log. | ||
522 | */ | ||
523 | spin_lock_init(&mp->m_ail_lock); | ||
524 | error = xfs_trans_ail_init(mp); | ||
525 | if (error) { | ||
526 | cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error); | ||
527 | goto error; | ||
528 | } | ||
529 | |||
530 | /* | ||
518 | * skip log recovery on a norecovery mount. pretend it all | 531 | * skip log recovery on a norecovery mount. pretend it all |
519 | * just worked. | 532 | * just worked. |
520 | */ | 533 | */ |
521 | if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) { | 534 | if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) { |
522 | int error, readonly = (mp->m_flags & XFS_MOUNT_RDONLY); | 535 | int readonly = (mp->m_flags & XFS_MOUNT_RDONLY); |
523 | 536 | ||
524 | if (readonly) | 537 | if (readonly) |
525 | mp->m_flags &= ~XFS_MOUNT_RDONLY; | 538 | mp->m_flags &= ~XFS_MOUNT_RDONLY; |
@@ -530,8 +543,7 @@ xfs_log_mount(xfs_mount_t *mp, | |||
530 | mp->m_flags |= XFS_MOUNT_RDONLY; | 543 | mp->m_flags |= XFS_MOUNT_RDONLY; |
531 | if (error) { | 544 | if (error) { |
532 | cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error); | 545 | cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error); |
533 | xlog_dealloc_log(mp->m_log); | 546 | goto error; |
534 | return error; | ||
535 | } | 547 | } |
536 | } | 548 | } |
537 | 549 | ||
@@ -540,6 +552,9 @@ xfs_log_mount(xfs_mount_t *mp, | |||
540 | 552 | ||
541 | /* End mounting message in xfs_log_mount_finish */ | 553 | /* End mounting message in xfs_log_mount_finish */ |
542 | return 0; | 554 | return 0; |
555 | error: | ||
556 | xfs_log_unmount_dealloc(mp); | ||
557 | return error; | ||
543 | } /* xfs_log_mount */ | 558 | } /* xfs_log_mount */ |
544 | 559 | ||
545 | /* | 560 | /* |
@@ -722,10 +737,14 @@ xfs_log_unmount_write(xfs_mount_t *mp) | |||
722 | 737 | ||
723 | /* | 738 | /* |
724 | * Deallocate log structures for unmount/relocation. | 739 | * Deallocate log structures for unmount/relocation. |
740 | * | ||
741 | * We need to stop the aild from running before we destroy | ||
742 | * and deallocate the log as the aild references the log. | ||
725 | */ | 743 | */ |
726 | void | 744 | void |
727 | xfs_log_unmount_dealloc(xfs_mount_t *mp) | 745 | xfs_log_unmount_dealloc(xfs_mount_t *mp) |
728 | { | 746 | { |
747 | xfs_trans_ail_destroy(mp); | ||
729 | xlog_dealloc_log(mp->m_log); | 748 | xlog_dealloc_log(mp->m_log); |
730 | } | 749 | } |
731 | 750 | ||