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); UNLOCK(&ns->l);
reuse: reuse:
/* put the chocolate on the cookie */ /* put the chocolate on the cookie */
c->node = qn;
LOCK(&qn->l); LOCK(&qn->l);
SLL_INSERT(qn->opened, next, c); SLL_INSERT(qn->opened, next, c);
UNLOCK(&qn->l); UNLOCK(&qn->l);
qn->qcompleted = 1; /* tell other cookies we're done */ qn->qcompleted = 1; /* tell other cookies we're done */
c->node = qn;
*cookie = c; *cookie = c;
free(qstring); free(qstring);
return B_OK; return B_OK;