From: Ronnie Sahlberg Date: Thu, 13 Mar 2014 04:00:08 +0000 (-0700) Subject: Dont check for NFS errors in the LOOKUP during READDIRPLUS emulation X-Git-Tag: upstream/1.9.6^2~80 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f66ff9931d7bb7e1b6958db8d599c9040d3eb822;p=deb_libnfs.git Dont check for NFS errors in the LOOKUP during READDIRPLUS emulation On servers with extended attributes, a server copuld be set up to deny READ-ATTRIBUTES for the libnfs user. This means that READDIRPLUS will no longer work since it will need to stat() and thus READ-ATTRIBUTE in order to prepare the response. Libnfs has READDIRPLUS emulation for the cases where this command fails by switching to old READDIR to scan all the file names and then a LOOKUP loop for getting the file attributes. Most of the time the purpose for this emulation is to handle the case where the server simply does not support READDIRPLUS at all, which sometimes is the case for embedded systems with userspace nfs servers. In this case, where files just have READ-ATTRIBUTE deny for the libnfs user, this will also fail and trigger the fallback to READDIR + LOOKUP-loop. If the LOOKUP fails for this loop, then just ignore trying to update the attributes we have for this object, but do not fail the actual READDIRPLUS emulation. This addresses a permissions issue reported by a XBMC user in issue #60 --- diff --git a/lib/libnfs.c b/lib/libnfs.c index cfddf29..424a736 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -2737,9 +2737,6 @@ static void nfs_opendir3_cb(struct rpc_context *rpc, int status, void *command_d if (status == RPC_STATUS_CANCEL) { rdpe_cb_data->status = RPC_STATUS_CANCEL; } - if (status == RPC_STATUS_SUCCESS && res->status != NFS3_OK) { - rdpe_cb_data->status = RPC_STATUS_ERROR; - } if (status == RPC_STATUS_SUCCESS && res->status == NFS3_OK) { if (res->LOOKUP3res_u.resok.obj_attributes.attributes_follow) { fattr3 *attributes = &res->LOOKUP3res_u.resok.obj_attributes.post_op_attr_u.attributes;