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
This commit is contained in:
Shehjar Tikoo 2010-05-09 23:13:52 +00:00 committed by Anand V. Avati
parent fb2d84b850
commit eba21f8fb6

View File

@ -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;
}