mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
vfs_ceph_new: proper error handling to readdir
Error handling in the case of 'ceph_readdir' is done by setting 'errno' deep within libcephfs code. In case of error, emit proper debug message and re-update errno to avoid possible over-write by logging mechanism. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15686 Signed-off-by: Shachar Sharon <ssharon@redhat.com> Reviewed-by: Guenther Deschner <gd@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
This commit is contained in:
parent
99c7179e5d
commit
24a3423949
@ -985,11 +985,19 @@ static struct dirent *vfs_ceph_readdir(struct vfs_handle_struct *handle,
|
|||||||
{
|
{
|
||||||
const struct vfs_ceph_fh *dircfh = (const struct vfs_ceph_fh *)dirp;
|
const struct vfs_ceph_fh *dircfh = (const struct vfs_ceph_fh *)dirp;
|
||||||
struct dirent *result = NULL;
|
struct dirent *result = NULL;
|
||||||
|
int errval = 0;
|
||||||
|
|
||||||
DBG_DEBUG("[CEPH] readdir(%p, %p)\n", handle, dirp);
|
DBG_DEBUG("[CEPH] readdir(%p, %p)\n", handle, dirp);
|
||||||
|
errno = 0;
|
||||||
result = vfs_ceph_ll_readdir(handle, dircfh);
|
result = vfs_ceph_ll_readdir(handle, dircfh);
|
||||||
DBG_DEBUG("[CEPH] readdir(...) = %p\n", result);
|
errval = errno;
|
||||||
|
if ((result == NULL) && (errval != 0)) {
|
||||||
|
DBG_DEBUG("[CEPH] readdir(...) = %d\n", errval);
|
||||||
|
} else {
|
||||||
|
DBG_DEBUG("[CEPH] readdir(...) = %p\n", result);
|
||||||
|
}
|
||||||
|
/* re-assign errno to avoid possible over-write by DBG_DEBUG */
|
||||||
|
errno = errval;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user