aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-04-23 01:58:41 -0400
committerBen Myers <bpm@sgi.com>2012-05-14 17:20:33 -0400
commit04913fdd91f342e537005ef1233f98068b925a7f (patch)
treeb8eaacda9302290fb1833d47bf6c7be5813a80cb /fs
parenta8569171ba26344a4c0308fc0da8f41795408ebc (diff)
xfs: pass shutdown method into xfs_trans_ail_delete_bulk
xfs_trans_ail_delete_bulk() can be called from different contexts so if the item is not in the AIL we need different shutdown for each context. Pass in the shutdown method needed so the correct action can be taken. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_buf_item.c4
-rw-r--r--fs/xfs/xfs_dquot.c5
-rw-r--r--fs/xfs/xfs_dquot_item.c2
-rw-r--r--fs/xfs/xfs_extfree_item.c3
-rw-r--r--fs/xfs/xfs_inode.c4
-rw-r--r--fs/xfs/xfs_inode_item.c23
-rw-r--r--fs/xfs/xfs_inode_item.h2
-rw-r--r--fs/xfs/xfs_log_recover.c3
-rw-r--r--fs/xfs/xfs_sync.c2
-rw-r--r--fs/xfs/xfs_trans_ail.c5
-rw-r--r--fs/xfs/xfs_trans_priv.h8
11 files changed, 35 insertions, 26 deletions
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index fb20f384b566..7f0abeaf919c 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -454,7 +454,7 @@ xfs_buf_item_unpin(
454 bp->b_iodone = NULL; 454 bp->b_iodone = NULL;
455 } else { 455 } else {
456 spin_lock(&ailp->xa_lock); 456 spin_lock(&ailp->xa_lock);
457 xfs_trans_ail_delete(ailp, (xfs_log_item_t *)bip); 457 xfs_trans_ail_delete(ailp, lip, SHUTDOWN_LOG_IO_ERROR);
458 xfs_buf_item_relse(bp); 458 xfs_buf_item_relse(bp);
459 ASSERT(bp->b_fspriv == NULL); 459 ASSERT(bp->b_fspriv == NULL);
460 } 460 }
@@ -1006,6 +1006,6 @@ xfs_buf_iodone(
1006 * Either way, AIL is useless if we're forcing a shutdown. 1006 * Either way, AIL is useless if we're forcing a shutdown.
1007 */ 1007 */
1008 spin_lock(&ailp->xa_lock); 1008 spin_lock(&ailp->xa_lock);
1009 xfs_trans_ail_delete(ailp, lip); 1009 xfs_trans_ail_delete(ailp, lip, SHUTDOWN_CORRUPT_INCORE);
1010 xfs_buf_item_free(BUF_ITEM(lip)); 1010 xfs_buf_item_free(BUF_ITEM(lip));
1011} 1011}
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 65b8aa37622e..7bf38556254e 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -857,7 +857,7 @@ xfs_qm_dqflush_done(
857 /* xfs_trans_ail_delete() drops the AIL lock. */ 857 /* xfs_trans_ail_delete() drops the AIL lock. */
858 spin_lock(&ailp->xa_lock); 858 spin_lock(&ailp->xa_lock);
859 if (lip->li_lsn == qip->qli_flush_lsn) 859 if (lip->li_lsn == qip->qli_flush_lsn)
860 xfs_trans_ail_delete(ailp, lip); 860 xfs_trans_ail_delete(ailp, lip, SHUTDOWN_CORRUPT_INCORE);
861 else 861 else
862 spin_unlock(&ailp->xa_lock); 862 spin_unlock(&ailp->xa_lock);
863 } 863 }
@@ -909,7 +909,8 @@ xfs_qm_dqflush(
909 909
910 spin_lock(&mp->m_ail->xa_lock); 910 spin_lock(&mp->m_ail->xa_lock);
911 if (lip->li_flags & XFS_LI_IN_AIL) 911 if (lip->li_flags & XFS_LI_IN_AIL)
912 xfs_trans_ail_delete(mp->m_ail, lip); 912 xfs_trans_ail_delete(mp->m_ail, lip,
913 SHUTDOWN_CORRUPT_INCORE);
913 else 914 else
914 spin_unlock(&mp->m_ail->xa_lock); 915 spin_unlock(&mp->m_ail->xa_lock);
915 error = XFS_ERROR(EIO); 916 error = XFS_ERROR(EIO);
diff --git a/fs/xfs/xfs_dquot_item.c b/fs/xfs/xfs_dquot_item.c
index 9c5d58d24e54..aa6a2a6bd9a8 100644
--- a/fs/xfs/xfs_dquot_item.c
+++ b/fs/xfs/xfs_dquot_item.c
@@ -384,7 +384,7 @@ xfs_qm_qoffend_logitem_committed(
384 * xfs_trans_ail_delete() drops the AIL lock. 384 * xfs_trans_ail_delete() drops the AIL lock.
385 */ 385 */
386 spin_lock(&ailp->xa_lock); 386 spin_lock(&ailp->xa_lock);
387 xfs_trans_ail_delete(ailp, (xfs_log_item_t *)qfs); 387 xfs_trans_ail_delete(ailp, &qfs->qql_item, SHUTDOWN_LOG_IO_ERROR);
388 388
389 kmem_free(qfs); 389 kmem_free(qfs);
390 kmem_free(qfe); 390 kmem_free(qfe);
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index 9549ef179e06..2960fc104cb7 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -64,7 +64,8 @@ __xfs_efi_release(
64 if (!test_and_clear_bit(XFS_EFI_COMMITTED, &efip->efi_flags)) { 64 if (!test_and_clear_bit(XFS_EFI_COMMITTED, &efip->efi_flags)) {
65 spin_lock(&ailp->xa_lock); 65 spin_lock(&ailp->xa_lock);
66 /* xfs_trans_ail_delete() drops the AIL lock. */ 66 /* xfs_trans_ail_delete() drops the AIL lock. */
67 xfs_trans_ail_delete(ailp, &efip->efi_item); 67 xfs_trans_ail_delete(ailp, &efip->efi_item,
68 SHUTDOWN_LOG_IO_ERROR);
68 xfs_efi_item_free(efip); 69 xfs_efi_item_free(efip);
69 } 70 }
70} 71}
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index acd846d808b2..65d7d994d499 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2377,7 +2377,7 @@ cluster_corrupt_out:
2377 /* 2377 /*
2378 * Unlocks the flush lock 2378 * Unlocks the flush lock
2379 */ 2379 */
2380 xfs_iflush_abort(iq); 2380 xfs_iflush_abort(iq, false);
2381 kmem_free(ilist); 2381 kmem_free(ilist);
2382 xfs_perag_put(pag); 2382 xfs_perag_put(pag);
2383 return XFS_ERROR(EFSCORRUPTED); 2383 return XFS_ERROR(EFSCORRUPTED);
@@ -2482,7 +2482,7 @@ abort_out:
2482 /* 2482 /*
2483 * Unlocks the flush lock 2483 * Unlocks the flush lock
2484 */ 2484 */
2485 xfs_iflush_abort(ip); 2485 xfs_iflush_abort(ip, false);
2486 return error; 2486 return error;
2487} 2487}
2488 2488
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 8aaebb2f9efa..3f96a949d963 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -777,7 +777,8 @@ xfs_iflush_done(
777 ASSERT(i <= need_ail); 777 ASSERT(i <= need_ail);
778 } 778 }
779 /* xfs_trans_ail_delete_bulk() drops the AIL lock. */ 779 /* xfs_trans_ail_delete_bulk() drops the AIL lock. */
780 xfs_trans_ail_delete_bulk(ailp, log_items, i); 780 xfs_trans_ail_delete_bulk(ailp, log_items, i,
781 SHUTDOWN_CORRUPT_INCORE);
781 } 782 }
782 783
783 784
@@ -798,16 +799,15 @@ xfs_iflush_done(
798} 799}
799 800
800/* 801/*
801 * This is the inode flushing abort routine. It is called 802 * This is the inode flushing abort routine. It is called from xfs_iflush when
802 * from xfs_iflush when the filesystem is shutting down to clean 803 * the filesystem is shutting down to clean up the inode state. It is
803 * up the inode state. 804 * responsible for removing the inode item from the AIL if it has not been
804 * It is responsible for removing the inode item 805 * re-logged, and unlocking the inode's flush lock.
805 * from the AIL if it has not been re-logged, and unlocking the inode's
806 * flush lock.
807 */ 806 */
808void 807void
809xfs_iflush_abort( 808xfs_iflush_abort(
810 xfs_inode_t *ip) 809 xfs_inode_t *ip,
810 bool stale)
811{ 811{
812 xfs_inode_log_item_t *iip = ip->i_itemp; 812 xfs_inode_log_item_t *iip = ip->i_itemp;
813 813
@@ -817,7 +817,10 @@ xfs_iflush_abort(
817 spin_lock(&ailp->xa_lock); 817 spin_lock(&ailp->xa_lock);
818 if (iip->ili_item.li_flags & XFS_LI_IN_AIL) { 818 if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
819 /* xfs_trans_ail_delete() drops the AIL lock. */ 819 /* xfs_trans_ail_delete() drops the AIL lock. */
820 xfs_trans_ail_delete(ailp, (xfs_log_item_t *)iip); 820 xfs_trans_ail_delete(ailp, &iip->ili_item,
821 stale ?
822 SHUTDOWN_LOG_IO_ERROR :
823 SHUTDOWN_CORRUPT_INCORE);
821 } else 824 } else
822 spin_unlock(&ailp->xa_lock); 825 spin_unlock(&ailp->xa_lock);
823 } 826 }
@@ -844,7 +847,7 @@ xfs_istale_done(
844 struct xfs_buf *bp, 847 struct xfs_buf *bp,
845 struct xfs_log_item *lip) 848 struct xfs_log_item *lip)
846{ 849{
847 xfs_iflush_abort(INODE_ITEM(lip)->ili_inode); 850 xfs_iflush_abort(INODE_ITEM(lip)->ili_inode, true);
848} 851}
849 852
850/* 853/*
diff --git a/fs/xfs/xfs_inode_item.h b/fs/xfs/xfs_inode_item.h
index 41d61c3b7a36..376d4d0b2635 100644
--- a/fs/xfs/xfs_inode_item.h
+++ b/fs/xfs/xfs_inode_item.h
@@ -165,7 +165,7 @@ extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
165extern void xfs_inode_item_destroy(struct xfs_inode *); 165extern void xfs_inode_item_destroy(struct xfs_inode *);
166extern void xfs_iflush_done(struct xfs_buf *, struct xfs_log_item *); 166extern void xfs_iflush_done(struct xfs_buf *, struct xfs_log_item *);
167extern void xfs_istale_done(struct xfs_buf *, struct xfs_log_item *); 167extern void xfs_istale_done(struct xfs_buf *, struct xfs_log_item *);
168extern void xfs_iflush_abort(struct xfs_inode *); 168extern void xfs_iflush_abort(struct xfs_inode *, bool);
169extern int xfs_inode_item_format_convert(xfs_log_iovec_t *, 169extern int xfs_inode_item_format_convert(xfs_log_iovec_t *,
170 xfs_inode_log_format_t *); 170 xfs_inode_log_format_t *);
171 171
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 5e864a9c0ccf..396e3bfd0496 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2645,7 +2645,8 @@ xlog_recover_efd_pass2(
2645 * xfs_trans_ail_delete() drops the 2645 * xfs_trans_ail_delete() drops the
2646 * AIL lock. 2646 * AIL lock.
2647 */ 2647 */
2648 xfs_trans_ail_delete(ailp, lip); 2648 xfs_trans_ail_delete(ailp, lip,
2649 SHUTDOWN_CORRUPT_INCORE);
2649 xfs_efi_item_free(efip); 2650 xfs_efi_item_free(efip);
2650 spin_lock(&ailp->xa_lock); 2651 spin_lock(&ailp->xa_lock);
2651 break; 2652 break;
diff --git a/fs/xfs/xfs_sync.c b/fs/xfs/xfs_sync.c
index cdb644fd0bd1..24180cd86264 100644
--- a/fs/xfs/xfs_sync.c
+++ b/fs/xfs/xfs_sync.c
@@ -684,7 +684,7 @@ restart:
684 goto reclaim; 684 goto reclaim;
685 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { 685 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
686 xfs_iunpin_wait(ip); 686 xfs_iunpin_wait(ip);
687 xfs_iflush_abort(ip); 687 xfs_iflush_abort(ip, false);
688 goto reclaim; 688 goto reclaim;
689 } 689 }
690 if (xfs_ipincount(ip)) { 690 if (xfs_ipincount(ip)) {
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 959374a0d028..2c0db81f035d 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -707,7 +707,8 @@ void
707xfs_trans_ail_delete_bulk( 707xfs_trans_ail_delete_bulk(
708 struct xfs_ail *ailp, 708 struct xfs_ail *ailp,
709 struct xfs_log_item **log_items, 709 struct xfs_log_item **log_items,
710 int nr_items) __releases(ailp->xa_lock) 710 int nr_items,
711 int shutdown_type) __releases(ailp->xa_lock)
711{ 712{
712 xfs_log_item_t *mlip; 713 xfs_log_item_t *mlip;
713 int mlip_changed = 0; 714 int mlip_changed = 0;
@@ -725,7 +726,7 @@ xfs_trans_ail_delete_bulk(
725 xfs_alert_tag(mp, XFS_PTAG_AILDELETE, 726 xfs_alert_tag(mp, XFS_PTAG_AILDELETE,
726 "%s: attempting to delete a log item that is not in the AIL", 727 "%s: attempting to delete a log item that is not in the AIL",
727 __func__); 728 __func__);
728 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); 729 xfs_force_shutdown(mp, shutdown_type);
729 } 730 }
730 return; 731 return;
731 } 732 }
diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h
index f72bdd48a5c1..fb62377d1cbc 100644
--- a/fs/xfs/xfs_trans_priv.h
+++ b/fs/xfs/xfs_trans_priv.h
@@ -92,14 +92,16 @@ xfs_trans_ail_update(
92} 92}
93 93
94void xfs_trans_ail_delete_bulk(struct xfs_ail *ailp, 94void xfs_trans_ail_delete_bulk(struct xfs_ail *ailp,
95 struct xfs_log_item **log_items, int nr_items) 95 struct xfs_log_item **log_items, int nr_items,
96 int shutdown_type)
96 __releases(ailp->xa_lock); 97 __releases(ailp->xa_lock);
97static inline void 98static inline void
98xfs_trans_ail_delete( 99xfs_trans_ail_delete(
99 struct xfs_ail *ailp, 100 struct xfs_ail *ailp,
100 xfs_log_item_t *lip) __releases(ailp->xa_lock) 101 xfs_log_item_t *lip,
102 int shutdown_type) __releases(ailp->xa_lock)
101{ 103{
102 xfs_trans_ail_delete_bulk(ailp, &lip, 1); 104 xfs_trans_ail_delete_bulk(ailp, &lip, 1, shutdown_type);
103} 105}
104 106
105void xfs_ail_push(struct xfs_ail *, xfs_lsn_t); 107void xfs_ail_push(struct xfs_ail *, xfs_lsn_t);