This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit a10414f3ad6810481759a616bcd1081852bee1af
Author: v-liuchenxu3 <[email protected]>
AuthorDate: Thu Nov 12 14:56:36 2026 +0800

    fs/inode: update the parent directory times when a node is added
    
    inode_reserve() links a new node into a pseudo file system directory
    but leaves the directory's st_mtime and st_ctime untouched, so after
    mkdir() or the creation of a driver or pseudo file, stat() of the
    containing directory still reports the time it was created.  POSIX
    marks both for update when an entry is added.
    
    Signed-off-by: v-liuchenxu3 <[email protected]>
    Signed-off-by: jingfei <[email protected]>
---
 fs/inode/fs_inodereserve.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/inode/fs_inodereserve.c b/fs/inode/fs_inodereserve.c
index 2824b81e767..1edba8a30e4 100644
--- a/fs/inode/fs_inodereserve.c
+++ b/fs/inode/fs_inodereserve.c
@@ -294,6 +294,16 @@ int inode_reserve(FAR const char *path,
       break;
     }
 
+#ifdef CONFIG_PSEUDOFS_ATTRIBUTES
+  /* The directory that received the new entry was modified */
+
+  if (ret >= 0 && desc.parent != NULL)
+    {
+      clock_gettime(CLOCK_REALTIME, &desc.parent->i_ctime);
+      desc.parent->i_mtime = desc.parent->i_ctime;
+    }
+#endif
+
 errout_with_search:
   inode_search_release(&desc);
   return ret;

Reply via email to