summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-06-04 21:33:41 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-06-04 21:33:41 +0100
commit96b0d69b9faf5b8b984ab991f7d03fa883ba6a4c (patch)
treeec1a394265cb72a8e0b6c074f350c4d6aa8c25cc
parentEIO makes more sense than ENOSYS when remote operations can't be performed (diff)
downloadnetfs-96b0d69b9faf5b8b984ab991f7d03fa883ba6a4c.tar.bz2
netfs-96b0d69b9faf5b8b984ab991f7d03fa883ba6a4c.tar.xz
netfs-96b0d69b9faf5b8b984ab991f7d03fa883ba6a4c.zip
Replace forever the recursive error recovery code with a limited loop
-rw-r--r--netfs/fuse/fuseAppBase.h29
1 files 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 <int (FuseAppBase::*f)(Args...)>
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<f>(a...);
- }
- catch (...) {
- fuseApp->logf(LOG_ERR, "Unknown exception calling %s", typeid(f).name());
- return -EIO;
}
}
};