Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[firefly-linux-kernel-4.4.55.git] / fs / xfs / xfs_buf_item.c
index 98c6f73b675218bded1a6b326ecdf349cb241a07..e5413d96f1af90a67831dc2498e8d5fbdd8e42ed 100644 (file)
@@ -130,10 +130,12 @@ xfs_buf_item_log_check(
        orig = bip->bli_orig;
        buffer = XFS_BUF_PTR(bp);
        for (x = 0; x < XFS_BUF_COUNT(bp); x++) {
-               if (orig[x] != buffer[x] && !btst(bip->bli_logged, x))
-                       cmn_err(CE_PANIC,
-       "xfs_buf_item_log_check bip %x buffer %x orig %x index %d",
-                               bip, bp, orig, x);
+               if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) {
+                       xfs_emerg(bp->b_mount,
+                               "%s: bip %x buffer %x orig %x index %d",
+                               __func__, bip, bp, orig, x);
+                       ASSERT(0);
+               }
        }
 }
 #else
@@ -427,13 +429,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,
@@ -981,10 +985,9 @@ xfs_buf_iodone_callbacks(
        if (XFS_BUF_TARGET(bp) != lasttarg ||
            time_after(jiffies, (lasttime + 5*HZ))) {
                lasttime = jiffies;
-               cmn_err(CE_ALERT, "Device %s, XFS metadata write error"
-                               " block 0x%llx in %s",
+               xfs_alert(mp, "Device %s: metadata write error block 0x%llx",
                        XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)),
-                     (__uint64_t)XFS_BUF_ADDR(bp), mp->m_fsname);
+                     (__uint64_t)XFS_BUF_ADDR(bp));
        }
        lasttarg = XFS_BUF_TARGET(bp);