From 96b0d69b9faf5b8b984ab991f7d03fa883ba6a4c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 4 Jun 2016 21:33:41 +0100 Subject: Replace forever the recursive error recovery code with a limited loop --- netfs/fuse/fuseAppBase.h | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/netfs/fuse/fuseAppBase.h b/netfs/fuse/fuseAppBase.h index b044f99..63763d9 100644 --- a/netfs/fuse/fuseAppBase.h +++ b/netfs/fuse/fuseAppBase.h @@ -149,18 +149,25 @@ class DLL_PUBLIC FuseAppBase { template static int helper(Args ... a) { - try { - return (fuseApp->*f)(a...); - } - catch (const std::exception & ex) { - if (int rtn = fuseApp->onError(ex)) { - return rtn; + for (int t = 0; ; ++t) { + try { + return (fuseApp->*f)(a...); + } + catch (const std::exception & ex) { + if (t < 10) { + if (int rtn = fuseApp->onError(ex)) { + return rtn; + } + } + else { + fuseApp->logf(LOG_ERR, "Retries expired with %s calling %s", ex.what(), typeid(f).name()); + return -EIO; + } + } + catch (...) { + fuseApp->logf(LOG_ERR, "Unknown exception calling %s", typeid(f).name()); + return -EIO; } - return helper(a...); - } - catch (...) { - fuseApp->logf(LOG_ERR, "Unknown exception calling %s", typeid(f).name()); - return -EIO; } } }; -- cgit v1.2.3