glusterfs icon indicating copy to clipboard operation
glusterfs copied to clipboard

multiple files: unify and improve the check for . and .. entries

Open mykaul opened this issue 2 years ago • 6 comments

in gf_dirent structure

  • Check if the name length is <=2 and only then call strcmp()
  • Reuse across codebase.

Mostly useful in readdir(p) loops.

Updates: #1000 Signed-off-by: Yaniv Kaul [email protected]

mykaul avatar Aug 02 '22 20:08 mykaul

CLANG-FORMAT FAILURE: Before merging the patch, this diff needs to be considered for passing clang-format

index c965eb3b5..ae58d1505 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -1048,10 +1048,7 @@ quota_check_limit_continuation(struct list_head *parents, inode_t *inode,
         goto out;
     }
 
-    list_for_each_entry(entry, parents, next)
-    {
-        parent_count++;
-    }
+    list_for_each_entry(entry, parents, next) { parent_count++; }
 
     LOCK(&par_local->lock);
     {
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 9764d4bb3..80bbdecea 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -6372,7 +6372,8 @@ fuse_priv_dump(xlator_t *this)
     if (!this)
         return -1;
 
-    private = this->private;
+   private
+    = this->private;
 
     if (!private)
         return -1;
@@ -6520,7 +6521,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
     glusterfs_graph_t *graph = NULL;
     struct pollfd pfd = {0};
 
-    private = this->private;
+   private
+    = this->private;
 
     graph = data;
 
@@ -6545,7 +6547,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                 (event == GF_EVENT_CHILD_DOWN)) {
                 pthread_mutex_lock(&private->sync_mutex);
                 {
-                    private->event_recvd = 1;
+                   private
+                    ->event_recvd = 1;
                     pthread_cond_broadcast(&private->sync_cond);
                 }
                 pthread_mutex_unlock(&private->sync_mutex);
@@ -6554,16 +6557,18 @@ notify(xlator_t *this, int32_t event, void *data, ...)
             pthread_mutex_lock(&private->sync_mutex);
             {
                 if (!private->fuse_thread_started) {
-                    private->fuse_thread_started = 1;
+                   private
+                    ->fuse_thread_started = 1;
                     start_thread = _gf_true;
                 }
             }
             pthread_mutex_unlock(&private->sync_mutex);
 
             if (start_thread) {
-                private->fuse_thread = GF_CALLOC(private->reader_thread_count,
-                                                 sizeof(pthread_t),
-                                                 gf_fuse_mt_pthread_t);
+               private
+                ->fuse_thread = GF_CALLOC(private->reader_thread_count,
+                                          sizeof(pthread_t),
+                                          gf_fuse_mt_pthread_t);
                 for (i = 0; i < private->reader_thread_count; i++) {
                     ret = gf_thread_create(&private->fuse_thread[i], NULL,
                                            fuse_thread_proc, this, "fuseproc");
@@ -6597,7 +6602,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                         if (fuse_get_mount_status(this) != 0) {
                             goto auth_fail_unlock;
                         }
-                        private->mount_finished = _gf_true;
+                       private
+                        ->mount_finished = _gf_true;
                     } else if (pfd.revents) {
                         gf_log(this->name, GF_LOG_ERROR,
                                "mount pipe closed without status");

gluster-ant avatar Aug 02 '22 20:08 gluster-ant

/run regression

mykaul avatar Aug 02 '22 20:08 mykaul

1 test(s) failed ./tests/bugs/posix/bug-1651445.t

0 test(s) generated core

9 test(s) needed retry ./tests/000-flaky/basic_afr_split-brain-favorite-child-policy.t ./tests/000-flaky/basic_distribute_rebal-all-nodes-migrate.t ./tests/000-flaky/basic_mount-nfs-auth.t ./tests/000-flaky/bugs_core_multiplex-limit-issue-151.t ./tests/000-flaky/bugs_nfs_bug-1116503.t ./tests/000-flaky/glusterd-restart-shd-mux.t ./tests/basic/afr/self-heald.t ./tests/bugs/glusterd/bug-1696046.t ./tests/bugs/posix/bug-1651445.t

3 flaky test(s) marked as success even though they failed ./tests/000-flaky/basic_mount-nfs-auth.t ./tests/000-flaky/bugs_nfs_bug-1116503.t ./tests/000-flaky/glusterd-restart-shd-mux.t https://build.gluster.org/job/gh_centos7-regression/2669/

gluster-ant avatar Aug 03 '22 00:08 gluster-ant

CLANG-FORMAT FAILURE: Before merging the patch, this diff needs to be considered for passing clang-format

index c965eb3b5..ae58d1505 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -1048,10 +1048,7 @@ quota_check_limit_continuation(struct list_head *parents, inode_t *inode,
         goto out;
     }
 
-    list_for_each_entry(entry, parents, next)
-    {
-        parent_count++;
-    }
+    list_for_each_entry(entry, parents, next) { parent_count++; }
 
     LOCK(&par_local->lock);
     {
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 9764d4bb3..80bbdecea 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -6372,7 +6372,8 @@ fuse_priv_dump(xlator_t *this)
     if (!this)
         return -1;
 
-    private = this->private;
+   private
+    = this->private;
 
     if (!private)
         return -1;
@@ -6520,7 +6521,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
     glusterfs_graph_t *graph = NULL;
     struct pollfd pfd = {0};
 
-    private = this->private;
+   private
+    = this->private;
 
     graph = data;
 
@@ -6545,7 +6547,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                 (event == GF_EVENT_CHILD_DOWN)) {
                 pthread_mutex_lock(&private->sync_mutex);
                 {
-                    private->event_recvd = 1;
+                   private
+                    ->event_recvd = 1;
                     pthread_cond_broadcast(&private->sync_cond);
                 }
                 pthread_mutex_unlock(&private->sync_mutex);
@@ -6554,16 +6557,18 @@ notify(xlator_t *this, int32_t event, void *data, ...)
             pthread_mutex_lock(&private->sync_mutex);
             {
                 if (!private->fuse_thread_started) {
-                    private->fuse_thread_started = 1;
+                   private
+                    ->fuse_thread_started = 1;
                     start_thread = _gf_true;
                 }
             }
             pthread_mutex_unlock(&private->sync_mutex);
 
             if (start_thread) {
-                private->fuse_thread = GF_CALLOC(private->reader_thread_count,
-                                                 sizeof(pthread_t),
-                                                 gf_fuse_mt_pthread_t);
+               private
+                ->fuse_thread = GF_CALLOC(private->reader_thread_count,
+                                          sizeof(pthread_t),
+                                          gf_fuse_mt_pthread_t);
                 for (i = 0; i < private->reader_thread_count; i++) {
                     ret = gf_thread_create(&private->fuse_thread[i], NULL,
                                            fuse_thread_proc, this, "fuseproc");
@@ -6597,7 +6602,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                         if (fuse_get_mount_status(this) != 0) {
                             goto auth_fail_unlock;
                         }
-                        private->mount_finished = _gf_true;
+                       private
+                        ->mount_finished = _gf_true;
                     } else if (pfd.revents) {
                         gf_log(this->name, GF_LOG_ERROR,
                                "mount pipe closed without status");

gluster-ant avatar Aug 03 '22 11:08 gluster-ant

CLANG-FORMAT FAILURE: Before merging the patch, this diff needs to be considered for passing clang-format

index b90c5b5c6..a8684d60d 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -3962,21 +3962,20 @@ glfd_entry_refresh(struct glfs_fd *glfd, int plus)
             {
                 if ((!entry->inode && (!IA_ISDIR(entry->d_stat.ia_type))) ||
                     ((entry->d_stat.ia_ctime == 0) &&
-                     inode_dir_or_parentdir(entry)))
-                    {
-                        /* entry->inode for directories will be
-                         * always set to null to force a lookup
-                         * on the dentry. Hence to not degrade
-                         * readdir performance, we skip lookups
-                         * for directory entries. Also we will have
-                         * proper stat if directory present on
-                         * hashed subvolume.
-                         *
-                         * In addition, if the stat is invalid, force
-                         * lookup to fetch proper stat.
-                         */
-                        gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
-                    }
+                     inode_dir_or_parentdir(entry))) {
+                    /* entry->inode for directories will be
+                     * always set to null to force a lookup
+                     * on the dentry. Hence to not degrade
+                     * readdir performance, we skip lookups
+                     * for directory entries. Also we will have
+                     * proper stat if directory present on
+                     * hashed subvolume.
+                     *
+                     * In addition, if the stat is invalid, force
+                     * lookup to fetch proper stat.
+                     */
+                    gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
+                }
             }
 
             gf_link_inodes_from_dirent(fd->inode, &entries);
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index c965eb3b5..ae58d1505 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -1048,10 +1048,7 @@ quota_check_limit_continuation(struct list_head *parents, inode_t *inode,
         goto out;
     }
 
-    list_for_each_entry(entry, parents, next)
-    {
-        parent_count++;
-    }
+    list_for_each_entry(entry, parents, next) { parent_count++; }
 
     LOCK(&par_local->lock);
     {
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 9764d4bb3..80bbdecea 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -6372,7 +6372,8 @@ fuse_priv_dump(xlator_t *this)
     if (!this)
         return -1;
 
-    private = this->private;
+   private
+    = this->private;
 
     if (!private)
         return -1;
@@ -6520,7 +6521,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
     glusterfs_graph_t *graph = NULL;
     struct pollfd pfd = {0};
 
-    private = this->private;
+   private
+    = this->private;
 
     graph = data;
 
@@ -6545,7 +6547,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                 (event == GF_EVENT_CHILD_DOWN)) {
                 pthread_mutex_lock(&private->sync_mutex);
                 {
-                    private->event_recvd = 1;
+                   private
+                    ->event_recvd = 1;
                     pthread_cond_broadcast(&private->sync_cond);
                 }
                 pthread_mutex_unlock(&private->sync_mutex);
@@ -6554,16 +6557,18 @@ notify(xlator_t *this, int32_t event, void *data, ...)
             pthread_mutex_lock(&private->sync_mutex);
             {
                 if (!private->fuse_thread_started) {
-                    private->fuse_thread_started = 1;
+                   private
+                    ->fuse_thread_started = 1;
                     start_thread = _gf_true;
                 }
             }
             pthread_mutex_unlock(&private->sync_mutex);
 
             if (start_thread) {
-                private->fuse_thread = GF_CALLOC(private->reader_thread_count,
-                                                 sizeof(pthread_t),
-                                                 gf_fuse_mt_pthread_t);
+               private
+                ->fuse_thread = GF_CALLOC(private->reader_thread_count,
+                                          sizeof(pthread_t),
+                                          gf_fuse_mt_pthread_t);
                 for (i = 0; i < private->reader_thread_count; i++) {
                     ret = gf_thread_create(&private->fuse_thread[i], NULL,
                                            fuse_thread_proc, this, "fuseproc");
@@ -6597,7 +6602,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                         if (fuse_get_mount_status(this) != 0) {
                             goto auth_fail_unlock;
                         }
-                        private->mount_finished = _gf_true;
+                       private
+                        ->mount_finished = _gf_true;
                     } else if (pfd.revents) {
                         gf_log(this->name, GF_LOG_ERROR,
                                "mount pipe closed without status");

gluster-ant avatar Aug 03 '22 12:08 gluster-ant

/run regression

mykaul avatar Aug 03 '22 13:08 mykaul

CLANG-FORMAT FAILURE: Before merging the patch, this diff needs to be considered for passing clang-format

index 1bb6f323e..e5730032b 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -3986,21 +3986,20 @@ glfd_entry_refresh(struct glfs_fd *glfd, int plus)
             {
                 if ((!entry->inode && (!IA_ISDIR(entry->d_stat.ia_type))) ||
                     ((entry->d_stat.ia_ctime == 0) &&
-                     inode_dir_or_parentdir(entry)))
-                    {
-                        /* entry->inode for directories will be
-                         * always set to null to force a lookup
-                         * on the dentry. Hence to not degrade
-                         * readdir performance, we skip lookups
-                         * for directory entries. Also we will have
-                         * proper stat if directory present on
-                         * hashed subvolume.
-                         *
-                         * In addition, if the stat is invalid, force
-                         * lookup to fetch proper stat.
-                         */
-                        gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
-                    }
+                     inode_dir_or_parentdir(entry))) {
+                    /* entry->inode for directories will be
+                     * always set to null to force a lookup
+                     * on the dentry. Hence to not degrade
+                     * readdir performance, we skip lookups
+                     * for directory entries. Also we will have
+                     * proper stat if directory present on
+                     * hashed subvolume.
+                     *
+                     * In addition, if the stat is invalid, force
+                     * lookup to fetch proper stat.
+                     */
+                    gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
+                }
             }
 
             gf_link_inodes_from_dirent(fd->inode, &entries);
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index c965eb3b5..ae58d1505 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -1048,10 +1048,7 @@ quota_check_limit_continuation(struct list_head *parents, inode_t *inode,
         goto out;
     }
 
-    list_for_each_entry(entry, parents, next)
-    {
-        parent_count++;
-    }
+    list_for_each_entry(entry, parents, next) { parent_count++; }
 
     LOCK(&par_local->lock);
     {
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 26ac60843..ed08e7d31 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -6346,7 +6346,8 @@ fuse_priv_dump(xlator_t *this)
     if (!this)
         return -1;
 
-    private = this->private;
+   private
+    = this->private;
 
     if (!private)
         return -1;
@@ -6494,7 +6495,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
     glusterfs_graph_t *graph = NULL;
     struct pollfd pfd = {0};
 
-    private = this->private;
+   private
+    = this->private;
 
     graph = data;
 
@@ -6519,7 +6521,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                 (event == GF_EVENT_CHILD_DOWN)) {
                 pthread_mutex_lock(&private->sync_mutex);
                 {
-                    private->event_recvd = 1;
+                   private
+                    ->event_recvd = 1;
                     pthread_cond_broadcast(&private->sync_cond);
                 }
                 pthread_mutex_unlock(&private->sync_mutex);
@@ -6528,16 +6531,18 @@ notify(xlator_t *this, int32_t event, void *data, ...)
             pthread_mutex_lock(&private->sync_mutex);
             {
                 if (!private->fuse_thread_started) {
-                    private->fuse_thread_started = 1;
+                   private
+                    ->fuse_thread_started = 1;
                     start_thread = _gf_true;
                 }
             }
             pthread_mutex_unlock(&private->sync_mutex);
 
             if (start_thread) {
-                private->fuse_thread = GF_CALLOC(private->reader_thread_count,
-                                                 sizeof(pthread_t),
-                                                 gf_fuse_mt_pthread_t);
+               private
+                ->fuse_thread = GF_CALLOC(private->reader_thread_count,
+                                          sizeof(pthread_t),
+                                          gf_fuse_mt_pthread_t);
                 for (i = 0; i < private->reader_thread_count; i++) {
                     ret = gf_thread_create(&private->fuse_thread[i], NULL,
                                            fuse_thread_proc, this, "fuseproc");
@@ -6571,7 +6576,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                         if (fuse_get_mount_status(this) != 0) {
                             goto auth_fail_unlock;
                         }
-                        private->mount_finished = _gf_true;
+                       private
+                        ->mount_finished = _gf_true;
                     } else if (pfd.revents) {
                         gf_log(this->name, GF_LOG_ERROR,
                                "mount pipe closed without status");

gluster-ant avatar Sep 24 '22 19:09 gluster-ant

/recheck smoke

mykaul avatar Sep 24 '22 19:09 mykaul

CLANG-FORMAT FAILURE: Before merging the patch, this diff needs to be considered for passing clang-format

index 1bb6f323e..e5730032b 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -3986,21 +3986,20 @@ glfd_entry_refresh(struct glfs_fd *glfd, int plus)
             {
                 if ((!entry->inode && (!IA_ISDIR(entry->d_stat.ia_type))) ||
                     ((entry->d_stat.ia_ctime == 0) &&
-                     inode_dir_or_parentdir(entry)))
-                    {
-                        /* entry->inode for directories will be
-                         * always set to null to force a lookup
-                         * on the dentry. Hence to not degrade
-                         * readdir performance, we skip lookups
-                         * for directory entries. Also we will have
-                         * proper stat if directory present on
-                         * hashed subvolume.
-                         *
-                         * In addition, if the stat is invalid, force
-                         * lookup to fetch proper stat.
-                         */
-                        gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
-                    }
+                     inode_dir_or_parentdir(entry))) {
+                    /* entry->inode for directories will be
+                     * always set to null to force a lookup
+                     * on the dentry. Hence to not degrade
+                     * readdir performance, we skip lookups
+                     * for directory entries. Also we will have
+                     * proper stat if directory present on
+                     * hashed subvolume.
+                     *
+                     * In addition, if the stat is invalid, force
+                     * lookup to fetch proper stat.
+                     */
+                    gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
+                }
             }
 
             gf_link_inodes_from_dirent(fd->inode, &entries);
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index c965eb3b5..ae58d1505 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -1048,10 +1048,7 @@ quota_check_limit_continuation(struct list_head *parents, inode_t *inode,
         goto out;
     }
 
-    list_for_each_entry(entry, parents, next)
-    {
-        parent_count++;
-    }
+    list_for_each_entry(entry, parents, next) { parent_count++; }
 
     LOCK(&par_local->lock);
     {
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 26ac60843..ed08e7d31 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -6346,7 +6346,8 @@ fuse_priv_dump(xlator_t *this)
     if (!this)
         return -1;
 
-    private = this->private;
+   private
+    = this->private;
 
     if (!private)
         return -1;
@@ -6494,7 +6495,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
     glusterfs_graph_t *graph = NULL;
     struct pollfd pfd = {0};
 
-    private = this->private;
+   private
+    = this->private;
 
     graph = data;
 
@@ -6519,7 +6521,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                 (event == GF_EVENT_CHILD_DOWN)) {
                 pthread_mutex_lock(&private->sync_mutex);
                 {
-                    private->event_recvd = 1;
+                   private
+                    ->event_recvd = 1;
                     pthread_cond_broadcast(&private->sync_cond);
                 }
                 pthread_mutex_unlock(&private->sync_mutex);
@@ -6528,16 +6531,18 @@ notify(xlator_t *this, int32_t event, void *data, ...)
             pthread_mutex_lock(&private->sync_mutex);
             {
                 if (!private->fuse_thread_started) {
-                    private->fuse_thread_started = 1;
+                   private
+                    ->fuse_thread_started = 1;
                     start_thread = _gf_true;
                 }
             }
             pthread_mutex_unlock(&private->sync_mutex);
 
             if (start_thread) {
-                private->fuse_thread = GF_CALLOC(private->reader_thread_count,
-                                                 sizeof(pthread_t),
-                                                 gf_fuse_mt_pthread_t);
+               private
+                ->fuse_thread = GF_CALLOC(private->reader_thread_count,
+                                          sizeof(pthread_t),
+                                          gf_fuse_mt_pthread_t);
                 for (i = 0; i < private->reader_thread_count; i++) {
                     ret = gf_thread_create(&private->fuse_thread[i], NULL,
                                            fuse_thread_proc, this, "fuseproc");
@@ -6571,7 +6576,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                         if (fuse_get_mount_status(this) != 0) {
                             goto auth_fail_unlock;
                         }
-                        private->mount_finished = _gf_true;
+                       private
+                        ->mount_finished = _gf_true;
                     } else if (pfd.revents) {
                         gf_log(this->name, GF_LOG_ERROR,
                                "mount pipe closed without status");

gluster-ant avatar Sep 24 '22 19:09 gluster-ant

/run regression

mykaul avatar Sep 25 '22 06:09 mykaul

1 test(s) failed ./tests/bugs/distribute/bug-882278.t

0 test(s) generated core

2 test(s) needed retry ./tests/000-flaky/glusterd-restart-shd-mux.t ./tests/bugs/distribute/bug-882278.t

1 flaky test(s) marked as success even though they failed ./tests/000-flaky/glusterd-restart-shd-mux.t https://build.gluster.org/job/gh_centos7-regression/2903/

gluster-ant avatar Sep 25 '22 08:09 gluster-ant

/recheck smoke

mykaul avatar Sep 25 '22 09:09 mykaul

CLANG-FORMAT FAILURE: Before merging the patch, this diff needs to be considered for passing clang-format

index 1bb6f323e..e5730032b 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -3986,21 +3986,20 @@ glfd_entry_refresh(struct glfs_fd *glfd, int plus)
             {
                 if ((!entry->inode && (!IA_ISDIR(entry->d_stat.ia_type))) ||
                     ((entry->d_stat.ia_ctime == 0) &&
-                     inode_dir_or_parentdir(entry)))
-                    {
-                        /* entry->inode for directories will be
-                         * always set to null to force a lookup
-                         * on the dentry. Hence to not degrade
-                         * readdir performance, we skip lookups
-                         * for directory entries. Also we will have
-                         * proper stat if directory present on
-                         * hashed subvolume.
-                         *
-                         * In addition, if the stat is invalid, force
-                         * lookup to fetch proper stat.
-                         */
-                        gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
-                    }
+                     inode_dir_or_parentdir(entry))) {
+                    /* entry->inode for directories will be
+                     * always set to null to force a lookup
+                     * on the dentry. Hence to not degrade
+                     * readdir performance, we skip lookups
+                     * for directory entries. Also we will have
+                     * proper stat if directory present on
+                     * hashed subvolume.
+                     *
+                     * In addition, if the stat is invalid, force
+                     * lookup to fetch proper stat.
+                     */
+                    gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
+                }
             }
 
             gf_link_inodes_from_dirent(fd->inode, &entries);
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index c965eb3b5..ae58d1505 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -1048,10 +1048,7 @@ quota_check_limit_continuation(struct list_head *parents, inode_t *inode,
         goto out;
     }
 
-    list_for_each_entry(entry, parents, next)
-    {
-        parent_count++;
-    }
+    list_for_each_entry(entry, parents, next) { parent_count++; }
 
     LOCK(&par_local->lock);
     {
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 26ac60843..ed08e7d31 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -6346,7 +6346,8 @@ fuse_priv_dump(xlator_t *this)
     if (!this)
         return -1;
 
-    private = this->private;
+   private
+    = this->private;
 
     if (!private)
         return -1;
@@ -6494,7 +6495,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
     glusterfs_graph_t *graph = NULL;
     struct pollfd pfd = {0};
 
-    private = this->private;
+   private
+    = this->private;
 
     graph = data;
 
@@ -6519,7 +6521,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                 (event == GF_EVENT_CHILD_DOWN)) {
                 pthread_mutex_lock(&private->sync_mutex);
                 {
-                    private->event_recvd = 1;
+                   private
+                    ->event_recvd = 1;
                     pthread_cond_broadcast(&private->sync_cond);
                 }
                 pthread_mutex_unlock(&private->sync_mutex);
@@ -6528,16 +6531,18 @@ notify(xlator_t *this, int32_t event, void *data, ...)
             pthread_mutex_lock(&private->sync_mutex);
             {
                 if (!private->fuse_thread_started) {
-                    private->fuse_thread_started = 1;
+                   private
+                    ->fuse_thread_started = 1;
                     start_thread = _gf_true;
                 }
             }
             pthread_mutex_unlock(&private->sync_mutex);
 
             if (start_thread) {
-                private->fuse_thread = GF_CALLOC(private->reader_thread_count,
-                                                 sizeof(pthread_t),
-                                                 gf_fuse_mt_pthread_t);
+               private
+                ->fuse_thread = GF_CALLOC(private->reader_thread_count,
+                                          sizeof(pthread_t),
+                                          gf_fuse_mt_pthread_t);
                 for (i = 0; i < private->reader_thread_count; i++) {
                     ret = gf_thread_create(&private->fuse_thread[i], NULL,
                                            fuse_thread_proc, this, "fuseproc");
@@ -6571,7 +6576,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                         if (fuse_get_mount_status(this) != 0) {
                             goto auth_fail_unlock;
                         }
-                        private->mount_finished = _gf_true;
+                       private
+                        ->mount_finished = _gf_true;
                     } else if (pfd.revents) {
                         gf_log(this->name, GF_LOG_ERROR,
                                "mount pipe closed without status");

gluster-ant avatar Sep 25 '22 09:09 gluster-ant

CLANG-FORMAT FAILURE: Before merging the patch, this diff needs to be considered for passing clang-format

index 554df1217..755aa2078 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -3993,21 +3993,20 @@ glfd_entry_refresh(struct glfs_fd *glfd, int plus)
             {
                 if ((!entry->inode && (!IA_ISDIR(entry->d_stat.ia_type))) ||
                     ((entry->d_stat.ia_ctime == 0) &&
-                     inode_dir_or_parentdir(entry)))
-                    {
-                        /* entry->inode for directories will be
-                         * always set to null to force a lookup
-                         * on the dentry. Hence to not degrade
-                         * readdir performance, we skip lookups
-                         * for directory entries. Also we will have
-                         * proper stat if directory present on
-                         * hashed subvolume.
-                         *
-                         * In addition, if the stat is invalid, force
-                         * lookup to fetch proper stat.
-                         */
-                        gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
-                    }
+                     inode_dir_or_parentdir(entry))) {
+                    /* entry->inode for directories will be
+                     * always set to null to force a lookup
+                     * on the dentry. Hence to not degrade
+                     * readdir performance, we skip lookups
+                     * for directory entries. Also we will have
+                     * proper stat if directory present on
+                     * hashed subvolume.
+                     *
+                     * In addition, if the stat is invalid, force
+                     * lookup to fetch proper stat.
+                     */
+                    gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
+                }
             }
 
             gf_link_inodes_from_dirent(fd->inode, &entries);
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index c965eb3b5..ae58d1505 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -1048,10 +1048,7 @@ quota_check_limit_continuation(struct list_head *parents, inode_t *inode,
         goto out;
     }
 
-    list_for_each_entry(entry, parents, next)
-    {
-        parent_count++;
-    }
+    list_for_each_entry(entry, parents, next) { parent_count++; }
 
     LOCK(&par_local->lock);
     {
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index f0ec52ca9..375856c43 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -6343,7 +6343,8 @@ fuse_priv_dump(xlator_t *this)
     if (!this)
         return -1;
 
-    private = this->private;
+   private
+    = this->private;
 
     if (!private)
         return -1;
@@ -6491,7 +6492,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
     glusterfs_graph_t *graph = NULL;
     struct pollfd pfd = {0};
 
-    private = this->private;
+   private
+    = this->private;
 
     graph = data;
 
@@ -6516,7 +6518,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                 (event == GF_EVENT_CHILD_DOWN)) {
                 pthread_mutex_lock(&private->sync_mutex);
                 {
-                    private->event_recvd = 1;
+                   private
+                    ->event_recvd = 1;
                     pthread_cond_broadcast(&private->sync_cond);
                 }
                 pthread_mutex_unlock(&private->sync_mutex);
@@ -6525,16 +6528,18 @@ notify(xlator_t *this, int32_t event, void *data, ...)
             pthread_mutex_lock(&private->sync_mutex);
             {
                 if (!private->fuse_thread_started) {
-                    private->fuse_thread_started = 1;
+                   private
+                    ->fuse_thread_started = 1;
                     start_thread = _gf_true;
                 }
             }
             pthread_mutex_unlock(&private->sync_mutex);
 
             if (start_thread) {
-                private->fuse_thread = GF_CALLOC(private->reader_thread_count,
-                                                 sizeof(pthread_t),
-                                                 gf_fuse_mt_pthread_t);
+               private
+                ->fuse_thread = GF_CALLOC(private->reader_thread_count,
+                                          sizeof(pthread_t),
+                                          gf_fuse_mt_pthread_t);
                 for (i = 0; i < private->reader_thread_count; i++) {
                     ret = gf_thread_create(&private->fuse_thread[i], NULL,
                                            fuse_thread_proc, this, "fuseproc");
@@ -6568,7 +6573,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                         if (fuse_get_mount_status(this) != 0) {
                             goto auth_fail_unlock;
                         }
-                        private->mount_finished = _gf_true;
+                       private
+                        ->mount_finished = _gf_true;
                     } else if (pfd.revents) {
                         gf_log(this->name, GF_LOG_ERROR,
                                "mount pipe closed without status");

gluster-ant avatar Sep 29 '22 19:09 gluster-ant

CLANG-FORMAT FAILURE: Before merging the patch, this diff needs to be considered for passing clang-format

index 3bbe89c27..5679d2349 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -3993,21 +3993,20 @@ glfd_entry_refresh(struct glfs_fd *glfd, int plus)
             {
                 if ((!entry->inode && (!IA_ISDIR(entry->d_stat.ia_type))) ||
                     ((entry->d_stat.ia_ctime == 0) &&
-                     !inode_dir_or_parentdir(entry)))
-                    {
-                        /* entry->inode for directories will be
-                         * always set to null to force a lookup
-                         * on the dentry. Hence to not degrade
-                         * readdir performance, we skip lookups
-                         * for directory entries. Also we will have
-                         * proper stat if directory present on
-                         * hashed subvolume.
-                         *
-                         * In addition, if the stat is invalid, force
-                         * lookup to fetch proper stat.
-                         */
-                        gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
-                    }
+                     !inode_dir_or_parentdir(entry))) {
+                    /* entry->inode for directories will be
+                     * always set to null to force a lookup
+                     * on the dentry. Hence to not degrade
+                     * readdir performance, we skip lookups
+                     * for directory entries. Also we will have
+                     * proper stat if directory present on
+                     * hashed subvolume.
+                     *
+                     * In addition, if the stat is invalid, force
+                     * lookup to fetch proper stat.
+                     */
+                    gf_fill_iatt_for_dirent(entry, fd->inode, subvol);
+                }
             }
 
             gf_link_inodes_from_dirent(fd->inode, &entries);
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index c965eb3b5..ae58d1505 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -1048,10 +1048,7 @@ quota_check_limit_continuation(struct list_head *parents, inode_t *inode,
         goto out;
     }
 
-    list_for_each_entry(entry, parents, next)
-    {
-        parent_count++;
-    }
+    list_for_each_entry(entry, parents, next) { parent_count++; }
 
     LOCK(&par_local->lock);
     {
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 3f215e146..452c54e5b 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -6343,7 +6343,8 @@ fuse_priv_dump(xlator_t *this)
     if (!this)
         return -1;
 
-    private = this->private;
+   private
+    = this->private;
 
     if (!private)
         return -1;
@@ -6491,7 +6492,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
     glusterfs_graph_t *graph = NULL;
     struct pollfd pfd = {0};
 
-    private = this->private;
+   private
+    = this->private;
 
     graph = data;
 
@@ -6516,7 +6518,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                 (event == GF_EVENT_CHILD_DOWN)) {
                 pthread_mutex_lock(&private->sync_mutex);
                 {
-                    private->event_recvd = 1;
+                   private
+                    ->event_recvd = 1;
                     pthread_cond_broadcast(&private->sync_cond);
                 }
                 pthread_mutex_unlock(&private->sync_mutex);
@@ -6525,16 +6528,18 @@ notify(xlator_t *this, int32_t event, void *data, ...)
             pthread_mutex_lock(&private->sync_mutex);
             {
                 if (!private->fuse_thread_started) {
-                    private->fuse_thread_started = 1;
+                   private
+                    ->fuse_thread_started = 1;
                     start_thread = _gf_true;
                 }
             }
             pthread_mutex_unlock(&private->sync_mutex);
 
             if (start_thread) {
-                private->fuse_thread = GF_CALLOC(private->reader_thread_count,
-                                                 sizeof(pthread_t),
-                                                 gf_fuse_mt_pthread_t);
+               private
+                ->fuse_thread = GF_CALLOC(private->reader_thread_count,
+                                          sizeof(pthread_t),
+                                          gf_fuse_mt_pthread_t);
                 for (i = 0; i < private->reader_thread_count; i++) {
                     ret = gf_thread_create(&private->fuse_thread[i], NULL,
                                            fuse_thread_proc, this, "fuseproc");
@@ -6568,7 +6573,8 @@ notify(xlator_t *this, int32_t event, void *data, ...)
                         if (fuse_get_mount_status(this) != 0) {
                             goto auth_fail_unlock;
                         }
-                        private->mount_finished = _gf_true;
+                       private
+                        ->mount_finished = _gf_true;
                     } else if (pfd.revents) {
                         gf_log(this->name, GF_LOG_ERROR,
                                "mount pipe closed without status");

gluster-ant avatar Sep 30 '22 17:09 gluster-ant

/run regression

mykaul avatar Sep 30 '22 19:09 mykaul

1 test(s) failed ./tests/basic/fuse/active-io-graph-switch.t

0 test(s) generated core

9 test(s) needed retry ./tests/000-flaky/basic_distribute_rebal-all-nodes-migrate.t ./tests/000-flaky/bugs_distribute_bug-1117851.t ./tests/000-flaky/bugs_glusterd_bug-857330/normal.t ./tests/000-flaky/bugs_glusterd_bug-857330/xml.t ./tests/00-geo-rep/georep-stderr-hang.t ./tests/basic/afr/sparse-file-self-heal.t ./tests/basic/ctime/ctime-utimesat.t ./tests/basic/ec/ec-new-entry.t ./tests/basic/fuse/active-io-graph-switch.t

3 flaky test(s) marked as success even though they failed ./tests/000-flaky/bugs_distribute_bug-1117851.t ./tests/000-flaky/bugs_glusterd_bug-857330/normal.t ./tests/000-flaky/bugs_glusterd_bug-857330/xml.t https://build.gluster.org/job/gh_centos7-regression/2954/

gluster-ant avatar Sep 30 '22 22:09 gluster-ant

/run regression

xhernandez avatar Oct 05 '22 07:10 xhernandez