Copilot commented on code in PR #21825:
URL: https://github.com/apache/nuttx/pull/21825#discussion_r4561210425


##########
fs/vfs/fs_dir.c:
##########
@@ -188,6 +193,8 @@ static off_t seek_pseudodir(FAR struct file *filep, off_t 
offset)
    * "rewind" to the root dir.
    */
 
+  inode_lock();
+
   if (offset < filep->f_pos)
     {
       pos  = 0;

Review Comment:
   In `seek_pseudodir()`, `inode_lock()` is now taken before comparing `offset` 
vs `filep->f_pos`, which increases the time the inode-tree lock is held 
(including work that doesn’t require inode-tree protection). Consider narrowing 
lock scope: compute the rewind/forward decision first, then take `inode_lock()` 
only around reading `fd_root->i_child` / walking `i_peer` / updating 
`pdir->next`, and ensure all exit paths unlock.



-- 
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