]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_ceph_new: log open-flags upon release-fh
authorShachar Sharon <ssharon@redhat.com>
Sun, 6 Oct 2024 10:26:48 +0000 (13:26 +0300)
committerJule Anger <janger@samba.org>
Mon, 17 Feb 2025 16:09:09 +0000 (16:09 +0000)
Store the set of open O_XXX flags as part of the referenced file-handle
to allow more verbose debug-logging info upon close. This should ease
the developer's logging analysis where same inode is opened multiple
times but with different flags set.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15703

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 341ff48a5a787ed358a28037b5ec751b7b530e20)

source3/modules/vfs_ceph_new.c

index df00d529bfe4696c999c903511107b3502e53cfc..6ec1bd815b2c40a2b24067afeecafc01d97eb34c 100644 (file)
@@ -673,6 +673,7 @@ struct vfs_ceph_fh {
        struct Fh *fh;
        struct dirent *de;
        int fd;
+       int o_flags;
 };
 
 static int cephmount_next_fd(struct cephmount_cached *cme)
@@ -710,7 +711,8 @@ static int vfs_ceph_release_fh(struct vfs_ceph_fh *cfh)
        int ret = 0;
 
        if (cfh->fh != NULL) {
-               DBG_DEBUG("[ceph] ceph_ll_close: fd=%d\n", cfh->fd);
+               DBG_DEBUG("[ceph] ceph_ll_close: fd=%d o_flags=0x%x\n",
+                         cfh->fd, cfh->o_flags);
                ret = cfh->config->ceph_ll_close_fn(cfh->cme->mount, cfh->fh);
                cfh->fh = NULL;
        }
@@ -1075,6 +1077,7 @@ static int vfs_ceph_ll_create(const struct vfs_handle_struct *handle,
        cfh->iref.ino = (long)stx.stx_ino;
        cfh->iref.owner = true;
        cfh->fh = fh;
+       cfh->o_flags = oflags;
        vfs_ceph_assign_fh_fd(cfh);
 
        return 0;
@@ -1210,6 +1213,7 @@ static int vfs_ceph_ll_open(const struct vfs_handle_struct *handle,
                                      cfh->uperm);
        if (ret == 0) {
                cfh->fh = fh;
+               cfh->o_flags = flags;
                vfs_ceph_assign_fh_fd(cfh);
        }
        return ret;
@@ -2171,6 +2175,7 @@ static int vfs_ceph_openat(struct vfs_handle_struct *handle,
                         * Cephfs' Inode* from the above lookup so there is no
                         * need to go via expensive ceph_ll_open for Fh*.
                         */
+                       cfh->o_flags = flags;
                        vfs_ceph_assign_fh_fd(cfh);
                        result = cfh->fd;
                        goto out;