|
@@ -832,6 +832,7 @@ enum {
|
|
|
BITMAP_IO_QUEUED, /* Started bitmap IO */
|
|
|
GO_DISKLESS, /* Disk is being detached, on io-error or admin request. */
|
|
|
WAS_IO_ERROR, /* Local disk failed returned IO error */
|
|
|
+ FORCE_DETACH, /* Force-detach from local disk, aborting any pending local IO */
|
|
|
RESYNC_AFTER_NEG, /* Resync after online grow after the attach&negotiate finished. */
|
|
|
NET_CONGESTED, /* The data socket is congested */
|
|
|
|
|
@@ -1838,12 +1839,20 @@ static inline int drbd_request_state(struct drbd_conf *mdev,
|
|
|
return _drbd_request_state(mdev, mask, val, CS_VERBOSE + CS_ORDERED);
|
|
|
}
|
|
|
|
|
|
+enum drbd_force_detach_flags {
|
|
|
+ DRBD_IO_ERROR,
|
|
|
+ DRBD_META_IO_ERROR,
|
|
|
+ DRBD_FORCE_DETACH,
|
|
|
+};
|
|
|
+
|
|
|
#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)
|
|
|
+static inline void __drbd_chk_io_error_(struct drbd_conf *mdev,
|
|
|
+ enum drbd_force_detach_flags forcedetach,
|
|
|
+ const char *where)
|
|
|
{
|
|
|
switch (mdev->ldev->dc.on_io_error) {
|
|
|
case EP_PASS_ON:
|
|
|
- if (!forcedetach) {
|
|
|
+ if (forcedetach == DRBD_IO_ERROR) {
|
|
|
if (__ratelimit(&drbd_ratelimit_state))
|
|
|
dev_err(DEV, "Local IO failed in %s.\n", where);
|
|
|
if (mdev->state.disk > D_INCONSISTENT)
|
|
@@ -1854,6 +1863,8 @@ static inline void __drbd_chk_io_error_(struct drbd_conf *mdev, int forcedetach,
|
|
|
case EP_DETACH:
|
|
|
case EP_CALL_HELPER:
|
|
|
set_bit(WAS_IO_ERROR, &mdev->flags);
|
|
|
+ if (forcedetach == DRBD_FORCE_DETACH)
|
|
|
+ set_bit(FORCE_DETACH, &mdev->flags);
|
|
|
if (mdev->state.disk > D_FAILED) {
|
|
|
_drbd_set_state(_NS(mdev, disk, D_FAILED), CS_HARD, NULL);
|
|
|
dev_err(DEV,
|
|
@@ -1873,7 +1884,7 @@ static inline void __drbd_chk_io_error_(struct drbd_conf *mdev, 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)
|
|
|
+ int error, enum drbd_force_detach_flags forcedetach, const char *where)
|
|
|
{
|
|
|
if (error) {
|
|
|
unsigned long flags;
|