d1681e
From 4ef66d687918c87393b26b8e72d5eb2f5f9e30f0 Mon Sep 17 00:00:00 2001
d1681e
From: Sanoj Unnikrishnan <sunnikri@redhat.com>
d1681e
Date: Mon, 16 Jul 2018 11:16:24 +0530
d1681e
Subject: [PATCH 318/325] Quota: Fix crawling of files
d1681e
d1681e
Problem: Running "find ." does not crawl files. It goes over the
d1681e
directories and lists all dentries with getdents system call.
d1681e
Hence the files are not looked up.
d1681e
d1681e
Solution:
d1681e
explicitly triggerr stat on files with find . -exec stat {} \;
d1681e
since crawl can take slightly longer, updating timeout in test case
d1681e
d1681e
Backport of,
d1681e
> Change-Id: If3c1fba2ed8e300c9cc08c1b5c1ba93cb8e4d6b6
d1681e
> bug: 1533000
d1681e
> patch: https://review.gluster.org/#/c/20057/
d1681e
> Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com>
d1681e
d1681e
BUG: 1581231
d1681e
Change-Id: I39768e22a7139f77de1740432b9de4a5c870b359
d1681e
Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com>
d1681e
Reviewed-on: https://code.engineering.redhat.com/gerrit/144022
d1681e
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d1681e
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
d1681e
---
d1681e
 tests/bugs/quota/bug-1293601.t             | 2 +-
d1681e
 xlators/mgmt/glusterd/src/glusterd-quota.c | 4 +++-
d1681e
 2 files changed, 4 insertions(+), 2 deletions(-)
d1681e
d1681e
diff --git a/tests/bugs/quota/bug-1293601.t b/tests/bugs/quota/bug-1293601.t
d1681e
index 52b03bc..def4ef9 100644
d1681e
--- a/tests/bugs/quota/bug-1293601.t
d1681e
+++ b/tests/bugs/quota/bug-1293601.t
d1681e
@@ -27,6 +27,6 @@ EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "1.0MB" quotausage "/"
d1681e
 TEST $CLI volume quota $V0 disable
d1681e
 TEST $CLI volume quota $V0 enable
d1681e
 
d1681e
-EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "1.0MB" quotausage "/"
d1681e
+EXPECT_WITHIN 40 "1.0MB" quotausage "/"
d1681e
 
d1681e
 cleanup;
d1681e
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
d1681e
index 1c3a801..6d3918b 100644
d1681e
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
d1681e
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
d1681e
@@ -341,7 +341,9 @@ _glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv,
d1681e
 
d1681e
                 if (type == GF_QUOTA_OPTION_TYPE_ENABLE ||
d1681e
                     type == GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS)
d1681e
-                        runner_add_args (&runner, "/usr/bin/find", ".", NULL);
d1681e
+                        runner_add_args (&runner, "/usr/bin/find", ".",
d1681e
+                                         "-exec", "/usr/bin/stat",
d1681e
+                                         "{}", "\\", ";", NULL);
d1681e
 
d1681e
                 else if (type == GF_QUOTA_OPTION_TYPE_DISABLE) {
d1681e
 
d1681e
-- 
d1681e
1.8.3.1
d1681e