DFC-OpenSource / ox-ctrl

OX: Computational Storage SSD Controller

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Double calling of app_ch_dec_thread

luochen01 opened this issue · comments

In the latest v2.6 version, I saw the channel counter is decremented twice in gl-prov. The first call is at [1] when gl-prov allocates the provision list. The second call is at [2] when the provision list is freed (after writes have been executed). This is clearly a bug and the channel counter should only be decremented once.

The question is when should the counter be decremented? Perhaps it should be decremented at [2] after writes have been executed.

[1]

app_ch_dec_thread(prov_ppa->ch[ch_id]);

[2]
app_ch_dec_thread(ppas->ch[i]);

Dear Chen,

Thank you for opening the issue. I have analyzed it this is what I found:

We have 2 arrays:
(i) prov_ppa->ch[ch_id] : Stores pointers to channels of provisioned PPAs. If a position is NULL, the related channel (with the same index) is not provisioned.
(ii) dec_ch[ch_id] : Stores pointers to channels that NOT provisioned. If a position is NULL, the related channel is provisioned.

Note: 'dec_ch' was defined because we need the pointer to the channels to be decreased at line 233.
Note: We start the function by increasing all active channels, and decrease the ones that were not provisioned at the end.

Suggestion: We may change the function to increase only provisioned channels. The increase function replaces the 'dec_ch' array at the line:

dec_ch[ch_id] = NULL;

Any comments?

Hi Ivan,

To summarize the analysis, the non-provisioned channels can be decremented twice, one after provisioning and one after writing is completed.

To address this problem, after we decrement the non-provisioned channels, shouldn't we unset the corresponding channel from prov_ppa->ch to NULL?