casaroli opened a new pull request, #21218: URL: https://github.com/apache/nuttx/pull/21218
## Summary **fs/v9fs: Do not report a missing file as an error.** Each failed walk of the 9P client gave an error message, also when the path does not exist: ``` v9fs_vfs_stat: ERROR: Can't find the fid of the relpath: -2 v9fs_vfs_open: ERROR: Can't find the fid of relpath: -2 v9fs_vfs_opendir: ERROR: Can't find the fid of the relpath: -2 ``` A missing file is a normal result of `stat()`, `lstat()`, `open()` and `opendir()`: a search of `PATH`, a test for a configuration file. With `CONFIG_DEBUG_FS_ERROR` and a file system on 9P, each such call gave one error line, so the RAMLOG filled with these lines and the real messages left it. The 17 walk errors of `v9fs.c` now go through `v9fs_walkerr()`, which does not report `-ENOENT` and `-ENOTDIR`. All other errors of a walk (`EIO`, `ENOMEM`, `EACCES`, `ENAMETOOLONG`, a transport error) give the message as before. The other messages of `v9fs.c` do not change. ## Impact - Only the log output of `CONFIG_DEBUG_FS_ERROR` changes; the return values do not. - The same in flat, protected and kernel builds; no arch code. `v9fs_walkerr()` is not a variadic macro, so it does not need `CONFIG_CPP_HAVE_VARARGS`. - Documentation: no page describes these messages. ## Testing Test program `v9fsquiet.c` (it counts the `v9fs_vfs_` lines in the RAMLOG, `/dev/kmsg`, between two marker lines): `missing` does `stat()`, `lstat()`, `open()` and `opendir()` of 50 missing paths on the 9P volume `/system` (200 calls, all `ENOENT`); `notdir` does 10 `stat()` of `<file>/x` (QEMU's server gives `ENOENT` here, not `ENOTDIR`). Base 23f5a4f06df (master 7505b874722 does not build for arm64; fixed by #21210); the branch has no other change in `fs/v9fs` since then. qemu-armv8a:knsh (QEMU with HVF; `/system` on virtio 9P, `security_model=none`) with `DEBUG_FEATURES`, `DEBUG_ERROR`, `DEBUG_FS`, `DEBUG_FS_ERROR`, `RAMLOG`, `RAMLOG_SYSLOG` (`SYSLOG_DEVPATH="/dev/kmsg"`, `RAMLOG_BUFSIZE=16384`), `SYSLOG_MAX_CHANNELS=2`, `SYSLOG_DEFAULT`: | | master | this PR | |---|---|---| | `missing`: log lines for 200 calls | 200 (FAIL) | 0 (PASS) | | `notdir`: log lines for 10 calls | 10 (FAIL) | 0 (PASS) | | ostest (knsh) | 0 | 0 | | ostest (qemu-armv8a:nsh, same options) | 0 | 0 | On master the 210 lines are 110 `v9fs_vfs_stat` (`lstat()` also goes to it without `CONFIG_FS_LINKS`), 50 `v9fs_vfs_open` and 50 `v9fs_vfs_opendir`, each with `-2`. A real walk error (not `ENOENT` or `ENOTDIR`) still gives the message; I could not make QEMU's server return one in a test (a name of 300 characters stops in the VFS with `ENAMETOOLONG` before the 9P request; a directory of mode 0 gives `ENOENT` or no error). Build check, each OK and `v9fs.c` compiled without warnings: qemu-armv8a:knsh + `FS_V9FS` + `V9FS_VIRTIO_9P` (kernel, arm64), also with the debug options above (the test build); qemu-armv8a:netnsh (flat, arm64, has `FS_V9FS`), also + `DEBUG_FS_ERROR`; mps2-an500:knsh + `FS_V9FS` (protected, Cortex-M7), also + `DEBUG_FS_ERROR`; rv-virt:knsh64 + `FS_V9FS` + `DEBUG_FS_ERROR` (kernel, rv64); sim:nsh + `FS_V9FS` + `DEBUG_FS_ERROR` (host clang). `tools/checkpatch.sh -c -u -m -g` passes. -- 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]
