|
|
12a457 |
From 51c40fa1d1cfb6b63b513ac0d718cbb8d8da5774 Mon Sep 17 00:00:00 2001
|
|
|
12a457 |
From: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
12a457 |
Date: Tue, 26 Apr 2016 16:59:30 +0530
|
|
|
12a457 |
Subject: [PATCH 099/104] gfapi: fill iatt in readdirp_cbk if entry->inode is null
|
|
|
12a457 |
|
|
|
12a457 |
Back port of > http://review.gluster.org/#/c/14079/
|
|
|
12a457 |
|
|
|
12a457 |
If any of dirent have inode as null in readdirp_cbk, which indicates
|
|
|
12a457 |
that the stat information is not valid. So for such entries, we send
|
|
|
12a457 |
explicit lookup to fill the stat information.
|
|
|
12a457 |
|
|
|
12a457 |
>Change-Id: I0604bce34583db0bb04b5aae8933766201c6ddad
|
|
|
12a457 |
>BUG: 1330567
|
|
|
12a457 |
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
12a457 |
|
|
|
12a457 |
Change-Id: I5ac08e6bd7ab26cd9f2996ddde1a757d8533413e
|
|
|
12a457 |
BUG: 1322247
|
|
|
12a457 |
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
12a457 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/73265
|
|
|
12a457 |
Reviewed-by: Poornima Gurusiddaiah <pgurusid@redhat.com>
|
|
|
12a457 |
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
12a457 |
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
12a457 |
---
|
|
|
12a457 |
api/src/glfs-fops.c | 11 +++++++++++
|
|
|
12a457 |
libglusterfs/src/gf-dirent.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
|
|
12a457 |
libglusterfs/src/gf-dirent.h | 3 +++
|
|
|
12a457 |
3 files changed, 56 insertions(+), 0 deletions(-)
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
|
|
|
12a457 |
index 98be987..7a3dffa 100644
|
|
|
12a457 |
--- a/api/src/glfs-fops.c
|
|
|
12a457 |
+++ b/api/src/glfs-fops.c
|
|
|
12a457 |
@@ -2446,6 +2446,17 @@ glfd_entry_refresh (struct glfs_fd *glfd, int plus)
|
|
|
12a457 |
list_for_each_entry (entry, &entries.list, list) {
|
|
|
12a457 |
if (entry->inode)
|
|
|
12a457 |
inode_set_need_lookup (entry->inode, THIS);
|
|
|
12a457 |
+ else if (!IA_ISDIR (entry->d_stat.ia_type)) {
|
|
|
12a457 |
+ /* entry->inode for directories will be
|
|
|
12a457 |
+ * always set to null to force a lookup
|
|
|
12a457 |
+ * on the dentry. Also we will have
|
|
|
12a457 |
+ * proper stat if directory present on
|
|
|
12a457 |
+ * hashed subvolume.
|
|
|
12a457 |
+ */
|
|
|
12a457 |
+ gf_fill_iatt_for_dirent (entry,
|
|
|
12a457 |
+ fd->inode,
|
|
|
12a457 |
+ subvol);
|
|
|
12a457 |
+ }
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
gf_link_inodes_from_dirent (THIS, fd->inode, &entries);
|
|
|
12a457 |
diff --git a/libglusterfs/src/gf-dirent.c b/libglusterfs/src/gf-dirent.c
|
|
|
12a457 |
index 4c077e9..e3c7bf6 100644
|
|
|
12a457 |
--- a/libglusterfs/src/gf-dirent.c
|
|
|
12a457 |
+++ b/libglusterfs/src/gf-dirent.c
|
|
|
12a457 |
@@ -20,6 +20,7 @@
|
|
|
12a457 |
#include <stdint.h>
|
|
|
12a457 |
#include "compat.h"
|
|
|
12a457 |
#include "xlator.h"
|
|
|
12a457 |
+#include "syncop.h"
|
|
|
12a457 |
|
|
|
12a457 |
#define ONE 1ULL
|
|
|
12a457 |
#define PRESENT_D_OFF_BITS 63
|
|
|
12a457 |
@@ -262,3 +263,44 @@ gf_link_inodes_from_dirent (xlator_t *this, inode_t *parent,
|
|
|
12a457 |
|
|
|
12a457 |
return 0;
|
|
|
12a457 |
}
|
|
|
12a457 |
+
|
|
|
12a457 |
+int
|
|
|
12a457 |
+gf_fill_iatt_for_dirent (gf_dirent_t *entry, inode_t *parent, xlator_t *subvol)
|
|
|
12a457 |
+{
|
|
|
12a457 |
+ loc_t loc = {0, };
|
|
|
12a457 |
+ int ret = -1;
|
|
|
12a457 |
+ char *path = NULL;
|
|
|
12a457 |
+ struct iatt iatt = {0,};
|
|
|
12a457 |
+
|
|
|
12a457 |
+ loc.inode = inode_grep (parent->table, parent, entry->d_name);
|
|
|
12a457 |
+ if (!loc.inode) {
|
|
|
12a457 |
+ loc.inode = inode_new (parent->table);
|
|
|
12a457 |
+ gf_uuid_copy (loc.inode->gfid, entry->d_stat.ia_gfid);
|
|
|
12a457 |
+ }
|
|
|
12a457 |
+
|
|
|
12a457 |
+ gf_uuid_copy (loc.pargfid, parent->gfid);
|
|
|
12a457 |
+ loc.name = entry->d_name;
|
|
|
12a457 |
+ loc.parent = inode_ref (parent);
|
|
|
12a457 |
+ ret = inode_path (loc.inode, entry->d_name, &path);
|
|
|
12a457 |
+ loc.path = path;
|
|
|
12a457 |
+ if (ret < 0)
|
|
|
12a457 |
+ goto out;
|
|
|
12a457 |
+
|
|
|
12a457 |
+ ret = syncop_lookup (subvol, &loc, &iatt, NULL, NULL, NULL);
|
|
|
12a457 |
+ if (ret)
|
|
|
12a457 |
+ goto out;
|
|
|
12a457 |
+
|
|
|
12a457 |
+ entry->d_stat = iatt;
|
|
|
12a457 |
+ entry->inode = inode_ref (loc.inode);
|
|
|
12a457 |
+ /* We don't need to link inode here, because as part of readdirp_cbk
|
|
|
12a457 |
+ * we will link all dirents.
|
|
|
12a457 |
+ *
|
|
|
12a457 |
+ * Since we did a proper lookup, we don't need to set need_lookup
|
|
|
12a457 |
+ * flag.
|
|
|
12a457 |
+ */
|
|
|
12a457 |
+
|
|
|
12a457 |
+ ret = 0;
|
|
|
12a457 |
+out:
|
|
|
12a457 |
+ loc_wipe (&loc;;
|
|
|
12a457 |
+ return ret;
|
|
|
12a457 |
+}
|
|
|
12a457 |
diff --git a/libglusterfs/src/gf-dirent.h b/libglusterfs/src/gf-dirent.h
|
|
|
12a457 |
index faeaf41..faffabf 100644
|
|
|
12a457 |
--- a/libglusterfs/src/gf-dirent.h
|
|
|
12a457 |
+++ b/libglusterfs/src/gf-dirent.h
|
|
|
12a457 |
@@ -66,6 +66,9 @@ void gf_dirent_entry_free (gf_dirent_t *entry);
|
|
|
12a457 |
void gf_dirent_free (gf_dirent_t *entries);
|
|
|
12a457 |
int gf_link_inodes_from_dirent (xlator_t *this, inode_t *parent,
|
|
|
12a457 |
gf_dirent_t *entries);
|
|
|
12a457 |
+int
|
|
|
12a457 |
+gf_fill_iatt_for_dirent (gf_dirent_t *entry, inode_t *parent,
|
|
|
12a457 |
+ xlator_t *subvol);
|
|
|
12a457 |
|
|
|
12a457 |
void
|
|
|
12a457 |
gf_link_inode_from_dirent (xlator_t *this, inode_t *parent, gf_dirent_t *entry);
|
|
|
12a457 |
--
|
|
|
12a457 |
1.7.1
|
|
|
12a457 |
|