diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-04-19 17:10:19 +0200 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 16:48:59 +0100 |
commit | 44ed167da74825bfb7950d45a4f83bce3e84921c (patch) | |
tree | 5d62fe65143717ff11af26138726540b35953c89 /drivers/block/drbd/drbd_state.c | |
parent | drbd: Allow online change of replication protocol only with agreed_pv >= 100 (diff) | |
download | linux-44ed167da74825bfb7950d45a4f83bce3e84921c.tar.xz linux-44ed167da74825bfb7950d45a4f83bce3e84921c.zip |
drbd: rcu_read_lock() and rcu_dereference() for tconn->net_conf
Removing the get_net_conf()/put_net_conf() calls
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_state.c')
-rw-r--r-- | drivers/block/drbd/drbd_state.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c index 52ebd9a9b032..f20a4a3807eb 100644 --- a/drivers/block/drbd/drbd_state.c +++ b/drivers/block/drbd/drbd_state.c @@ -482,6 +482,7 @@ is_valid_state(struct drbd_conf *mdev, union drbd_state ns) enum drbd_fencing_p fp; enum drbd_state_rv rv = SS_SUCCESS; + struct net_conf *nc; fp = FP_DONT_CARE; if (get_ldev(mdev)) { @@ -489,14 +490,15 @@ is_valid_state(struct drbd_conf *mdev, union drbd_state ns) put_ldev(mdev); } - if (get_net_conf(mdev->tconn)) { - if (!mdev->tconn->net_conf->two_primaries && ns.role == R_PRIMARY) { + rcu_read_lock(); + nc = rcu_dereference(mdev->tconn->net_conf); + if (nc) { + if (!nc->two_primaries && ns.role == R_PRIMARY) { if (ns.peer == R_PRIMARY) rv = SS_TWO_PRIMARIES; else if (conn_highest_peer(mdev->tconn) == R_PRIMARY) rv = SS_O_VOL_PEER_PRI; - } - put_net_conf(mdev->tconn); + } } if (rv <= 0) @@ -531,7 +533,7 @@ is_valid_state(struct drbd_conf *mdev, union drbd_state ns) rv = SS_CONNECTED_OUTDATES; else if ((ns.conn == C_VERIFY_S || ns.conn == C_VERIFY_T) && - (mdev->tconn->net_conf->verify_alg[0] == 0)) + (nc->verify_alg[0] == 0)) rv = SS_NO_VERIFY_ALG; else if ((ns.conn == C_VERIFY_S || ns.conn == C_VERIFY_T) && @@ -541,6 +543,8 @@ is_valid_state(struct drbd_conf *mdev, union drbd_state ns) else if (ns.conn >= C_CONNECTED && ns.pdsk == D_UNKNOWN) rv = SS_CONNECTED_OUTDATES; + rcu_read_unlock(); + return rv; } |