summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Gowdappa <rgowdapp@redhat.com>2019-03-07 16:35:33 +0530
committerRaghavendra G <rgowdapp@redhat.com>2019-03-07 15:10:48 +0000
commit91f98e03ab654f212323d385bfc6fa3c0f2e4110 (patch)
tree4a0fd9371a2be4e883b061b9fa0cd99fb4cb0ff3
parentab9b928873024bbc44c941d2ded1b7371f443dd6 (diff)
performance/readdir-ahead: fix deadlock
This deadlock happens while processing dentry corresponding to current directory (.) in rda_fill_readdirp. In this case following order is followed: LOCK(directory_fd_ctx->lock); rda_inode_ctx_get_iatt -> LOCK(directory_inode->lock); However, in rda_mark_inode_dirty following lock order is followed: LOCK(directory_inode->lock); LOCK(directory_fd_ctx->lock); these two codepaths when executed concurrently resulted in a deadlock. Current patch fixes this by removing locking directory inode and fd-ctx in rda_fill_readdirp. This is fine as directory inode's stat won't change due to writes to files within directory. Change-Id: Ic93a67a0dac8229bb0d79582e526a512e6f2569c fixes: bz#1674412 Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com> Fixes:bz#1674412
-rw-r--r--xlators/performance/readdir-ahead/src/readdir-ahead.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.c b/xlators/performance/readdir-ahead/src/readdir-ahead.c
index b3363b8..7fd4f8d 100644
--- a/xlators/performance/readdir-ahead/src/readdir-ahead.c
+++ b/xlators/performance/readdir-ahead/src/readdir-ahead.c
@@ -322,7 +322,8 @@ __rda_fill_readdirp(xlator_t *this, gf_dirent_t *entries, size_t request_size,
memset(&tmp_stat, 0, sizeof(tmp_stat));
- if (dirent->inode) {
+ if (dirent->inode && (!((strcmp(dirent->d_name, ".") == 0) ||
+ (strcmp(dirent->d_name, "..") == 0)))) {
rda_inode_ctx_get_iatt(dirent->inode, this, &tmp_stat);
dirent->d_stat = tmp_stat;
}