[DRBD-cvs] drbd by lars; add missing drbd_panic() calls
drbd-user@lists.linbit.com
drbd-user@lists.linbit.com
Tue, 1 Jun 2004 16:29:12 +0200 (CEST)
DRBD CVS committal
Author : lars
Module : drbd
Dir : drbd/drbd
Modified Files:
Tag: rel-0_7-branch
drbd_dsender.c drbd_fs.c drbd_int.h drbd_main.c
drbd_receiver.c drbd_req-2.4.c
Log Message:
add missing drbd_panic() calls
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/drbd_dsender.c,v
retrieving revision 1.1.2.116
retrieving revision 1.1.2.117
diff -u -3 -r1.1.2.116 -r1.1.2.117
--- drbd_dsender.c 1 Jun 2004 07:00:57 -0000 1.1.2.116
+++ drbd_dsender.c 1 Jun 2004 14:29:06 -0000 1.1.2.117
@@ -371,11 +371,12 @@
if ( cancel ||
mdev->cstate < Connected ||
test_bit(PARTNER_DISKLESS,&mdev->flags) ) {
- ERR("WE ARE LOST. Local IO failure, no peer.\n");
+ drbd_panic("WE ARE LOST. Local IO failure, no peer.\n");
+
+ // does not make much sense, but anyways...
drbd_bio_endio(req->master_bio,0);
dec_ap_bio(mdev);
mempool_free(req,drbd_request_mempool);
- // TODO: Do something like panic() or shut_down_cluster().
return 1;
}
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_fs.c,v
retrieving revision 1.28.2.99
retrieving revision 1.28.2.100
diff -u -3 -r1.28.2.99 -r1.28.2.100
--- drbd_fs.c 1 Jun 2004 07:00:57 -0000 1.28.2.99
+++ drbd_fs.c 1 Jun 2004 14:29:06 -0000 1.28.2.100
@@ -171,10 +171,13 @@
if (!test_bit(DISKLESS,&mdev->flags))
return -EBUSY;
- /* FIXME if this was "adding" a lo dev to a previously "diskless" node,
+ /* if this was "adding" a lo dev to a previously "diskless" node,
* there still could be requests comming in right now. brrks.
+ * if it was mounted, we had an open_cnt > 1,
+ * so it would be BUSY anyways...
*/
- D_ASSERT(mdev->state == Secondary);
+ ERR_IF (mdev->state != Secondary)
+ return -EBUSY;
if (mdev->open_cnt > 1)
return -EBUSY;
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_int.h,v
retrieving revision 1.58.2.167
retrieving revision 1.58.2.168
diff -u -3 -r1.58.2.167 -r1.58.2.168
--- drbd_int.h 1 Jun 2004 07:00:57 -0000 1.58.2.167
+++ drbd_int.h 1 Jun 2004 14:29:07 -0000 1.58.2.168
@@ -303,15 +303,17 @@
extern volatile int drbd_did_panic;
#if DRBD_PANIC == 0
-#define drbd_panic(x...) panic(x)
+#define drbd_panic(fmt, args...) \
+ panic(DEVICE_NAME "%d: " fmt, (int)(mdev-drbd_conf) , ##args)
#elif DRBD_PANIC == 1
#error "sorry , this does not work, please contribute"
#else
-#define drbd_panic(x...) do { \
- printk(KERN_EMERG x); \
- drbd_did_panic = DRBD_MAGIC; \
- smp_mb(); \
- panic(x); \
+#define drbd_panic(fmt, args...) do { \
+ printk(KERN_EMERG DEVICE_NAME "%d: " fmt, \
+ (int)(mdev-drbd_conf) , ##args); \
+ drbd_did_panic = DRBD_MAGIC; \
+ smp_mb(); \
+ panic(DEVICE_NAME "%d: " fmt, (int)(mdev-drbd_conf) , ##args); \
} while (0)
#endif
#undef DRBD_PANIC
@@ -1021,8 +1023,7 @@
case Panic:
set_bit(DISKLESS,&mdev->flags);
smp_mb(); // but why is there smp_mb__after_clear_bit() ?
- drbd_panic(DEVICE_NAME "%d: IO error on backing device!\n",
- (int)(mdev-drbd_conf));
+ drbd_panic("IO error on backing device!\n");
break;
case Detach:
if (!test_and_set_bit(DISKLESS,&mdev->flags)) {
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_main.c,v
retrieving revision 1.73.2.182
retrieving revision 1.73.2.183
diff -u -3 -r1.73.2.182 -r1.73.2.183
--- drbd_main.c 1 Jun 2004 07:00:57 -0000 1.73.2.182
+++ drbd_main.c 1 Jun 2004 14:29:07 -0000 1.73.2.183
@@ -1302,6 +1302,9 @@
mdev->send_task = NULL;
drbd_set_my_capacity(mdev,0);
+ // just in case
+ drbd_free_resources(mdev);
+
/*
* currently we drbd_init_ee only on module load, so
* we may do drbd_release_ee only on module unload!
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_receiver.c,v
retrieving revision 1.97.2.164
retrieving revision 1.97.2.165
diff -u -3 -r1.97.2.164 -r1.97.2.165
--- drbd_receiver.c 1 Jun 2004 07:00:57 -0000 1.97.2.164
+++ drbd_receiver.c 1 Jun 2004 14:29:07 -0000 1.97.2.165
@@ -1362,6 +1362,10 @@
}
// We just started resync. Now we can be sure that local disk IO is okay.
+
+ /* no, actually we can't. failures happen asynchronously, anytime.
+ * we can never be sure. disk may have failed while we where busy shaking hands...
+ */
/*
* FIXME this should only be D_ASSERT here.
* *doing* it here masks a logic bug elsewhere, I think.
@@ -1715,14 +1719,11 @@
if (DRBD_ratelimit(5*HZ,5))
WARN("Got NegAck packet. Peer is in troubles?\n");
- if(!is_syncer_blk(mdev,p->block_id)) {
- D_ASSERT(bm_get_bit(mdev->mbds_id,sector,size));
- // tl_clear() must have set this out of sync!
- }
-
if(is_syncer_blk(mdev,p->block_id)) {
dec_rs_pending(mdev,HERE);
} else {
+ D_ASSERT(bm_get_bit(mdev->mbds_id,sector,size));
+ // tl_clear() must have set this out of sync!
D_ASSERT(mdev->conf.wire_protocol != DRBD_PROT_A);
dec_ap_pending(mdev,HERE);
}
@@ -1744,9 +1745,11 @@
INVALIDATE_MAGIC(req);
mempool_free(req,drbd_request_mempool);
- ERR("Got NegDReply. WE ARE LOST. We lost our up-to-date disk.\n");
- // TODO: Do something like panic() or shut_down_cluster().
- // FIXME what about bio_endio, in case we don't panic ??
+ drbd_panic("Got NegDReply. 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;
}
@@ -1760,8 +1763,11 @@
drbd_rs_complete_io(mdev,sector);
- ERR("Got NegRSDReply. WE ARE LOST. We lost our up-to-date disk.\n");
- // TODO: Do something like panic() or shut_down_cluster().
+ 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;
}
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_req-2.4.c,v
retrieving revision 1.33.2.83
retrieving revision 1.33.2.84
diff -u -3 -r1.33.2.83 -r1.33.2.84
--- drbd_req-2.4.c 1 Jun 2004 07:00:57 -0000 1.33.2.83
+++ drbd_req-2.4.c 1 Jun 2004 14:29:07 -0000 1.33.2.84
@@ -158,7 +158,7 @@
* This should have been handled (panic? suspend?) somehwere
* else. But maybe it was not, so check again here.
* Caution: as long as we do not have a read/write lock on mdev,
- * to serialize state changes, this is racy, since we may loose
+ * to serialize state changes, this is racy, since we may lose
* the connection *after* we test for the cstate.
*/
if ( ( test_bit(DISKLESS,&mdev->flags)