scoutfs: add debug check for scout-107

We have a bug filed where the fs got stuck spinning in
scoutfs_dir_get_backref_path(). There's been enough changes lately that
we're not sure if this issue still exists. Catch if we have an excessive
number of iterations through our loop there and exit with some debug info.

Signed-off-by: Mark Fasheh <mfasheh@versity.com>
This commit is contained in:
Mark Fasheh
2018-01-25 16:01:52 -08:00
committed by Zach Brown
parent e803b10bca
commit b015927e7b

View File

@@ -24,6 +24,7 @@
#include "inode.h"
#include "ioctl.h"
#include "key.h"
#include "msg.h"
#include "super.h"
#include "trans.h"
#include "xattr.h"
@@ -1209,8 +1210,20 @@ int scoutfs_dir_get_backref_path(struct super_block *sb, u64 ino, u64 dir_ino,
{
u64 par_ino;
int ret;
int iters = 0;
retry:
/*
* Debugging for SCOUT-107, can be removed later when we're
* confident we won't hit an endless loop here again.
*/
if (WARN_ONCE(++iters >= 4000, "scoutfs: Excessive retries in "
"dir_get_backref_path. ino %llu dir_ino %llu name %.*s\n",
ino, dir_ino, name_len, name)) {
ret = -EINVAL;
goto out;
}
/* get the next link name to the given inode */
ret = add_next_linkref(sb, ino, dir_ino, name, name_len, list);
if (ret < 0)