Conversation
Signed-off-by: hujun5 <hujun5@xiaomi.com>
|
[Experimental Bot, please feedback here] No, this PR does not fully meet the NuttX requirements. While it provides a summary of the change, it lacks crucial details. Here's a breakdown of what's missing:
Example of how to improve the PR description: SummaryThis change replaces the existing reference counting mechanism for file structures ( Impact
TestingI confirm that changes are verified on local setup and works as intended:
Testing logs before change: Testing logs after change: By providing more detail and context, the PR becomes much easier to review and understand, increasing the chances of it being accepted. |
| else if (atomic_read(&filep->f_refs)) | ||
| { | ||
| filep->f_refs++; | ||
| atomic_fetch_add(&filep->f_refs, 1); |
There was a problem hiding this comment.
race condition ... if ISR after read f_refs
There was a problem hiding this comment.
These few lines of code are already in spin_lock_irqsave
There was a problem hiding this comment.
- [CPU1]filep->f_refs == 1
- [CPU1]atomic_read > 0
- [CPU2]atomic_fetch_sub - 1 (fs_putfilep)
- [CPU1]atomic_fetch_add + 1
- [CPU2]file_close
There was a problem hiding this comment.
The issue you mentioned was introduced by me. Here's the fix:
#15163
| int f_oflags; /* Open mode flags */ | ||
| #ifdef CONFIG_FS_REFCOUNT | ||
| int f_refs; /* Reference count */ | ||
| atomic_t f_refs; /* Reference count */ |
There was a problem hiding this comment.
let's create a new patch to remove fl_crefs at line 498
Summary
fs: use atomic_t store f_refs
Impact
fs
Testing
ci