@@ -10,7 +10,7 @@ struct netns_smc {
/* per cpu counters for SMC */
struct smc_stats __percpu *smc_stats;
/* protect fback_rsn */
- struct mutex mutex_fback_rsn;
+ spinlock_t mutex_fback_rsn;
struct smc_stats_rsn *fback_rsn;
bool limit_smc_hs; /* constraint on handshake */
@@ -769,7 +769,7 @@ static void smc_stat_fallback(struct smc_sock *smc)
{
struct net *net = sock_net(&smc->sk);
- mutex_lock(&net->smc.mutex_fback_rsn);
+ spin_lock_bh(&net->smc.mutex_fback_rsn);
if (smc->listen_smc) {
smc_stat_inc_fback_rsn_cnt(smc, net->smc.fback_rsn->srv);
net->smc.fback_rsn->srv_fback_cnt++;
@@ -777,7 +777,7 @@ static void smc_stat_fallback(struct smc_sock *smc)
smc_stat_inc_fback_rsn_cnt(smc, net->smc.fback_rsn->clnt);
net->smc.fback_rsn->clnt_fback_cnt++;
}
- mutex_unlock(&net->smc.mutex_fback_rsn);
+ spin_unlock_bh(&net->smc.mutex_fback_rsn);
}
/* must be called under rcu read lock */
@@ -26,7 +26,7 @@ int smc_stats_init(struct net *net)
net->smc.smc_stats = alloc_percpu(struct smc_stats);
if (!net->smc.smc_stats)
goto err_stats;
- mutex_init(&net->smc.mutex_fback_rsn);
+ spin_lock_init(&net->smc.mutex_fback_rsn);
return 0;
err_stats:
@@ -387,7 +387,7 @@ int smc_nl_get_fback_stats(struct sk_buff *skb, struct netlink_callback *cb)
int snum = cb_ctx->pos[0];
bool is_srv = true;
- mutex_lock(&net->smc.mutex_fback_rsn);
+ spin_lock_bh(&net->smc.mutex_fback_rsn);
for (k = 0; k < SMC_MAX_FBACK_RSN_CNT; k++) {
if (k < snum)
continue;
@@ -406,7 +406,7 @@ int smc_nl_get_fback_stats(struct sk_buff *skb, struct netlink_callback *cb)
if (rc_clnt == -ENODATA && rc_srv == -ENODATA)
break;
}
- mutex_unlock(&net->smc.mutex_fback_rsn);
+ spin_unlock_bh(&net->smc.mutex_fback_rsn);
cb_ctx->pos[1] = skip_serv;
cb_ctx->pos[0] = k;
return skb->len;