From d6f1f04ef0db60bcc0f4963dbd1b76ce73c36779 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Thu, 11 Nov 2010 23:00:19 +0000 Subject: performance/quick-read: handle the errors in qr_loc_fill properly when an fop needs to do open before continuing. - without need_unwind set, 'goto out' will result in infinite loop. Signed-off-by: Raghavendra G Signed-off-by: Anand V. Avati BUG: 2075 (inode_from_path silently consumes 99% CPU causing nfs client disconnects) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2075 --- xlators/performance/quick-read/src/quick-read.c | 26 +++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 4ec38a9e05e..24e187a789d 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -82,7 +82,8 @@ qr_loc_fill (loc_t *loc, inode_t *inode, char *path) int32_t ret = -1; char *parent = NULL; - if ((loc == NULL) || (inode == NULL) || (path == NULL)) { + if ((loc == NULL) || (inode == NULL) || (path == NULL) + || (inode->table == NULL)) { ret = -1; errno = EINVAL; goto out; @@ -103,7 +104,6 @@ qr_loc_fill (loc_t *loc, inode_t *inode, char *path) loc->parent = inode_from_path (inode->table, parent); if (loc->parent == NULL) { ret = -1; - errno = EINVAL; goto out; } @@ -1125,6 +1125,8 @@ out: if (need_open) { op_ret = qr_loc_fill (&loc, fd->inode, path); if (op_ret == -1) { + need_unwind = 1; + op_errno = errno; qr_resume_pending_ops (qr_fd_ctx); goto out; } @@ -1262,6 +1264,8 @@ out: } else if (need_open) { op_ret = qr_loc_fill (&loc, fd->inode, path); if (op_ret == -1) { + need_unwind = 1; + op_errno = errno; qr_resume_pending_ops (qr_fd_ctx); goto out; } @@ -1357,6 +1361,8 @@ out: op_ret = qr_loc_fill (&loc, fd->inode, path); if (op_ret == -1) { qr_resume_pending_ops (qr_fd_ctx); + need_unwind = 1; + op_errno = errno; goto out; } @@ -1459,6 +1465,8 @@ out: op_ret = qr_loc_fill (&loc, fd->inode, path); if (op_ret == -1) { qr_resume_pending_ops (qr_fd_ctx); + need_unwind = 1; + op_errno = errno; goto out; } @@ -1557,6 +1565,8 @@ out: op_ret = qr_loc_fill (&loc, fd->inode, path); if (op_ret == -1) { qr_resume_pending_ops (qr_fd_ctx); + op_errno = errno; + need_unwind = 1; goto out; } @@ -1657,6 +1667,8 @@ out: } else if (need_open) { op_ret = qr_loc_fill (&loc, fd->inode, path); if (op_ret == -1) { + need_unwind = 1; + op_errno = errno; qr_resume_pending_ops (qr_fd_ctx); goto out; } @@ -1829,6 +1841,8 @@ out: } else if (need_open) { op_ret = qr_loc_fill (&loc, fd->inode, path); if (op_ret == -1) { + need_unwind = 1; + op_errno = errno; qr_resume_pending_ops (qr_fd_ctx); goto out; } @@ -1929,6 +1943,8 @@ out: } else if (need_open) { op_ret = qr_loc_fill (&loc, fd->inode, path); if (op_ret == -1) { + need_unwind = 1; + op_errno = errno; qr_resume_pending_ops (qr_fd_ctx); goto out; } @@ -2023,6 +2039,8 @@ out: } else if (need_open) { op_ret = qr_loc_fill (&loc, fd->inode, path); if (op_ret == -1) { + need_unwind = 1; + op_errno = errno; qr_resume_pending_ops (qr_fd_ctx); goto out; } @@ -2176,6 +2194,8 @@ out: } else if (need_open) { op_ret = qr_loc_fill (&loc, fd->inode, path); if (op_ret == -1) { + need_unwind = 1; + op_errno = errno; qr_resume_pending_ops (qr_fd_ctx); goto out; } @@ -2273,6 +2293,8 @@ out: } else if (need_open) { op_ret = qr_loc_fill (&loc, fd->inode, path); if (op_ret == -1) { + op_errno = errno; + need_unwind = 1; qr_resume_pending_ops (qr_fd_ctx); goto out; } -- cgit