[DRBD-cvs] svn commit by phil - r2487 - in trunk: drbd drbd/linux
scripts user - Removed drbd_panic() completely.
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Mon Oct 2 17:54:17 CEST 2006
Author: phil
Date: 2006-10-02 17:54:16 +0200 (Mon, 02 Oct 2006)
New Revision: 2487
Modified:
trunk/drbd/drbd_int.h
trunk/drbd/drbd_main.c
trunk/drbd/drbd_receiver.c
trunk/drbd/drbd_req.c
trunk/drbd/drbd_worker.c
trunk/drbd/linux/drbd.h
trunk/scripts/drbd.conf
trunk/user/drbdsetup.c
Log:
Removed drbd_panic() completely.
Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h 2006-10-02 15:51:32 UTC (rev 2486)
+++ trunk/drbd/drbd_int.h 2006-10-02 15:54:16 UTC (rev 2487)
@@ -254,39 +254,8 @@
/* drbd_meta-data.c (still in drbd_main.c) */
#define DRBD_MD_MAGIC (DRBD_MAGIC+4) // 4th incarnation of the disk layout.
-#define DRBD_PANIC 2
-/* do_panic alternatives:
- * 0: panic();
- * 1: machine_halt; SORRY, this DOES NOT WORK
- * 2: prink(EMERG ), plus flag to fail all eventual drbd IO, plus panic()
- * 3: prink(EMERG ) and nothing more. For UML debugging...
- */
-
-extern volatile int drbd_did_panic;
extern struct Drbd_Conf **minor_table;
-#if DRBD_PANIC == 0
-#define drbd_panic(fmt, args...) \
- panic(DEVICE_NAME "%d: " fmt, mdev_to_minor(mdev) , ##args)
-#elif DRBD_PANIC == 1
-#error "sorry , this does not work, please contribute"
-#elif DRBD_PANIC == 2
-#define drbd_panic(fmt, args...) do { \
- printk(KERN_EMERG DEVICE_NAME "%d: " fmt, \
- mdev_to_minor(mdev) , ##args); \
- drbd_did_panic = DRBD_MAGIC; \
- smp_mb(); \
- panic(DEVICE_NAME "%d: " fmt, mdev_to_minor(mdev) , ##args); \
-} while (0)
-#else
-#define drbd_panic(fmt, args...) do { \
- printk(KERN_EMERG DEVICE_NAME "%d: " fmt, \
- mdev_to_minor(mdev) , ##args); \
-} while (0)
-// warning LGE "drbd_panic() does nothing but printk()!"
-#endif
-#undef DRBD_PANIC
-
/***
* on the wire
*********************************************************************/
@@ -1425,26 +1394,21 @@
*/
static inline void __drbd_chk_io_error(drbd_dev* mdev, int forcedetach)
{
- /* FIXME cleanup the messages here */
switch(mdev->bc->dc.on_io_error) {
case PassOn: /* FIXME would this be better named "Ignore"? */
- if (!forcedetach) {
- ERR("Local IO failed. Passing error on...\n");
- break;
- }
- /* NOTE fall through to detach case if forcedetach set */
+ if (!forcedetach) {
+ ERR("Local IO failed. Passing error on...\n");
+ break;
+ }
+ /* NOTE fall through to detach case if forcedetach set */
case Detach:
if (_drbd_set_state(_NS(mdev,disk,Failed),ChgStateHard)
== SS_Success) {
ERR("Local IO failed. Detaching...\n");
}
break;
- case Panic:
+ case CallIOEHelper:
_drbd_set_state(_NS(mdev,disk,Failed),ChgStateHard);
- /* FIXME this is very ugly anyways.
- * but in case we panic, we should at least not panic
- * while holding the req_lock hand with irq disabled. */
- drbd_panic("IO error on backing device!\n");
break;
}
}
@@ -1833,16 +1797,6 @@
return seq;
}
-static inline void drbd_suicide(void)
-{
-#ifdef TASK_ZOMBIE
- set_current_state(TASK_ZOMBIE);
-#else
- current->exit_state = EXIT_ZOMBIE;
-#endif
- schedule();
-}
-
static inline int drbd_queue_order_type(drbd_dev* mdev)
{
int rv;
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2006-10-02 15:51:32 UTC (rev 2486)
+++ trunk/drbd/drbd_main.c 2006-10-02 15:54:16 UTC (rev 2487)
@@ -348,12 +348,17 @@
*/
int drbd_io_error(drbd_dev* mdev, int forcedetach)
{
+ enum io_error_handler eh;
unsigned long flags;
int send,ok=1;
- if(!forcedetach &&
- mdev->bc->dc.on_io_error != Panic &&
- mdev->bc->dc.on_io_error != Detach)
+ eh = PassOn;
+ if(inc_local(mdev)) {
+ eh = mdev->bc->dc.on_io_error;
+ dec_local(mdev);
+ }
+
+ if(!forcedetach && eh == PassOn)
return 1;
spin_lock_irqsave(&mdev->req_lock,flags);
@@ -378,6 +383,10 @@
/* Releasing the backing device is done in after_state_ch() */
+ if(eh == CallIOEHelper) {
+ drbd_khelper(mdev,"local-io-error");
+ }
+
return ok;
}
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2006-10-02 15:51:32 UTC (rev 2486)
+++ trunk/drbd/drbd_receiver.c 2006-10-02 15:54:16 UTC (rev 2487)
@@ -476,10 +476,6 @@
struct msghdr msg;
int rv;
- if (unlikely(drbd_did_panic == DRBD_MAGIC)) {
- drbd_suicide();
- }
-
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_iovlen = 1;
@@ -507,10 +503,6 @@
struct msghdr msg;
int rv;
- if (unlikely(drbd_did_panic == DRBD_MAGIC)) {
- drbd_suicide();
- }
-
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_iovlen = 1;
@@ -3007,15 +2999,6 @@
drbd_rs_complete_io(mdev,sector);
-
- // In case we are not primary, we could simply live on...
-
-// warning LGE "ugly and wrong"
- drbd_panic("Got NegRSDReply. WE ARE LOST. We lost our up-to-date disk.\n");
-
- // THINK do we have other options, but panic?
- // what about bio_endio, in case we don't panic ??
-
return TRUE;
}
Modified: trunk/drbd/drbd_req.c
===================================================================
--- trunk/drbd/drbd_req.c 2006-10-02 15:51:32 UTC (rev 2486)
+++ trunk/drbd/drbd_req.c 2006-10-02 15:54:16 UTC (rev 2487)
@@ -1003,9 +1003,6 @@
*/
static int drbd_fail_request_early(drbd_dev* mdev, int is_write)
{
- if (unlikely(drbd_did_panic == DRBD_MAGIC))
- return 1;
-
// Unconfigured
if (mdev->state.conn == Disconnecting &&
mdev->state.disk == Diskless)
Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c 2006-10-02 15:51:32 UTC (rev 2486)
+++ trunk/drbd/drbd_worker.c 2006-10-02 15:54:16 UTC (rev 2487)
@@ -817,10 +817,6 @@
for (;;) {
intr = down_interruptible(&mdev->data.work.s);
- if (unlikely(drbd_did_panic == DRBD_MAGIC)) {
- drbd_suicide();
- }
-
if (intr) {
D_ASSERT(intr == -EINTR);
flush_signals(current);
Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h 2006-10-02 15:51:32 UTC (rev 2486)
+++ trunk/drbd/linux/drbd.h 2006-10-02 15:54:16 UTC (rev 2487)
@@ -35,7 +35,7 @@
enum io_error_handler {
PassOn, /* FIXME should the better be named "Ignore"? */
- Panic,
+ CallIOEHelper,
Detach
};
Modified: trunk/scripts/drbd.conf
===================================================================
--- trunk/scripts/drbd.conf 2006-10-02 15:51:32 UTC (rev 2486)
+++ trunk/scripts/drbd.conf 2006-10-02 15:54:16 UTC (rev 2487)
@@ -142,6 +142,12 @@
# auto recovery procedure. As as consequence it should go away.
pri-lost-after-sb "echo O > /proc/sysrq-trigger ; halt -f";
+ # In case you have set the on-io-error option to "call-local-io-error",
+ # this script will get executed in case of a local IO error. It is
+ # expected that this script will case a immediate failover in the
+ # cluster.
+ local-io-error "echo O > /proc/sysrq-trigger ; halt -f";
+
# Commands to run in case we need to downgrade the peer's disk
# state to "Outdated". Should be implemented by the superior
# communication possibilities of our cluster manager.
@@ -176,7 +182,8 @@
# "pass_on" -> Report the io-error to the upper layers.
# Primary -> report it to the mounted file system.
# Secondary -> ignore it.
- # "panic" -> The node leaves the cluster by doing a kernel panic.
+ # "call-local-io-error"
+ # -> Call the script configured by the name "local-io-error".
# "detach" -> The node drops its backing storage device, and
# continues in disk less mode.
#
Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c 2006-10-02 15:51:32 UTC (rev 2486)
+++ trunk/user/drbdsetup.c 2006-10-02 15:54:16 UTC (rev 2487)
@@ -184,9 +184,9 @@
int w_synced_state(unsigned int seq, struct drbd_nl_cfg_reply *reply);
const char *on_error[] = {
- [PassOn] = "pass_on",
- [Panic] = "panic",
- [Detach] = "detach",
+ [PassOn] = "pass_on",
+ [CallIOEHelper] = "call-local-io-error",
+ [Detach] = "detach",
};
const char *fencing_n[] = {
More information about the drbd-cvs
mailing list