Commit Graph

17 Commits

Author SHA1 Message Date
Michal Lenc 531dbaf561 fs_close: provide inotify call for close
Close operation on file should lead to IN_CLOSE_WRITE or
IN_CLOSE_NOWRITE notifications. This commits adds the notification
support. Notifying on close is a little bit trickier as a lower layer
may not have the full file path after successful close and inode release.
Calling notification before close is not a solution since close might
not end successfully.

The solution is to obtain and buffer the path before calling close
and then pass the buffered path to the notify_close. This required the
change in notify_close function arguments: filep is no longer
required, path and oflags are passed instead.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-10-08 08:14:19 +08:00
chenrun1 96206cbf9d fs/xxfs:Replace kmm with fs heap
Summary:
  1.Add configuration to allocate memory from the specified section
  2.Replace all memory operations (kmm_) in the vfs with
    fs_heap_. When FS_HEAPSIZE > 0, memory is requested for the file system by specifying a configured heap location. By default (i.e. FS_HEAPSIZE=0) fs_heap_ is equivalent to kmm_

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-30 16:30:56 +08:00
chenrun1 03f215b374 nuttx/atomic.h:fix Fixed the pragma of ATOMIC_VAR_INIT in clang
Error: vfs/fs_epoll.c:126:3: error: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Werror,-Wdeprecated-pragma]
  ATOMIC_VAR_INIT(1),     /* i_crefs */
  ^
/Applications/Xcode_15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/stdatomic.h:54:41: note: macro marked 'deprecated' here
                                        ^
1 error generated.
make[1]: *** [fs_epoll.o] Error 1
Error: socket/socket.c:78:3: error: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Werror,-Wdeprecated-pragma]
  ATOMIC_VAR_INIT(1),     /* i_crefs */

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
chenrun1 4cec713dbf fs_inode:Change the type of i_crefs to atomic_int
Summary:
  1.Modified the i_crefs from int16_t to atomic_int
  2.Modified the i_crefs add, delete, read, and initialize interfaces to atomic operations
The purpose of this change is to avoid deadlock in cross-core scenarios, where A Core blocks B Core’s request for a write operation to A Core when A Core requests a read operation to B Core.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
Shoukui Zhang 43223124ec vfs/file: add reference counting to prevent accidental close during reading writing...
Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
2024-09-17 12:01:53 +08:00
guohao15 76a1a5b2c4 inotify:fix memory alloc/free not match
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:25:30 +08:00
guohao15 a69d3d78fe inotify: add filter of notify options to reduce overload of system
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 8731368e45 inotify: group g_inotify_xxx global variables into one struct
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 57250a9602 inotify: use nx_stat instead of stat
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 bf919afcbd notify:change tempbuffer structure
In rpmsgfs case the old tempbuffer will case deadlock

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 3df638971f notify:do not noitfy when in signal context
Some signal handler may opreate files, that will cause deadlock
when the thread holding file system lock

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 048415f407 notify: change inode type check out of the lock
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 25e2d7bef2 inotify:add function filter type of inode
only mountpt/driver/pseudodir need inotify

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 68a64c1a4c inotifiy:reduce stack memory used in inotify
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 74963deceb inotify:change log level in case of flood the screen
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 a40a8e17fb fsnotify:fix bug when path="/"
fix crash when queue event to root dir's parent

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 86e00896d3 fs:notify add support for inotify
support API: open close read write unlink mkdir rename fchstat rmdir symlink

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00