googlefs: fix a possible race condition

This commit is contained in:
François Revol 2015-11-08 04:44:42 +01:00
parent 747e0ba247
commit 2e04b3a2b9

View File

@ -1365,11 +1365,11 @@ int googlefs_open_query(fs_volume *_volume, const char *query, ulong flags,
UNLOCK(&ns->l);
reuse:
/* put the chocolate on the cookie */
c->node = qn;
LOCK(&qn->l);
SLL_INSERT(qn->opened, next, c);
UNLOCK(&qn->l);
qn->qcompleted = 1; /* tell other cookies we're done */
c->node = qn;
*cookie = c;
free(qstring);
return B_OK;