From eba21f8fb6715e3933253b0114f03a153be80649 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Sun, 9 May 2010 23:13:52 +0000 Subject: 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 Signed-off-by: Shehjar Tikoo Signed-off-by: Anand V. Avati BUG: 857 (Crash in afr_sh_entry_expunge_entry_cbk) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=857 --- xlators/nfs/server/src/nfs-common.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'xlators/nfs/server/src/nfs-common.c') diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c index 5609b8ef..9f68f714 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; } -- cgit