summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2015-07-01 15:56:58 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-08-21 04:48:48 -0700
commitcb879d6adbb9194b488f2ad7a97cf7fc7f5a5ef5 (patch)
tree52f20d6d0fbd5f250baddc395a3e6da12e452298 /libglusterfs/src
parent7322e6c5b405a754fea1e0eeddf8e66da1bdd326 (diff)
protocol/server: forget the inodes which got ENOENT in lookup
Backport of http://review.gluster.org/11489 If a looked up object is removed from the backend, then upon getting a revalidated lookup on that object ENOENT error is received. protocol/server xlator handles it by removing dentry upon which ENOENT is received. But the inode associated with it still remains in the inode table, and whoever does nameless lookup on the gfid of that object will be able to do it successfully despite the object being not present. For handling this issue, upon getting ENOENT on a looked up entry in revalidate lookups, protocol/server should forget the inode as well. Though removing files directly from the backend is not allowed, in case of objects corrupted due to bitrot and marked as bad by scrubber, objects are removed directly from the backend in case of replicate volumes, so that the object is healed from the good copy. For handling this, the inode of the bad object removed from the backend should be forgotten. Otherwise, the inode which knows the object it represents is bad, does not allow read/write operations happening as part of self-heal. Change-Id: I268eeaf37969458687425187be6622347a6cc1f1 BUG: 1255604 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/11973 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/inode.c26
-rw-r--r--libglusterfs/src/inode.h3
2 files changed, 29 insertions, 0 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 70150536643..7f717535f39 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -1319,6 +1319,32 @@ inode_parent (inode_t *inode, uuid_t pargfid, const char *name)
return parent;
}
+static int
+__inode_has_dentry (inode_t *inode)
+{
+ if (!inode) {
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ LG_MSG_INODE_NOT_FOUND, "inode not found");
+ return 0;
+ }
+
+ return !list_empty (&inode->dentry_list);
+}
+
+int
+inode_has_dentry (inode_t *inode)
+{
+
+ int dentry_present = 0;
+
+ LOCK (&inode->lock);
+ {
+ dentry_present = __inode_has_dentry (inode);
+ }
+ UNLOCK (&inode->lock);
+
+ return dentry_present;
+}
int
__inode_path (inode_t *inode, const char *name, char **bufp)
diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h
index b8bac7932c3..a17970e8174 100644
--- a/libglusterfs/src/inode.h
+++ b/libglusterfs/src/inode.h
@@ -278,4 +278,7 @@ inode_set_need_lookup (inode_t *inode, xlator_t *this);
gf_boolean_t
inode_needs_lookup (inode_t *inode, xlator_t *this);
+int
+inode_has_dentry (inode_t *inode);
+
#endif /* _INODE_H */