all: document some deadlock danger on debug output

This commit is contained in:
Thomas Schoebel-Theuer 2017-08-01 07:09:47 +02:00 committed by Thomas Schoebel-Theuer
parent 45005f25c9
commit 1e13c9e7ae
2 changed files with 9 additions and 13 deletions

View File

@ -5439,6 +5439,8 @@ static const struct main_class main_classes[] = {
};
/* Helper routine to pre-determine the relevance of a name from the filesystem.
* Caution: this is called as a callback from iterate_dir() and friends.
* Don't deadlock by producing any filesystem output within this!
*/
int main_checker(struct mars_dent *parent, const char *_name, int namlen, unsigned int d_type, int *prefix, int *serial, bool *use_channel)
{
@ -5452,7 +5454,6 @@ int main_checker(struct mars_dent *parent, const char *_name, int namlen, unsign
const char *name = _name;
#endif
//MARS_DBG("trying '%s' '%s'\n", path, name);
for (class = CL_ROOT + 1; ; class++) {
const struct main_class *test = &main_classes[class];
int len = test->cl_len;
@ -5460,9 +5461,11 @@ int main_checker(struct mars_dent *parent, const char *_name, int namlen, unsign
break;
}
//MARS_DBG(" testing class '%s'\n", test->cl_name);
#ifdef MARS_DEBUGGING
/* This can only happen when the table stucture is misformed.
* Exceptionally produce an error output.
* The whole system will not work anyway in such a stupid case.
*/
if (len != strlen(test->cl_name)) {
MARS_ERR("internal table '%s' mismatch: %d != %d\n", test->cl_name, len, (int)strlen(test->cl_name));
len = strlen(test->cl_name);
@ -5479,18 +5482,14 @@ int main_checker(struct mars_dent *parent, const char *_name, int namlen, unsign
continue;
}
//MARS_DBG("path '%s/%s' matches class %d '%s'\n", path, name, class, test->cl_name);
// check special contexts
if (test->cl_serial) {
int plus = 0;
int count;
count = sscanf(name+len, "%d%n", serial, &plus);
if (count < 1) {
//MARS_DBG("'%s' serial number mismatch at '%s'\n", name, name+len);
continue;
}
//MARS_DBG("'%s' serial number = %d\n", name, *serial);
len += plus;
if (name[len] == '-')
len++;
@ -5499,7 +5498,6 @@ int main_checker(struct mars_dent *parent, const char *_name, int namlen, unsign
*prefix = len;
if (test->cl_hostcontext) {
if (memcmp(name+len, my_id(), namlen-len)) {
//MARS_DBG("context mismatch '%s' at '%s'\n", name, name+len);
continue;
}
}

View File

@ -1133,6 +1133,9 @@ struct mars_dir_context {
#endif
// end_remove_this
/* Caution: this is called as a callback from iterate_dir() and friends.
* Don't deadlock by producing any filesystem output within this!
*/
#ifdef __HAS_NEW_FILLDIR_T
int mars_filler(struct dir_context *__buf, const char *name, int namlen, loff_t offset,
u64 ino, unsigned int d_type)
@ -1164,9 +1167,6 @@ int mars_filler(void *__buf, const char *name, int namlen, loff_t offset,
int serial = 0;
bool use_channel = false;
MARS_IO("ino = %llu len = %d offset = %lld type = %u\n", ino, namlen, offset, d_type);
cookie->hit = true;
if (name[0] == '.') {
@ -1187,8 +1187,6 @@ int mars_filler(void *__buf, const char *name, int namlen, loff_t offset,
pathlen += namlen;
newpath[pathlen] = '\0';
MARS_IO("path = '%s'\n", newpath);
dent = brick_zmem_alloc(cookie->allocsize);
if (unlikely(!dent))
goto err_mem1;