aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_receiver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/drbd/drbd_receiver.c')
-rw-r--r--drivers/block/drbd/drbd_receiver.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 397f97701988..4665ad79b4ae 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1752,7 +1752,7 @@ static int e_end_block(struct drbd_work *w, int cancel)
1752 } 1752 }
1753 /* we delete from the conflict detection hash _after_ we sent out the 1753 /* we delete from the conflict detection hash _after_ we sent out the
1754 * P_WRITE_ACK / P_NEG_ACK, to get the sequence number right. */ 1754 * P_WRITE_ACK / P_NEG_ACK, to get the sequence number right. */
1755 if (mdev->tconn->net_conf->two_primaries) { 1755 if (peer_req->flags & EE_IN_INTERVAL_TREE) {
1756 spin_lock_irq(&mdev->tconn->req_lock); 1756 spin_lock_irq(&mdev->tconn->req_lock);
1757 D_ASSERT(!drbd_interval_empty(&peer_req->i)); 1757 D_ASSERT(!drbd_interval_empty(&peer_req->i));
1758 drbd_remove_epoch_entry_interval(mdev, peer_req); 1758 drbd_remove_epoch_entry_interval(mdev, peer_req);
@@ -1811,14 +1811,19 @@ static u32 seq_max(u32 a, u32 b)
1811static bool need_peer_seq(struct drbd_conf *mdev) 1811static bool need_peer_seq(struct drbd_conf *mdev)
1812{ 1812{
1813 struct drbd_tconn *tconn = mdev->tconn; 1813 struct drbd_tconn *tconn = mdev->tconn;
1814 int tp;
1814 1815
1815 /* 1816 /*
1816 * We only need to keep track of the last packet_seq number of our peer 1817 * We only need to keep track of the last packet_seq number of our peer
1817 * if we are in dual-primary mode and we have the discard flag set; see 1818 * if we are in dual-primary mode and we have the discard flag set; see
1818 * handle_write_conflicts(). 1819 * handle_write_conflicts().
1819 */ 1820 */
1820 return tconn->net_conf->two_primaries && 1821
1821 test_bit(DISCARD_CONCURRENT, &tconn->flags); 1822 rcu_read_lock();
1823 tp = rcu_dereference(mdev->tconn->net_conf)->two_primaries;
1824 rcu_read_unlock();
1825
1826 return tp && test_bit(DISCARD_CONCURRENT, &tconn->flags);
1822} 1827}
1823 1828
1824static void update_peer_seq(struct drbd_conf *mdev, unsigned int peer_seq) 1829static void update_peer_seq(struct drbd_conf *mdev, unsigned int peer_seq)
@@ -2049,7 +2054,7 @@ static int receive_Data(struct drbd_tconn *tconn, struct packet_info *pi)
2049 u32 peer_seq = be32_to_cpu(p->seq_num); 2054 u32 peer_seq = be32_to_cpu(p->seq_num);
2050 int rw = WRITE; 2055 int rw = WRITE;
2051 u32 dp_flags; 2056 u32 dp_flags;
2052 int err; 2057 int err, tp;
2053 2058
2054 mdev = vnr_to_mdev(tconn, pi->vnr); 2059 mdev = vnr_to_mdev(tconn, pi->vnr);
2055 if (!mdev) 2060 if (!mdev)
@@ -2094,7 +2099,11 @@ static int receive_Data(struct drbd_tconn *tconn, struct packet_info *pi)
2094 atomic_inc(&peer_req->epoch->active); 2099 atomic_inc(&peer_req->epoch->active);
2095 spin_unlock(&mdev->epoch_lock); 2100 spin_unlock(&mdev->epoch_lock);
2096 2101
2097 if (mdev->tconn->net_conf->two_primaries) { 2102 rcu_read_lock();
2103 tp = rcu_dereference(mdev->tconn->net_conf)->two_primaries;
2104 rcu_read_unlock();
2105 if (tp) {
2106 peer_req->flags |= EE_IN_INTERVAL_TREE;
2098 err = wait_for_and_update_peer_seq(mdev, peer_seq); 2107 err = wait_for_and_update_peer_seq(mdev, peer_seq);
2099 if (err) 2108 if (err)
2100 goto out_interrupted; 2109 goto out_interrupted;