cederom commented on PR #4164:
URL: https://github.com/apache/nuttx-apps/pull/4164#issuecomment-7295400110

   Thank you @jingfei195887 one remark below to consider :_)
   
   **On tmpfs, `i_crefs` is the mount's reference count, not the file's**
   
   For files on a mounted filesystem, `filep->f_inode` is the mountpoint inode 
(`fs_open.c`), so `ASSERT_REFS(..., s->inode_refs + N)` counts every open file 
on `CONFIG_TESTING_FS_REFSTEST_MOUNTDIR`, not the test file's inode. With the 
tmpfs setup the README recommends, this means:
   
   - If any other task opens or closes a file on the same mount while the suite 
runs (syslog to a file, another test, a shell script), the inode assertions 
fail spuriously.
   - refs03 ("unlink with open fds, inode kept alive") can't check per-file 
inode lifetime there. It also makes no refs assertion after `unlink()` at all; 
it only checks that the data is still readable.
   
   Documentation could be updated with that info and so Kconfig help (e.g. "on 
mounted filesystems the inode counters are per mount, so the directory must not 
be used concurrently")? Even better, add an `ASSERT_REFS` after `unlink()` in 
refs03 and recommend a pseudofs directory (`CONFIG_PSEUDOFS_FILE`) as the 
primary setup, since that is the only case where `i_crefs` is really per file.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to