Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232662
b: refs/heads/master
c: e34a314
h: refs/heads/master
v: v3
  • Loading branch information
Dave Chinner authored and Alex Elder committed Jan 28, 2011
1 parent 329bd7c commit 7cd389a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7db37c5e6575b229a5051be1d3ef15257ae0ba5d
refs/heads/master: e34a314c5e49fe6b763568f6576b19f1299c33c2
12 changes: 7 additions & 5 deletions trunk/fs/xfs/xfs_buf_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,15 @@ xfs_buf_item_unpin(

if (remove) {
/*
* We have to remove the log item from the transaction
* as we are about to release our reference to the
* buffer. If we don't, the unlock that occurs later
* in xfs_trans_uncommit() will ry to reference the
* If we are in a transaction context, we have to
* remove the log item from the transaction as we are
* about to release our reference to the buffer. If we
* don't, the unlock that occurs later in
* xfs_trans_uncommit() will try to reference the
* buffer which we no longer have a hold on.
*/
xfs_trans_del_item(lip);
if (lip->li_desc)
xfs_trans_del_item(lip);

/*
* Since the transaction no longer refers to the buffer,
Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/xfs/xfs_extfree_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ xfs_efi_item_unpin(

if (remove) {
ASSERT(!(lip->li_flags & XFS_LI_IN_AIL));
xfs_trans_del_item(lip);
if (lip->li_desc)
xfs_trans_del_item(lip);
xfs_efi_item_free(efip);
return;
}
Expand Down
36 changes: 29 additions & 7 deletions trunk/fs/xfs/xfs_trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,14 @@ xfs_log_item_batch_insert(
* Bulk operation version of xfs_trans_committed that takes a log vector of
* items to insert into the AIL. This uses bulk AIL insertion techniques to
* minimise lock traffic.
*
* If we are called with the aborted flag set, it is because a log write during
* a CIL checkpoint commit has failed. In this case, all the items in the
* checkpoint have already gone through IOP_COMMITED and IOP_UNLOCK, which
* means that checkpoint commit abort handling is treated exactly the same
* as an iclog write error even though we haven't started any IO yet. Hence in
* this case all we need to do is IOP_COMMITTED processing, followed by an
* IOP_UNPIN(aborted) call.
*/
void
xfs_trans_committed_bulk(
Expand All @@ -1472,6 +1480,16 @@ xfs_trans_committed_bulk(
if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0)
continue;

/*
* if we are aborting the operation, no point in inserting the
* object into the AIL as we are in a shutdown situation.
*/
if (aborted) {
ASSERT(XFS_FORCED_SHUTDOWN(ailp->xa_mount));
IOP_UNPIN(lip, 1);
continue;
}

if (item_lsn != commit_lsn) {

/*
Expand Down Expand Up @@ -1503,20 +1521,24 @@ xfs_trans_committed_bulk(
}

/*
* Called from the trans_commit code when we notice that
* the filesystem is in the middle of a forced shutdown.
* Called from the trans_commit code when we notice that the filesystem is in
* the middle of a forced shutdown.
*
* When we are called here, we have already pinned all the items in the
* transaction. However, neither IOP_COMMITTING or IOP_UNLOCK has been called
* so we can simply walk the items in the transaction, unpin them with an abort
* flag and then free the items. Note that unpinning the items can result in
* them being freed immediately, so we need to use a safe list traversal method
* here.
*/
STATIC void
xfs_trans_uncommit(
struct xfs_trans *tp,
uint flags)
{
struct xfs_log_item_desc *lidp;
struct xfs_log_item_desc *lidp, *n;

list_for_each_entry(lidp, &tp->t_items, lid_trans) {
/*
* Unpin all but those that aren't dirty.
*/
list_for_each_entry_safe(lidp, n, &tp->t_items, lid_trans) {
if (lidp->lid_flags & XFS_LID_DIRTY)
IOP_UNPIN(lidp->lid_item, 1);
}
Expand Down

0 comments on commit 7cd389a

Please sign in to comment.