summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2010-05-09 23:13:52 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-05-10 02:17:57 -0700
commiteba21f8fb6715e3933253b0114f03a153be80649 (patch)
treeb9f7adddb78df6fb9a66e1946fd32b429f5041ba
parentfb2d84b8507354ed6128cacf4289f405cdc8bdc6 (diff)
nfs: Fine tune nfs_entry_loc_fill return values
A previous change to this function introduced a regression for exclusive creates. This patch fixes the regression by bringing the return values in line with what the callers expect in different situations of loc filling. Signed-off-by: Shehjar Tikoo <shehjart@dev.gluster.com> Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 857 (Crash in afr_sh_entry_expunge_entry_cbk) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=857
-rw-r--r--xlators/nfs/server/src/nfs-common.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c
index 5609b8efe..9f68f7146 100644
--- a/xlators/nfs/server/src/nfs-common.c
+++ b/xlators/nfs/server/src/nfs-common.c
@@ -324,6 +324,7 @@ nfs_entry_loc_fill (inode_table_t *itable, ino_t ino, uint64_t gen, char *entry,
inode_t *entryinode = NULL;
int ret = -3;
char *resolvedpath = NULL;
+ int pret = -3;
if ((!itable) || (!entry) || (!loc))
return ret;
@@ -345,10 +346,17 @@ nfs_entry_loc_fill (inode_table_t *itable, ino_t ino, uint64_t gen, char *entry,
* lookup.
*/
entryinode = inode_new (itable);
- ret = nfs_parent_inode_loc_fill (parent, entryinode,
- entry, loc);
- if (ret < 0)
- ret = -3;
+ /* Cannot change ret because that must
+ * continue to have -2.
+ */
+ pret = nfs_parent_inode_loc_fill (parent, entryinode,
+ entry, loc);
+ /* Only if parent loc fill fails, should we notify error
+ * through ret, otherwise, we still need to force a
+ * lookup by returning -2.
+ */
+ if (pret < 0)
+ ret = -3;
}
goto err;
}