summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorRaghavendra Gowdappa <rgowdapp@redhat.com>2018-10-12 10:31:04 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-10-17 23:36:13 +0000
commit5bc2fd4fc6a8aa65d8d2b2c22ffb6c5b70ef9dac (patch)
tree21a7815cbee00f0245fb068ce586a2a5d505aee7 /api
parent34e8058b7c8e906c889d6d0e155ea63037148eea (diff)
api: fill out attribute information if not valid
translators like readdir-ahead selectively retain entry information of iatt (gfid and type) when rest of the iatt is invalidated (for write invalidating ia_size, (m)(c)times etc). Fuse-bridge uses this information and sends only entry information in readdirplus response. However such option doesn't exist in gfapi. This patch modifies gfapi to populate the stat by forcing an extra lookup. Thanks to Shyamsundar Ranganathan <srangana@redhat.com> and Prashanth Pai <ppai@redhat.com> for tests. Change-Id: Ieb5f8fc76359c327627b7d8420aaf20810e53000 Fixes: bz#1630804 Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com> Signed-off-by: Soumya Koduri <skoduri@redhat.com> (cherry picked from commit 6257276d9de3f15643f159b2ec627a67c84fc23d)
Diffstat (limited to 'api')
-rw-r--r--api/src/glfs-fops.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
index 9f61e41629c..cafbeb7f515 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -2869,12 +2869,20 @@ glfd_entry_refresh(struct glfs_fd *glfd, int plus)
if (plus) {
list_for_each_entry(entry, &entries.list, list)
{
- if (!entry->inode && !IA_ISDIR(entry->d_stat.ia_type)) {
+ if ((!entry->inode && (!IA_ISDIR(entry->d_stat.ia_type))) ||
+ ((entry->d_stat.ia_ctime == 0) &&
+ strcmp(entry->d_name, ".") &&
+ strcmp(entry->d_name, ".."))) {
/* entry->inode for directories will be
* always set to null to force a lookup
- * on the dentry. Also we will have
+ * 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);
}