[XFS] Ensure xfs_bawrite() errors are checked.
authorDavid Chinner <dgc@sgi.com>
Thu, 10 Apr 2008 02:22:24 +0000 (12:22 +1000)
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>
Fri, 18 Apr 2008 02:00:35 +0000 (12:00 +1000)
xfs_bawrite() can return immediate error status on async writes. Unlike
xfsbdstrat() we don't ever check the error on the buffer after the call,
so we currently do not catch errors at all here. Ensure we catch and
propagate or warn to the syslog about up-front async write errors.

SGI-PV: 980084
SGI-Modid: xfs-linux-melb:xfs-kern:30824a

Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Niv Sardi <xaiki@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
fs/xfs/quota/xfs_dquot.c
fs/xfs/quota/xfs_dquot_item.c
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode_item.c

index 15214fbb9aa70304e6f6b88520daee8420d7ccc9..631ebb31b295df30fed95207e80be2214d5f2f49 100644 (file)
@@ -1291,7 +1291,7 @@ xfs_qm_dqflush(
        if (flags & XFS_QMOPT_DELWRI) {
                xfs_bdwrite(mp, bp);
        } else if (flags & XFS_QMOPT_ASYNC) {
-               xfs_bawrite(mp, bp);
+               error = xfs_bawrite(mp, bp);
        } else {
                error = xfs_bwrite(mp, bp);
        }
@@ -1582,12 +1582,18 @@ xfs_qm_dqflock_pushbuf_wait(
                    XFS_INCORE_TRYLOCK);
        if (bp != NULL) {
                if (XFS_BUF_ISDELAYWRITE(bp)) {
+                       int     error;
                        if (XFS_BUF_ISPINNED(bp)) {
                                xfs_log_force(dqp->q_mount,
                                              (xfs_lsn_t)0,
                                              XFS_LOG_FORCE);
                        }
-                       xfs_bawrite(dqp->q_mount, bp);
+                       error = xfs_bawrite(dqp->q_mount, bp);
+                       if (error)
+                               xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
+                                       "xfs_qm_dqflock_pushbuf_wait: "
+                                       "pushbuf error %d on dqp %p, bp %p",
+                                       error, dqp, bp);
                } else {
                        xfs_buf_relse(bp);
                }
index 3dedce1d9cdec8456641db9056cb744058d3828b..36e05ca784123753612233cadad12aab69a8b991 100644 (file)
@@ -267,11 +267,16 @@ xfs_qm_dquot_logitem_pushbuf(
                                              XFS_LOG_FORCE);
                        }
                        if (dopush) {
+                               int     error;
 #ifdef XFSRACEDEBUG
                                delay_for_intr();
                                delay(300);
 #endif
-                               xfs_bawrite(mp, bp);
+                               error = xfs_bawrite(mp, bp);
+                               if (error)
+                                       xfs_fs_cmn_err(CE_WARN, mp,
+       "xfs_qm_dquot_logitem_pushbuf: pushbuf error %d on qip %p, bp %p",
+                                                       error, qip, bp);
                        } else {
                                xfs_buf_relse(bp);
                        }
index 63debd147eb554f69a07fcd78241a2b882c3f311..53a71c62025d2ba3923f11f610be93e94f37e7eb 100644 (file)
@@ -645,7 +645,12 @@ xfs_buf_item_push(
        bp = bip->bli_buf;
 
        if (XFS_BUF_ISDELAYWRITE(bp)) {
-               xfs_bawrite(bip->bli_item.li_mountp, bp);
+               int     error;
+               error = xfs_bawrite(bip->bli_item.li_mountp, bp);
+               if (error)
+                       xfs_fs_cmn_err(CE_WARN, bip->bli_item.li_mountp,
+                       "xfs_buf_item_push: pushbuf error %d on bip %p, bp %p",
+                                       error, bip, bp);
        } else {
                xfs_buf_relse(bp);
        }
index 63e66890f0631a7d46bf82b37e7692435932cd14..ca074ee01d067ec3ac8ea7cc67440d060b419c00 100644 (file)
@@ -3276,7 +3276,7 @@ xfs_iflush(
        if (flags & INT_DELWRI) {
                xfs_bdwrite(mp, bp);
        } else if (flags & INT_ASYNC) {
-               xfs_bawrite(mp, bp);
+               error = xfs_bawrite(mp, bp);
        } else {
                error = xfs_bwrite(mp, bp);
        }
index 2c775b4ae9e64fb7608a53b4a65ccb28a6287573..93b5db453ea296da3cb64ac7e9b49a63a77fc1b0 100644 (file)
@@ -40,6 +40,7 @@
 #include "xfs_btree.h"
 #include "xfs_ialloc.h"
 #include "xfs_rw.h"
+#include "xfs_error.h"
 
 
 kmem_zone_t    *xfs_ili_zone;          /* inode log item zone */
@@ -813,7 +814,12 @@ xfs_inode_item_pushbuf(
                                              XFS_LOG_FORCE);
                        }
                        if (dopush) {
-                               xfs_bawrite(mp, bp);
+                               int     error;
+                               error = xfs_bawrite(mp, bp);
+                               if (error)
+                                       xfs_fs_cmn_err(CE_WARN, mp,
+               "xfs_inode_item_pushbuf: pushbuf error %d on iip %p, bp %p",
+                                                       error, iip, bp);
                        } else {
                                xfs_buf_relse(bp);
                        }