summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorRaghavendra Gowdappa <rgowdapp@redhat.com>2018-10-12 10:31:04 +0530
committerShyamsundarR <srangana@redhat.com>2018-10-17 09:44:30 -0400
commit6257276d9de3f15643f159b2ec627a67c84fc23d (patch)
tree7b3b2fa7c05ddc62f29f785adcfef08f205f8692 /api
parent24dbcfb6ebaab021e2db4f63bd66f3b06192bc89 (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>
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 f7688f3..54eb260 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -3300,12 +3300,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);
}