These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / fs / xfs / libxfs / xfs_inode_buf.c
index 002b6b3..65485cf 100644 (file)
@@ -46,8 +46,7 @@ xfs_inobp_check(
        j = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog;
 
        for (i = 0; i < j; i++) {
-               dip = (xfs_dinode_t *)xfs_buf_offset(bp,
-                                       i * mp->m_sb.sb_inodesize);
+               dip = xfs_buf_offset(bp, i * mp->m_sb.sb_inodesize);
                if (!dip->di_next_unlinked)  {
                        xfs_alert(mp,
        "Detected bogus zero next_unlinked field in inode %d buffer 0x%llx.",
@@ -63,11 +62,12 @@ xfs_inobp_check(
  * has not had the inode cores stamped into it. Hence for readahead, the buffer
  * may be potentially invalid.
  *
- * If the readahead buffer is invalid, we don't want to mark it with an error,
- * but we do want to clear the DONE status of the buffer so that a followup read
- * will re-read it from disk. This will ensure that we don't get an unnecessary
- * warnings during log recovery and we don't get unnecssary panics on debug
- * kernels.
+ * If the readahead buffer is invalid, we need to mark it with an error and
+ * clear the DONE status of the buffer so that a followup read will re-read it
+ * from disk. We don't report the error otherwise to avoid warnings during log
+ * recovery and we don't get unnecssary panics on debug kernels. We use EIO here
+ * because all we want to do is say readahead failed; there is no-one to report
+ * the error to, so this will distinguish it from a non-ra verifier failure.
  */
 static void
 xfs_inode_buf_verify(
@@ -86,8 +86,7 @@ xfs_inode_buf_verify(
                int             di_ok;
                xfs_dinode_t    *dip;
 
-               dip = (struct xfs_dinode *)xfs_buf_offset(bp,
-                                       (i << mp->m_sb.sb_inodelog));
+               dip = xfs_buf_offset(bp, (i << mp->m_sb.sb_inodelog));
                di_ok = dip->di_magic == cpu_to_be16(XFS_DINODE_MAGIC) &&
                            XFS_DINODE_GOOD_VERSION(dip->di_version);
                if (unlikely(XFS_TEST_ERROR(!di_ok, mp,
@@ -95,6 +94,7 @@ xfs_inode_buf_verify(
                                                XFS_RANDOM_ITOBP_INOTOBP))) {
                        if (readahead) {
                                bp->b_flags &= ~XBF_DONE;
+                               xfs_buf_ioerror(bp, -EIO);
                                return;
                        }
 
@@ -186,7 +186,7 @@ xfs_imap_to_bp(
        }
 
        *bpp = bp;
-       *dipp = (struct xfs_dinode *)xfs_buf_offset(bp, imap->im_boffset);
+       *dipp = xfs_buf_offset(bp, imap->im_boffset);
        return 0;
 }
 
@@ -306,7 +306,7 @@ xfs_dinode_verify(
                return false;
        if (be64_to_cpu(dip->di_ino) != ip->i_ino)
                return false;
-       if (!uuid_equal(&dip->di_uuid, &mp->m_sb.sb_uuid))
+       if (!uuid_equal(&dip->di_uuid, &mp->m_sb.sb_meta_uuid))
                return false;
        return true;
 }
@@ -368,7 +368,7 @@ xfs_iread(
                if (xfs_sb_version_hascrc(&mp->m_sb)) {
                        ip->i_d.di_version = 3;
                        ip->i_d.di_ino = ip->i_ino;
-                       uuid_copy(&ip->i_d.di_uuid, &mp->m_sb.sb_uuid);
+                       uuid_copy(&ip->i_d.di_uuid, &mp->m_sb.sb_meta_uuid);
                } else
                        ip->i_d.di_version = 2;
                return 0;