xfs: inode recovery readahead can race with inode buffer creation
[firefly-linux-kernel-4.4.55.git] / fs / xfs / xfs_buf.c
index 3243cdf97f33f2998de6d8207d1128093a0ec587..2f022aa1275ac405d8c0059e9a4adba810f2067e 100644 (file)
@@ -604,6 +604,13 @@ found:
                }
        }
 
+       /*
+        * Clear b_error if this is a lookup from a caller that doesn't expect
+        * valid data to be found in the buffer.
+        */
+       if (!(flags & XBF_READ))
+               xfs_buf_ioerror(bp, 0);
+
        XFS_STATS_INC(target->bt_mount, xb_get);
        trace_xfs_buf_get(bp, flags, _RET_IP_);
        return bp;