vserver 1.9.3
[linux-2.6.git] / fs / xfs / xfs_trans.c
index aebea7a..3db0e22 100644 (file)
@@ -131,7 +131,7 @@ xfs_trans_alloc(
        xfs_mount_t     *mp,
        uint            type)
 {
-       vfs_check_frozen(XFS_MTOVFS(mp)->vfs_super, SB_FREEZE_TRANS);
+       fs_check_frozen(XFS_MTOVFS(mp), SB_FREEZE_TRANS);
        atomic_inc(&mp->m_active_trans);
 
        return (_xfs_trans_alloc(mp, type));
@@ -491,6 +491,9 @@ xfs_trans_apply_sb_deltas(
        if (tp->t_frextents_delta != 0) {
                INT_MOD(sbp->sb_frextents, ARCH_CONVERT, tp->t_frextents_delta);
        }
+       if (tp->t_res_frextents_delta != 0) {
+               INT_MOD(sbp->sb_frextents, ARCH_CONVERT, tp->t_res_frextents_delta);
+       }
        if (tp->t_dblocks_delta != 0) {
                INT_MOD(sbp->sb_dblocks, ARCH_CONVERT, tp->t_dblocks_delta);
                whole = 1;
@@ -855,16 +858,19 @@ shut_us_down:
        tp->t_logcb.cb_func = (void(*)(void*, int))xfs_trans_committed;
        tp->t_logcb.cb_arg = tp;
 
-       /* We need to pass the iclog buffer which was used for the
+       /*
+        * We need to pass the iclog buffer which was used for the
         * transaction commit record into this function, and attach
         * the callback to it. The callback must be attached before
         * the items are unlocked to avoid racing with other threads
         * waiting for an item to unlock.
         */
-       error = xfs_log_notify(mp, commit_iclog, &(tp->t_logcb));
+       shutdown = xfs_log_notify(mp, commit_iclog, &(tp->t_logcb));
 
-       /* mark this thread as no longer being in a transaction */
-        PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);
+       /*
+        * Mark this thread as no longer being in a transaction
+        */
+       PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);
 
        /*
         * Once all the items of the transaction have been copied
@@ -881,6 +887,19 @@ shut_us_down:
         */
        xfs_trans_unlock_items(tp, commit_lsn);
 
+       /*
+        * If we detected a log error earlier, finish committing
+        * the transaction now (unpin log items, etc).
+        *
+        * Order is critical here, to avoid using the transaction
+        * pointer after its been freed (by xfs_trans_committed
+        * either here now, or as a callback).  We cannot do this
+        * step inside xfs_log_notify as was done earlier because
+        * of this issue.
+        */
+       if (shutdown)
+               xfs_trans_committed(tp, XFS_LI_ABORTED);
+
        /*
         * Now that the xfs_trans_committed callback has been attached,
         * and the items are released we can finally allow the iclog to
@@ -1241,10 +1260,6 @@ xfs_trans_chunk_committed(
                if (aborted)
                        lip->li_flags |= XFS_LI_ABORTED;
 
-               if (lidp->lid_flags & XFS_LID_SYNC_UNLOCK) {
-                       IOP_UNLOCK(lip);
-               }
-
                /*
                 * Send in the ABORTED flag to the COMMITTED routine
                 * so that it knows whether the transaction was aborted