Commit 5910fc51 authored by Lars Ellenberg's avatar Lars Ellenberg Committed by Philipp Reisner

give more detail about IO errors, if possible

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 240cbf21
......@@ -1632,13 +1632,15 @@ static inline int drbd_request_state(struct drbd_conf *mdev,
return _drbd_request_state(mdev, mask, val, CS_VERBOSE + CS_ORDERED);
}
static inline void __drbd_chk_io_error(struct drbd_conf *mdev, int forcedetach)
#define __drbd_chk_io_error(m,f) __drbd_chk_io_error_(m,f, __func__)
static inline void __drbd_chk_io_error_(struct drbd_conf *mdev, int forcedetach, const char *where)
{
switch (mdev->ldev->dc.on_io_error) {
case EP_PASS_ON:
if (!forcedetach) {
if (printk_ratelimit())
dev_err(DEV, "Local IO failed. Passing error on...\n");
dev_err(DEV, "Local IO failed in %s."
"Passing error on...\n", where);
break;
}
/* NOTE fall through to detach case if forcedetach set */
......@@ -1646,7 +1648,8 @@ static inline void __drbd_chk_io_error(struct drbd_conf *mdev, int forcedetach)
case EP_CALL_HELPER:
if (mdev->state.disk > D_FAILED) {
_drbd_set_state(_NS(mdev, disk, D_FAILED), CS_HARD, NULL);
dev_err(DEV, "Local IO failed. Detaching...\n");
dev_err(DEV, "Local IO failed in %s."
"Detaching...\n", where);
}
break;
}
......@@ -1660,13 +1663,14 @@ static inline void __drbd_chk_io_error(struct drbd_conf *mdev, int forcedetach)
*
* See also drbd_main.c:after_state_ch() if (os.disk > D_FAILED && ns.disk == D_FAILED)
*/
static inline void drbd_chk_io_error(struct drbd_conf *mdev,
int error, int forcedetach)
#define drbd_chk_io_error(m,e,f) drbd_chk_io_error_(m,e,f, __func__)
static inline void drbd_chk_io_error_(struct drbd_conf *mdev,
int error, int forcedetach, const char *where)
{
if (error) {
unsigned long flags;
spin_lock_irqsave(&mdev->req_lock, flags);
__drbd_chk_io_error(mdev, forcedetach);
__drbd_chk_io_error_(mdev, forcedetach, where);
spin_unlock_irqrestore(&mdev->req_lock, flags);
}
}
......
......@@ -2341,8 +2341,10 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req)
/* NOTE: no need to check if barriers supported here as we would
* not pass the test in make_request_common in that case
*/
if (bio_rw_flagged(req->master_bio, BIO_RW_BARRIER))
dp_flags |= DP_HARDBARRIER;
if (bio_rw_flagged(req->master_bio, BIO_RW_BARRIER)) {
dev_err(DEV, "ASSERT FAILED would have set DP_HARDBARRIER\n");
/* dp_flags |= DP_HARDBARRIER; */
}
if (bio_rw_flagged(req->master_bio, BIO_RW_SYNCIO))
dp_flags |= DP_RW_SYNC;
if (mdev->state.conn >= C_SYNC_SOURCE &&
......
......@@ -1740,8 +1740,10 @@ static int receive_Data(struct drbd_conf *mdev, struct p_header *h)
spin_unlock(&mdev->epoch_lock);
dp_flags = be32_to_cpu(p->dp_flags);
if (dp_flags & DP_HARDBARRIER)
rw |= (1<<BIO_RW_BARRIER);
if (dp_flags & DP_HARDBARRIER) {
dev_err(DEV, "ASSERT FAILED would have submitted barrier request\n");
/* rw |= (1<<BIO_RW_BARRIER); */
}
if (dp_flags & DP_RW_SYNC)
rw |= (1<<BIO_RW_SYNCIO) | (1<<BIO_RW_UNPLUG);
if (dp_flags & DP_MAY_SET_IN_SYNC)
......
......@@ -101,11 +101,15 @@ void drbd_endio_read_sec(struct bio *bio, int error) __releases(local)
e = bio->bi_private;
mdev = e->mdev;
if (error)
dev_warn(DEV, "read: error=%d s=%llus\n", error,
(unsigned long long)e->sector);
if (!error && !uptodate) {
dev_warn(DEV, "read: setting error to -EIO s=%llus\n",
(unsigned long long)e->sector);
/* strange behavior of some lower level drivers...
* fail the request by clearing the uptodate flag,
* but do not return any error?!
* do we want to dev_warn(DEV, ) on this? */
* but do not return any error?! */
error = -EIO;
}
......@@ -145,11 +149,15 @@ void drbd_endio_write_sec(struct bio *bio, int error) __releases(local)
e = bio->bi_private;
mdev = e->mdev;
if (error)
dev_warn(DEV, "write: error=%d s=%llus\n", error,
(unsigned long long)e->sector);
if (!error && !uptodate) {
dev_warn(DEV, "write: setting error to -EIO s=%llus\n",
(unsigned long long)e->sector);
/* strange behavior of some lower level drivers...
* fail the request by clearing the uptodate flag,
* but do not return any error?!
* do we want to dev_warn(DEV, ) on this? */
* but do not return any error?! */
error = -EIO;
}
......@@ -225,11 +233,15 @@ void drbd_endio_pri(struct bio *bio, int error)
enum drbd_req_event what;
int uptodate = bio_flagged(bio, BIO_UPTODATE);
if (error)
dev_warn(DEV, "p %s: error=%d\n",
bio_data_dir(bio) == WRITE ? "write" : "read", error);
if (!error && !uptodate) {
dev_warn(DEV, "p %s: setting error to -EIO\n",
bio_data_dir(bio) == WRITE ? "write" : "read");
/* strange behavior of some lower level drivers...
* fail the request by clearing the uptodate flag,
* but do not return any error?!
* do we want to dev_warn(DEV, ) on this? */
* but do not return any error?! */
error = -EIO;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment