[DRBD-cvs] drbd by lars; * DRBD_ratelimit macro, so we don't flo...
drbd-user@lists.linbit.com
drbd-user@lists.linbit.com
Tue, 1 Jun 2004 09:01:02 +0200 (CEST)
DRBD CVS committal
Author : lars
Module : drbd
Dir : drbd/drbd
Modified Files:
Tag: rel-0_7-branch
drbd_actlog.c drbd_compat_wrappers.h drbd_dsender.c drbd_fs.c
drbd_int.h drbd_main.c drbd_proc.c drbd_receiver.c
drbd_req-2.4.c
Log Message:
* DRBD_ratelimit macro, so we don't flood the printk buffer
* test for backin_gbdev and md_bdev != NULL at all (?) places
* don't send several "WriteHint" in a row
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/drbd_actlog.c,v
retrieving revision 1.1.2.102
retrieving revision 1.1.2.103
diff -u -3 -r1.1.2.102 -r1.1.2.103
--- drbd_actlog.c 21 May 2004 11:43:05 -0000 1.1.2.102
+++ drbd_actlog.c 1 Jun 2004 07:00:57 -0000 1.1.2.103
@@ -41,6 +41,13 @@
struct buffer_head bh;
struct completion event;
+ if (!mdev->md_bdev) {
+ if (DRBD_ratelimit(5*HZ,5)) {
+ ERR("mdev->md_bdev==NULL\n");
+ dump_stack();
+ }
+ return 0;
+ }
#ifdef PARANOIA
if (rw != WRITE) {
void *b = page_address(mdev->md_io_page);
@@ -70,6 +77,13 @@
struct bio_vec vec;
struct completion event;
+ if (!mdev->md_bdev) {
+ if (DRBD_ratelimit(5*HZ,5)) {
+ ERR("mdev->md_bdev==NULL\n");
+ dump_stack();
+ }
+ return 0;
+ }
#ifdef PARANOIA
if (rw != WRITE) {
void *b = page_address(mdev->md_io_page);
@@ -574,10 +588,13 @@
bm_words = mdev->mbds_id->size/sizeof(long);
bm_i = enr * BM_WORDS_PER_EXTENT ;
- ERR_IF(bm_i >= bm_words) {
- DUMPI(bm_i);
- DUMPI(bm_words);
- dump_stack();
+ if(bm_i >= bm_words) {
+ if (DRBD_ratelimit(5*HZ,5)) {
+ ERR("%s:%d:%s: (bm_i=%u) >= (bm_words=%u)",
+ __FILE__, __LINE__, __FUNCTION__,
+ bm_i, bm_words);
+ dump_stack();
+ }
return;
}
want=min_t(unsigned int,512/sizeof(long),bm_words-bm_i);
@@ -605,7 +622,8 @@
struct update_odbm_work *udw = (struct update_odbm_work*)w;
if( !inc_local_md_only(mdev) ) {
- WARN("Can not update on disk bitmap, local IO disabled.\n");
+ if (DRBD_ratelimit(5*HZ,5))
+ WARN("Can not update on disk bitmap, local IO disabled.\n");
return 1;
}
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/drbd_compat_wrappers.h,v
retrieving revision 1.1.2.43
retrieving revision 1.1.2.44
diff -u -3 -r1.1.2.43 -r1.1.2.44
--- drbd_compat_wrappers.h 18 May 2004 11:15:21 -0000 1.1.2.43
+++ drbd_compat_wrappers.h 1 Jun 2004 07:00:57 -0000 1.1.2.44
@@ -35,7 +35,9 @@
static inline void drbd_set_blocksize(drbd_dev *mdev, int blksize)
{
set_blocksize(mdev->this_bdev, blksize);
- set_blocksize(mdev->backing_bdev, blksize);
+ if (mdev->backing_bdev)
+ set_blocksize(mdev->backing_bdev, blksize);
+ else D_ASSERT(mdev->backing_bdev);
}
static inline int drbd_sync_me(drbd_dev *mdev)
@@ -120,6 +122,8 @@
drbd_ee_bh_prepare(drbd_dev *mdev, struct buffer_head *bh,
sector_t sector, int size)
{
+ D_ASSERT(mdev->backing_bdev);
+
bh->b_blocknr = sector; // We abuse b_blocknr here.
bh->b_size = size;
bh->b_rsector = sector;
@@ -240,6 +244,15 @@
static inline void drbd_generic_make_request(int rw, struct buffer_head *bh)
{
+ if (!bh->b_rdev) {
+ if (DRBD_ratelimit(5*HZ,5)) {
+ printk(KERN_ERR "drbd_generic_make_request: bh->b_rdev == NULL\n");
+ dump_stack();
+ }
+ drbd_bio_IO_error(bh);
+ return;
+ }
+
generic_make_request(rw, bh);
}
@@ -253,7 +266,7 @@
D_ASSERT(mdev->state == Primary);
if (mdev->cstate < Connected)
return;
- if (!test_and_set_bit(WRITE_HINT_QUEUED,&mdev->flags)) {
+ if (!test_and_set_bit(UNPLUG_QUEUED,&mdev->flags)) {
queue_task(&mdev->write_hint_tq, &tq_disk); // IO HINT
}
}
@@ -310,7 +323,12 @@
static inline void drbd_set_blocksize(drbd_dev *mdev, int blksize)
{
set_blocksize(mdev->this_bdev,blksize);
- set_blocksize(mdev->backing_bdev,blksize);
+ if (mdev->backing_bdev) {
+ set_blocksize(mdev->backing_bdev, blksize);
+ } else {
+ D_ASSERT(mdev->backing_bdev);
+ // FIXME send some package over to the peer?
+ }
}
static inline int drbd_sync_me(drbd_dev *mdev)
@@ -441,6 +459,8 @@
{
struct bio * const bio = &e->private_bio;
+ D_ASSERT(mdev->backing_bdev);
+
bio->bi_flags = 1 << BIO_UPTODATE;
bio->bi_io_vec->bv_len =
bio->bi_size = size;
@@ -514,6 +534,16 @@
static inline void drbd_generic_make_request(int rw, struct bio *bio)
{
bio->bi_rw = rw; //??
+
+ if (!bio->bi_bdev) {
+ if (DRBD_ratelimit(5*HZ,5)) {
+ printk(KERN_ERR "drbd_generic_make_request: bio->bi_bdev == NULL\n");
+ dump_stack();
+ }
+ drbd_bio_IO_error(bio);
+ return;
+ }
+
generic_make_request(bio);
}
@@ -525,7 +555,14 @@
static inline void drbd_kick_lo(drbd_dev *mdev)
{
- drbd_blk_run_queue(bdev_get_queue(mdev->backing_bdev));
+ if (!mdev->backing_bdev) {
+ if (DRBD_ratelimit(5*HZ,5)) {
+ ERR("backing_bdev==NULL in drbd_kick_lo\n");
+ dump_stack();
+ }
+ } else {
+ drbd_blk_run_queue(bdev_get_queue(mdev->backing_bdev));
+ }
}
static inline void drbd_plug_device(drbd_dev *mdev)
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/drbd_dsender.c,v
retrieving revision 1.1.2.115
retrieving revision 1.1.2.116
diff -u -3 -r1.1.2.115 -r1.1.2.116
--- drbd_dsender.c 25 May 2004 12:20:28 -0000 1.1.2.115
+++ drbd_dsender.c 1 Jun 2004 07:00:57 -0000 1.1.2.116
@@ -169,7 +169,8 @@
if(mdev->on_io_error == PassOn) goto pass_on;
// ok, if we survived this, retry:
// FIXME sector ...
- ERR("local read failed, retrying remotely\n");
+ if (DRBD_ratelimit(5*HZ,5))
+ ERR("local read failed, retrying remotely\n");
req->w.cb = w_read_retry_remote;
drbd_queue_work(mdev,&mdev->data.work,&req->w);
} else {
@@ -326,7 +327,8 @@
if(mdev->on_io_error == PassOn) goto pass_on;
// ok, if we survived this, retry:
// FIXME sector ...
- ERR("local read failed, retrying remotely\n");
+ if (DRBD_ratelimit(5*HZ,5))
+ ERR("local read failed, retrying remotely\n");
req->w.cb = w_read_retry_remote;
drbd_queue_work(mdev,&mdev->data.work,&req->w);
} else {
@@ -543,7 +545,8 @@
ok=drbd_send_block(mdev, DataReply, e);
} else {
ok=drbd_send_ack(mdev,NegDReply,e);
- ERR("Sending NegDReply. I guess it gets messy.\n");
+ if (DRBD_ratelimit(5*HZ,5))
+ ERR("Sending NegDReply. I guess it gets messy.\n");
drbd_io_error(mdev);
}
@@ -573,11 +576,18 @@
drbd_rs_complete_io(mdev,drbd_ee_get_sector(e));
if(likely(drbd_bio_uptodate(&e->private_bio))) {
- inc_rs_pending(mdev);
- ok=drbd_send_block(mdev, RSDataReply, e);
+ if (likely( !test_bit(PARTNER_DISKLESS,&mdev->flags) )) {
+ inc_rs_pending(mdev);
+ ok=drbd_send_block(mdev, RSDataReply, e);
+ } else {
+ if (DRBD_ratelimit(5*HZ,5))
+ ERR("Not sending RSDataReply, partner DISKLESS!\n");
+ ok=1;
+ }
} else {
ok=drbd_send_ack(mdev,NegRSDReply,e);
- ERR("Sending NegDReply. I guess it gets messy.\n");
+ if (DRBD_ratelimit(5*HZ,5))
+ ERR("Sending NegDReply. I guess it gets messy.\n");
drbd_io_error(mdev);
}
@@ -609,7 +619,7 @@
int w_send_write_hint(drbd_dev *mdev, struct drbd_work *w, int cancel)
{
if (cancel) return 1;
- NOT_IN_26(clear_bit(WRITE_HINT_QUEUED,&mdev->flags));
+ NOT_IN_26(clear_bit(UNPLUG_QUEUED,&mdev->flags));
return drbd_send_short_cmd(mdev,WriteHint);
}
@@ -798,10 +808,9 @@
side == SyncTarget ? "target" : "source",
(unsigned long) (mdev->rs_left+1)>>1);
- /* no longer true since we queue the write hints here, too
- PARANOIA_BUG_ON(!list_empty(&mdev->resync_work.list));
- */
- PARANOIA_BUG_ON(mdev->resync_work.cb != w_resync_inactive);
+ // FIXME: this was a PARANOIA_BUG_ON, but it triggered! ??
+ ERR_IF(mdev->resync_work.cb != w_resync_inactive)
+ return;
if ( mdev->rs_left == 0 ) {
drbd_resync_finished(mdev);
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_fs.c,v
retrieving revision 1.28.2.98
retrieving revision 1.28.2.99
diff -u -3 -r1.28.2.98 -r1.28.2.99
--- drbd_fs.c 25 May 2004 14:51:30 -0000 1.28.2.98
+++ drbd_fs.c 1 Jun 2004 07:00:57 -0000 1.28.2.99
@@ -332,7 +332,7 @@
drbd_determin_dev_size(mdev);
- if(md_gc_valid) drbd_read_bm(mdev);
+ if(md_gc_valid > 0) drbd_read_bm(mdev);
else {
INFO("Assuming that all blocks are out of sync (aka FullSync)\n");
bm_fill_bm(mdev->mbds_id,-1);
@@ -376,10 +376,10 @@
}
-// FIXME why "else" ?? I think allways, and *before send_param!
+// FIXME why "else" ?? I think allways, and *before* send_param!
clear_bit(DISKLESS,&mdev->flags);
smp_wmb();
-// FIXME explain:
+// FIXME EXPLAIN:
clear_bit(MD_IO_ALLOWED,&mdev->flags);
if(mdev->cstate >= Connected ) {
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_int.h,v
retrieving revision 1.58.2.166
retrieving revision 1.58.2.167
diff -u -3 -r1.58.2.166 -r1.58.2.167
--- drbd_int.h 21 May 2004 11:43:05 -0000 1.58.2.166
+++ drbd_int.h 1 Jun 2004 07:00:57 -0000 1.58.2.167
@@ -148,6 +148,37 @@
#define INFO(fmt,args...) PRINTK(KERN_INFO, fmt , ##args)
#define DBG(fmt,args...) PRINTK(KERN_DEBUG, fmt , ##args)
+/* see kernel/printk.c:printk_ratelimit
+ * macro, so it is easy do have independend rate limits at different locations
+ * "initializer element not constant ..." with kernel 2.4 :(
+ * so I initialize toks to something large
+ */
+#define DRBD_ratelimit(ratelimit_jiffies,ratelimit_burst) \
+({ \
+ int __ret; \
+ static unsigned long toks = 0x80000000UL; \
+ static unsigned long last_msg; \
+ static int missed; \
+ unsigned long now = jiffies; \
+ toks += now - last_msg; \
+ last_msg = now; \
+ if (toks > (ratelimit_burst * ratelimit_jiffies)) \
+ toks = ratelimit_burst * ratelimit_jiffies; \
+ if (toks >= ratelimit_jiffies) { \
+ int lost = missed; \
+ missed = 0; \
+ toks -= ratelimit_jiffies; \
+ if (lost) \
+ printk(KERN_WARNING "drbd: %d messages suppressed.\n", lost);\
+ __ret=1; \
+ } else { \
+ missed++; \
+ __ret=0; \
+ } \
+ __ret; \
+})
+
+
#ifdef DBG_ASSERTS
extern void drbd_assert_breakpoint(drbd_dev*, char *, char *, int );
# define D_ASSERT(exp) if (!(exp)) \
@@ -167,18 +198,6 @@
#include <linux/stringify.h>
#define HERE __stringify(__FILE__ __LINE__) // __FUNCTION__
-#if 1
-#define C_DBG(r,x...)
-#else
- // at most one DBG(x) per t seconds
-#define C_DBG(t,x...) do { \
- static unsigned long _j = 0; \
- if ((long)(jiffies-_j)< HZ*t) break; \
- _j=jiffies; \
- INFO(x); \
-} while (0)
-#endif
-
// integer division, round _UP_ to the next integer
#define div_ceil(A,B) ( (A)/(B) + ((A)%(B) ? 1 : 0) )
// usual integer division
@@ -567,20 +586,22 @@
ONLY_IN_26(struct bio_vec ee_bvec;)
};
-// bitfield? enum?
/* flag bits */
-#define ISSUE_BARRIER 0
-#define SIGNAL_ASENDER 1
-#define SEND_PING 2
-#define WRITER_PRESENT 3
-#define STOP_SYNC_TIMER 4
-#define DO_NOT_INC_CONCNT 5
-#define WRITE_HINT_QUEUED 6 /* only relevant in 2.4 */
-#define DISKLESS 7
-#define PARTNER_DISKLESS 8
-#define PROCESS_EE_RUNNING 9
-#define MD_IO_ALLOWED 10
-#define SENT_DISK_FAILURE 11
+enum {
+ ISSUE_BARRIER, // next Data is preceeded by a Barrier
+ SIGNAL_ASENDER, // whether asender wants to be interrupted
+ SEND_PING, // whether asender should send a ping asap
+ WRITER_PRESENT, // somebody opened us with write intent
+ STOP_SYNC_TIMER, // tell timer to cancel itself
+ DO_NOT_INC_CONCNT, // well, don't ...
+ UNPLUG_QUEUED, // only relevant with kernel 2.4
+ UNPLUG_REMOTE, // whether sending a "WriteHint" makes sense
+ DISKLESS, // no local disk
+ PARTNER_DISKLESS, // partner has no storage
+ PROCESS_EE_RUNNING, // eek!
+ MD_IO_ALLOWED, // EXPLAIN
+ SENT_DISK_FAILURE, // sending it once is enough
+};
struct BitMap {
sector_t dev_size;
@@ -1000,12 +1021,14 @@
case Panic:
set_bit(DISKLESS,&mdev->flags);
smp_mb(); // but why is there smp_mb__after_clear_bit() ?
- drbd_panic(DEVICE_NAME" : IO error on backing device!\n");
+ drbd_panic(DEVICE_NAME "%d: IO error on backing device!\n",
+ (int)(mdev-drbd_conf));
break;
case Detach:
- ERR("Local IO failed. Detaching...\n");
- set_bit(DISKLESS,&mdev->flags);
- smp_mb(); // Nack is sent in w_e handlers.
+ if (!test_and_set_bit(DISKLESS,&mdev->flags)) {
+ smp_mb(); // Nack is sent in w_e handlers.
+ ERR("Local IO failed. Detaching...\n");
+ }
break;
}
}
@@ -1026,6 +1049,13 @@
static inline sector_t drbd_md_ss(drbd_dev *mdev)
{
if( mdev->md_index == -1 ) {
+ if (!mdev->backing_bdev) {
+ if (DRBD_ratelimit(5*HZ,5)) {
+ ERR("mdev->backing_bdev==NULL\n");
+ dump_stack();
+ }
+ return 0;
+ }
return ( (drbd_get_capacity(mdev->backing_bdev) & ~7L)
- (MD_RESERVED_SIZE<<1) );
} else {
@@ -1220,7 +1250,7 @@
bm_set_bit(mdev, sector, blk_size, SS_OUT_OF_SYNC);
}
-#ifdef DUMP_ALL_PACKETS
+#ifdef DUMP_EACH_PACKET
/*
* enable to dump information about every packet exchange.
*/
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_main.c,v
retrieving revision 1.73.2.181
retrieving revision 1.73.2.182
diff -u -3 -r1.73.2.181 -r1.73.2.182
--- drbd_main.c 25 May 2004 13:52:55 -0000 1.73.2.181
+++ drbd_main.c 1 Jun 2004 07:00:57 -0000 1.73.2.182
@@ -121,11 +121,11 @@
// module parameter, defined
#ifdef MODULE
int minor_count = 2;
-int disable_io_hints = 0;
#else
int minor_count = 8;
-int disable_io_hints = 0;
#endif
+// FIXME disable_io_hints shall die
+int disable_io_hints = 0;
// global panic flag
volatile int drbd_did_panic = 0;
@@ -358,6 +358,9 @@
atomic_read(&mdev->local_cnt) == 0 , HZ ) <= 0) {
WARN("Not releasing backing storage device.\n");
} else {
+ /* FIXME I see a race here, with local_cnt... no?
+ * it it is harmless, please EXPLAIN why.
+ */
WARN("Releasing backing storage device.\n");
drbd_free_ll_dev(mdev);
mdev->la_size=0;
@@ -423,6 +426,7 @@
}
if(test_bit(MD_IO_ALLOWED,&mdev->flags) &&
test_bit(DISKLESS,&mdev->flags) && ns < Connected) {
+// FIXME EXPLAIN
clear_bit(MD_IO_ALLOWED,&mdev->flags);
}
}
@@ -652,6 +656,7 @@
unsigned long m_size; // sector_t ??
if(!test_bit(DISKLESS,&mdev->flags) || test_bit(MD_IO_ALLOWED,&mdev->flags)) {
+ D_ASSERT(mdev->backing_bdev);
if (mdev->md_index == -1 ) m_size = drbd_md_ss(mdev)>>1;
else m_size = drbd_get_capacity(mdev->backing_bdev)>>1;
} else m_size = 0;
@@ -800,10 +805,8 @@
drop_it = !--mdev->ko_count;
if ( !drop_it ) {
- printk(KERN_ERR DEVICE_NAME
- "%d: [%s/%d] sock_sendmsg time expired, ko = %u\n",
- (int)(mdev-drbd_conf), current->comm, current->pid,
- mdev->ko_count);
+ ERR("[%s/%d] sock_sendmsg time expired, ko = %u\n",
+ current->comm, current->pid, mdev->ko_count);
request_ping(mdev);
}
@@ -897,6 +900,8 @@
ok = _drbd_send_barrier(mdev);
if(ok) {
tl_add(mdev,req);
+ dump_packet(mdev,mdev->data.socket,0,(void*)&p, __FILE__, __LINE__);
+ set_bit(UNPLUG_REMOTE,&mdev->flags);
ok = (drbd_send(mdev,mdev->data.socket,&p,sizeof(p),MSG_MORE) == sizeof(p));
if(ok) {
ok = _drbd_send_zc_bio(mdev,&req->private_bio);
@@ -1020,9 +1025,11 @@
}
D_ASSERT(rv != 0);
if (rv == -EINTR ) {
- DBG("Got a signal in drbd_send(,%c,)!\n",
- sock == mdev->meta.socket ? 'm' : 's');
- // dump_stack();
+ if (DRBD_ratelimit(5*HZ,5)) {
+ DBG("Got a signal in drbd_send(,%c,)!\n",
+ sock == mdev->meta.socket ? 'm' : 's');
+ // dump_stack();
+ }
drbd_flush_signals(current);
rv = 0;
}
@@ -1096,8 +1103,6 @@
STATIC void drbd_unplug_fn(void *data)
{
struct Drbd_Conf* mdev = (drbd_dev*)data;
- int i;
-
spin_lock_irq(&mdev->req_lock);
if (list_empty(&mdev->unplug_work.list))
_drbd_queue_work_front(&mdev->data.work,&mdev->unplug_work);
@@ -1124,16 +1129,18 @@
spin_unlock_irq(q->queue_lock);
/* only if connected */
- if (mdev->cstate >= Connected) {
+ if (mdev->cstate >= Connected && !test_bit(PARTNER_DISKLESS,&mdev->flags)) {
D_ASSERT(mdev->state == Primary);
- spin_lock_irq(&mdev->req_lock);
- /* add to the front of the data.work queue,
- * unless already queued.
- * XXX this might be a good addition to drbd_queue_work
- * anyways, to detect "double queuing" ... */
- if (list_empty(&mdev->unplug_work.list))
- _drbd_queue_work_front(&mdev->data.work,&mdev->unplug_work);
- spin_unlock_irq(&mdev->req_lock);
+ if (test_and_clear_bit(UNPLUG_REMOTE,&mdev->flags)) {
+ spin_lock_irq(&mdev->req_lock);
+ /* add to the front of the data.work queue,
+ * unless already queued.
+ * XXX this might be a good addition to drbd_queue_work
+ * anyways, to detect "double queuing" ... */
+ if (list_empty(&mdev->unplug_work.list))
+ _drbd_queue_work_front(&mdev->data.work,&mdev->unplug_work);
+ spin_unlock_irq(&mdev->req_lock);
+ }
}
if(!test_bit(DISKLESS,&mdev->flags)) drbd_kick_lo(mdev);
@@ -1144,9 +1151,9 @@
{
mdev->flags = 1<<DISKLESS;
- /* If the WRITE_HINT_QUEUED flag is set but it is not
+ /* If the UNPLUG_QUEUED flag is set but it is not
actually queued the functionality is completely disabled */
- if (disable_io_hints) mdev->flags |= 1<<WRITE_HINT_QUEUED;
+ if (disable_io_hints) mdev->flags |= 1<<UNPLUG_QUEUED;
mdev->sync_conf.rate = 250;
mdev->sync_conf.al_extents = 127; // 512 MB active set
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_proc.c,v
retrieving revision 1.8.2.29
retrieving revision 1.8.2.30
diff -u -3 -r1.8.2.29 -r1.8.2.30
--- drbd_proc.c 21 May 2004 11:43:05 -0000 1.8.2.29
+++ drbd_proc.c 1 Jun 2004 07:00:57 -0000 1.8.2.30
@@ -184,7 +184,7 @@
for (i = 0; i < minor_count; i++) {
sn = cstate_to_name(drbd_conf[i].cstate);
if(drbd_conf[i].cstate == Connected) {
- if(test_bit(DISKLESS,&drbd_conf[i].flags))
+ if(test_bit(DISKLESS,&drbd_conf[i].flags))
sn = "DiskLessClient";
if(test_bit(PARTNER_DISKLESS,&drbd_conf[i].flags))
sn = "ServerForDLess";
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_receiver.c,v
retrieving revision 1.97.2.163
retrieving revision 1.97.2.164
diff -u -3 -r1.97.2.163 -r1.97.2.164
--- drbd_receiver.c 24 May 2004 14:44:10 -0000 1.97.2.163
+++ drbd_receiver.c 1 Jun 2004 07:00:57 -0000 1.97.2.164
@@ -869,7 +869,8 @@
e->block_id = ID_SYNCER;
if(!inc_local(mdev)) {
- ERR("Can not write resync data to local disk.\n");
+ if (DRBD_ratelimit(5*HZ,5))
+ ERR("Can not write resync data to local disk.\n");
drbd_send_ack(mdev,NegAck,e);
spin_lock_irq(&mdev->ee_lock);
drbd_put_ee(mdev,e);
@@ -1015,7 +1016,8 @@
e->block_id = p->block_id; // no meaning on this side, e* on partner
if(!inc_local(mdev)) {
- ERR("Can not write mirrored data block to local disk.\n");
+ if (DRBD_ratelimit(5*HZ,5))
+ ERR("Can not write mirrored data block to local disk.\n");
drbd_send_ack(mdev,NegAck,e);
spin_lock_irq(&mdev->ee_lock);
drbd_put_ee(mdev,e);
@@ -1074,7 +1076,8 @@
spin_unlock_irq(&mdev->ee_lock);
if(!inc_local(mdev)) {
- ERR("Can not satisfy peer's read request, no local disk.\n");
+ if (DRBD_ratelimit(5*HZ,5))
+ ERR("Can not satisfy peer's read request, no local disk.\n");
drbd_send_ack(mdev,NegDReply,e);
spin_lock_irq(&mdev->ee_lock);
drbd_put_ee(mdev,e);
@@ -1202,7 +1205,8 @@
}
if(!p_size) {
- set_bit(PARTNER_DISKLESS, &mdev->flags);
+ if (!test_and_set_bit(PARTNER_DISKLESS, &mdev->flags))
+ WARN("PARTNER DISKLESS\n");
if(mdev->cstate >= Connected ) {
if(mdev->state == Primary) tl_clear(mdev);
if(mdev->state == Primary ||
@@ -1216,6 +1220,9 @@
set_bit(STOP_SYNC_TIMER,&mdev->flags);
set_cstate(mdev,Connected);
}
+ } else {
+ if (test_and_clear_bit(PARTNER_DISKLESS, &mdev->flags))
+ WARN("Partner no longer diskless\n");
}
if (mdev->cstate == WFReportParams) {
@@ -1290,13 +1297,16 @@
skipped: // do not adopt gen counts when sync was skipped ...
if (mdev->cstate == WFReportParams) set_cstate(mdev,Connected);
- if (p_size && mdev->cstate==Connected) clear_bit(PARTNER_DISKLESS,&mdev->flags);
+ // see above. if (p_size && mdev->cstate==Connected) clear_bit(PARTNER_DISKLESS,&mdev->flags);
oo_state = mdev->o_state;
mdev->o_state = be32_to_cpu(p->state);
if(oo_state == Secondary && mdev->o_state == Primary) {
drbd_md_inc(mdev,ConnectedCnt);
}
+ if (oo_state != mdev->o_state) {
+ INFO("Peer switched to %s state\n", nodestate_to_name(mdev->o_state));
+ }
drbd_md_write(mdev); // update connected indicator, la_size, ...
@@ -1356,9 +1366,9 @@
* FIXME this should only be D_ASSERT here.
* *doing* it here masks a logic bug elsewhere, I think.
*/
- clear_bit(PARTNER_DISKLESS,&mdev->flags);
- clear_bit(DISKLESS,&mdev->flags);
- smp_wmb();
+ D_ASSERT(!test_bit(PARTNER_DISKLESS,&mdev->flags));
+ D_ASSERT(!test_bit(DISKLESS,&mdev->flags));
+// EXPLAIN:
clear_bit(MD_IO_ALLOWED,&mdev->flags);
ok=TRUE;
@@ -1438,7 +1448,7 @@
STATIC int receive_WriteHint(drbd_dev *mdev, Drbd_Header *h)
{
- drbd_kick_lo(mdev);
+ if (!test_bit(DISKLESS,&mdev->flags)) drbd_kick_lo(mdev);
return TRUE; // cannot fail.
}
@@ -1702,7 +1712,8 @@
sector_t sector = be64_to_cpu(p->sector);
int size = be32_to_cpu(p->blksize);
- WARN("Got NegAck packet. Peer is in troubles?\n");
+ 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));
@@ -1733,8 +1744,9 @@
INVALIDATE_MAGIC(req);
mempool_free(req,drbd_request_mempool);
- ERR("Get NegDReply. WE ARE LOST. We lost our up-to-date disk.\n");
+ 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 ??
return TRUE;
}
@@ -1748,7 +1760,7 @@
drbd_rs_complete_io(mdev,sector);
- ERR("Get NegRSDReply. WE ARE LOST. We lost our up-to-date disk.\n");
+ ERR("Got NegRSDReply. WE ARE LOST. We lost our up-to-date disk.\n");
// TODO: Do something like panic() or shut_down_cluster().
return TRUE;
}
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_req-2.4.c,v
retrieving revision 1.33.2.82
retrieving revision 1.33.2.83
diff -u -3 -r1.33.2.82 -r1.33.2.83
--- drbd_req-2.4.c 21 May 2004 08:49:50 -0000 1.33.2.82
+++ drbd_req-2.4.c 1 Jun 2004 07:00:57 -0000 1.33.2.83
@@ -122,6 +122,7 @@
spin_lock(&mdev->pr_lock);
list_add(&req->w.list,&mdev->app_reads);
spin_unlock(&mdev->pr_lock);
+ set_bit(UNPLUG_REMOTE,&mdev->flags);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
rv=drbd_send_drequest(mdev, DataRequest, bio->b_rsector, bio->b_size,
(unsigned long)req);
@@ -237,7 +238,7 @@
if (!(local || remote)) {
ERR("IO ERROR: neither local nor remote disk\n");
- // PANIC ??
+ // FIXME PANIC ??
drbd_bio_IO_error(bio);
return 0;
}