[DRBD-cvs] drbd by phil; Before this pathc the following could ha...
drbd-user@lists.linbit.com
drbd-user@lists.linbit.com
Sun, 7 Mar 2004 15:34:54 +0100 (CET)
DRBD CVS committal
Author : phil
Module : drbd
Dir : drbd/drbd
Modified Files:
Tag: rel-0_7-branch
drbd_actlog.c
Log Message:
Before this pathc the following could happen:
we get a call to drbd_al_begin_io() and need to do an update to our
on disk AL.
A second drbd_al_begin_io() for the same extent comes in and PROCEEDES
because it finds the extent in the hashtable!
Fixed. Now the hashtable is updated only in lc_changed().
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/drbd_actlog.c,v
retrieving revision 1.1.2.74
retrieving revision 1.1.2.75
diff -u -3 -r1.1.2.74 -r1.1.2.75
--- drbd_actlog.c 6 Mar 2004 13:28:13 -0000 1.1.2.74
+++ drbd_actlog.c 7 Mar 2004 14:34:49 -0000 1.1.2.75
@@ -105,7 +105,8 @@
unsigned int enr;
};
-STATIC void drbd_al_write_transaction(struct Drbd_Conf *,struct lc_element *);
+STATIC void drbd_al_write_transaction(struct Drbd_Conf *,struct lc_element *,
+ unsigned int );
STATIC void drbd_update_on_disk_bm(struct Drbd_Conf *,unsigned int);
#define SM (BM_EXTENT_SIZE / AL_EXTENT_SIZE)
@@ -153,12 +154,11 @@
unsigned int evicted;
evicted = al_ext->lc_number;
- al_ext->lc_number = enr;
if(mdev->cstate < Connected && evicted != LC_FREE ) {
drbd_update_on_disk_bm(mdev,evicted);
}
- drbd_al_write_transaction(mdev,al_ext);
+ drbd_al_write_transaction(mdev,al_ext,enr);
mdev->al_writ_cnt++;
spin_lock_irq(&mdev->al_lock);
@@ -192,7 +192,8 @@
}
STATIC void
-drbd_al_write_transaction(struct Drbd_Conf *mdev,struct lc_element *updated)
+drbd_al_write_transaction(struct Drbd_Conf *mdev,struct lc_element *updated,
+ unsigned int new_enr)
{
int i,n,mx;
unsigned int extent_nr;
@@ -209,13 +210,13 @@
n = lc_index_of(mdev->act_log, updated);
buffer->updates[0].pos = cpu_to_be32(n);
- buffer->updates[0].extent = cpu_to_be32(updated->lc_number);
+ buffer->updates[0].extent = cpu_to_be32(new_enr);
#if 0 /* Use this printf with the test_al.pl program */
- ERR("T%03d S%03d=E%06d\n", mdev->al_tr_number,n,updated->lc_number);
+ ERR("T%03d S%03d=E%06d\n", mdev->al_tr_number,n,new_enr);
#endif
- xor_sum ^= updated->lc_number;
+ xor_sum ^= new_enr;
mx = min_t(int,AL_EXTENTS_PT,
mdev->act_log->nr_elements - mdev->al_tr_cycle);