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


The following commit(s) were added to refs/heads/master by this push:
     new 469d7d30367 fs/rpmsgfs: report fsync errors from the server
469d7d30367 is described below

commit 469d7d3036747de9461fef434d07049e33272455
Author: liaoao <[email protected]>
AuthorDate: Wed Nov 11 17:19:41 2026 +0800

    fs/rpmsgfs: report fsync errors from the server
    
    rpmsgfs_sync() ignores the result of rpmsgfs_client_sync(), which in
    turn drops the result of rpmsgfs_send_recv().  fsync() on an rpmsgfs
    file therefore reports success even when the request fails or the
    server's fsync fails.  Return the result through both functions.
    
    Signed-off-by: liaoao <[email protected]>
    Signed-off-by: jingfei <[email protected]>
---
 fs/rpmsgfs/rpmsgfs.c        | 4 ++--
 fs/rpmsgfs/rpmsgfs.h        | 2 +-
 fs/rpmsgfs/rpmsgfs_client.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/rpmsgfs/rpmsgfs.c b/fs/rpmsgfs/rpmsgfs.c
index a9de7ed3316..4e0bb56e68c 100644
--- a/fs/rpmsgfs/rpmsgfs.c
+++ b/fs/rpmsgfs/rpmsgfs.c
@@ -681,10 +681,10 @@ static int rpmsgfs_sync(FAR struct file *filep)
       return ret;
     }
 
-  rpmsgfs_client_sync(fs->handle, hf->fd);
+  ret = rpmsgfs_client_sync(fs->handle, hf->fd);
 
   nxmutex_unlock(&fs->fs_lock);
-  return OK;
+  return ret;
 }
 
 /****************************************************************************
diff --git a/fs/rpmsgfs/rpmsgfs.h b/fs/rpmsgfs/rpmsgfs.h
index 2a73bafe831..3539ce61dd2 100644
--- a/fs/rpmsgfs/rpmsgfs.h
+++ b/fs/rpmsgfs/rpmsgfs.h
@@ -240,7 +240,7 @@ off_t     rpmsgfs_client_lseek(FAR void *handle, int fd,
                                off_t offset, int whence);
 int       rpmsgfs_client_ioctl(FAR void *handle, int fd,
                                int request, unsigned long arg);
-void      rpmsgfs_client_sync(FAR void *handle, int fd);
+int       rpmsgfs_client_sync(FAR void *handle, int fd);
 int       rpmsgfs_client_dup(FAR void *handle, int fd);
 int       rpmsgfs_client_fstat(FAR void *handle, int fd,
                                FAR struct stat *buf);
diff --git a/fs/rpmsgfs/rpmsgfs_client.c b/fs/rpmsgfs/rpmsgfs_client.c
index 97425a6c23c..204de1ce572 100644
--- a/fs/rpmsgfs/rpmsgfs_client.c
+++ b/fs/rpmsgfs/rpmsgfs_client.c
@@ -693,14 +693,14 @@ int rpmsgfs_client_ioctl(FAR void *handle, int fd,
   return ret;
 }
 
-void rpmsgfs_client_sync(FAR void *handle, int fd)
+int rpmsgfs_client_sync(FAR void *handle, int fd)
 {
   struct rpmsgfs_sync_s msg =
   {
     .fd = fd,
   };
 
-  rpmsgfs_send_recv(handle, RPMSGFS_SYNC, true,
+  return rpmsgfs_send_recv(handle, RPMSGFS_SYNC, true,
           (struct rpmsgfs_header_s *)&msg, sizeof(msg), NULL);
 }
 

Reply via email to