The branch, master has been updated
       via  aa043a5808b vfs_ceph_new: handle errno properly for 'readdir'
       via  a7f4e2bd47c vfs_ceph{_new}: do not set errno upon successful call 
to libcephfs
      from  c0d0767a3ab script/autobuild.py: do some basic testing using 
--without-winbind

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit aa043a5808b73fc272de585c1446372fa3f21d08
Author: Shachar Sharon <ssha...@redhat.com>
Date:   Tue Jul 30 17:36:09 2024 +0300

    vfs_ceph_new: handle errno properly for 'readdir'
    
    Take special care for readdir errno setting: in case of error, update
    errno by libcephfs (and protect from possible over-write by debug
    logging); in the case of successful result or end-of-stream restore
    errno to its previous value before calling the readdir_fn VFS hook.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15686
    
    Signed-off-by: Shachar Sharon <ssha...@redhat.com>
    Reviewed-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Anoop C S <anoo...@samba.org>
    
    Autobuild-User(master): Günther Deschner <g...@samba.org>
    Autobuild-Date(master): Wed Aug  7 14:20:02 UTC 2024 on atb-devel-224

commit a7f4e2bd47c7f4728f3ac8d90af693156a69c557
Author: Shachar Sharon <ssha...@redhat.com>
Date:   Tue Jul 30 09:55:44 2024 +0300

    vfs_ceph{_new}: do not set errno upon successful call to libcephfs
    
    There is code in Samba that expects errno from a previous system call
    to be preserved through a subsequent system call. Thus, avoid setting
    "errno = 0" in status_code() and lstatus_code() upon successful return
    from libcephfs API call.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15686
    
    Signed-off-by: Shachar Sharon <ssha...@redhat.com>
    Reviewed-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Anoop C S <anoo...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_ceph.c     |  2 --
 source3/modules/vfs_ceph_new.c | 15 +++++++--------
 2 files changed, 7 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 1dd136e569b..fd450af16c2 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -66,7 +66,6 @@ static inline int status_code(int ret)
                errno = -ret;
                return -1;
        }
-       errno = 0;
        return ret;
 }
 
@@ -76,7 +75,6 @@ static inline ssize_t lstatus_code(intmax_t ret)
                errno = -((int)ret);
                return -1;
        }
-       errno = 0;
        return (ssize_t)ret;
 }
 
diff --git a/source3/modules/vfs_ceph_new.c b/source3/modules/vfs_ceph_new.c
index 99d4a1fe407..cf7e6b121db 100644
--- a/source3/modules/vfs_ceph_new.c
+++ b/source3/modules/vfs_ceph_new.c
@@ -66,7 +66,6 @@ static int status_code(int ret)
                errno = -ret;
                return -1;
        }
-       errno = 0;
        return ret;
 }
 
@@ -76,7 +75,6 @@ static ssize_t lstatus_code(intmax_t ret)
                errno = -((int)ret);
                return -1;
        }
-       errno = 0;
        return (ssize_t)ret;
 }
 
@@ -1484,19 +1482,20 @@ static struct dirent *vfs_ceph_readdir(struct 
vfs_handle_struct *handle,
 {
        const struct vfs_ceph_fh *dircfh = (const struct vfs_ceph_fh *)dirp;
        struct dirent *result = NULL;
-       int errval = 0;
+       int saved_errno = errno;
 
        DBG_DEBUG("[CEPH] readdir(%p, %p)\n", handle, dirp);
+
        errno = 0;
        result = vfs_ceph_ll_readdir(handle, dircfh);
-       errval = errno;
-       if ((result == NULL) && (errval != 0)) {
-               DBG_DEBUG("[CEPH] readdir(...) = %d\n", errval);
+       if ((result == NULL) && (errno != 0)) {
+               saved_errno = errno;
+               DBG_DEBUG("[CEPH] readdir(...) = %d\n", errno);
        } else {
                DBG_DEBUG("[CEPH] readdir(...) = %p\n", result);
        }
-       /* re-assign errno to avoid possible over-write by DBG_DEBUG */
-       errno = errval;
+
+       errno = saved_errno;
        return result;
 }
 


-- 
Samba Shared Repository

Reply via email to