From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: Qemu-block <qemu-block@nongnu.org>, "Greg Kurz" <groug@kaod.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Linus Heckemann" <git@sphalerite.org>
Subject: Re: [PATCH v5] 9pfs: use GHashTable for fid table
Date: Tue, 27 Sep 2022 21:10:52 +0200 [thread overview]
Message-ID: <7301097.N5VPtqMtvv@silver> (raw)
In-Reply-To: <ygasfkcx30u.fsf@localhost>
On Dienstag, 27. September 2022 17:14:57 CEST Linus Heckemann wrote:
> Linus Heckemann <git@sphalerite.org> writes:
> > static void coroutine_fn virtfs_reset(V9fsPDU *pdu)
> > {
> >
> > V9fsState *s = pdu->s;
> > V9fsFidState *fidp;
> >
> > + GList *freeing;
> > + /* Get a list of all the values (fid states) in the table, which we
> > then... */ + g_autoptr(GList) fids = g_hash_table_get_values(s->fids);
> >
> > - /* Free all fids */
> > - while (!QSIMPLEQ_EMPTY(&s->fid_list)) {
> > - /* Get fid */
> > - fidp = QSIMPLEQ_FIRST(&s->fid_list);
> > - fidp->ref++;
> > + /* ... remove from the table, taking over ownership. */
> > + g_hash_table_steal_all(s->fids);
> >
> > - /* Clunk fid */
> > - QSIMPLEQ_REMOVE(&s->fid_list, fidp, V9fsFidState, next);
> > + /*
> > + * This allows us to release our references to them asynchronously
> > without + * iterating over the hash table and risking iterator
> > invalidation + * through concurrent modifications.
> > + */
> > + for (freeing = fids; freeing; freeing = freeing->next) {
> > + fidp = freeing->data;
> > + fidp->ref++;
> >
> > fidp->clunked = true;
> >
> > -
> >
> > put_fid(pdu, fidp);
> >
> > }
> >
> > }
>
> I'm not sure if this implementation is correct. I'm concerned that it
> may result in dangling references, but haven't been able to find a
> client that will send the TVERSION request on a connection that's
> already been used in other ways, as opposed to when the connection is
> first established. I suspect this will be very rare in general, so it
> might be good to have a test case somewhere.
Always welcome! :)
https://wiki.qemu.org/Documentation/9p#Test_Cases
If you do, then please add the test as a separate patch.
Best regards,
Christian Schoenebeck
next prev parent reply other threads:[~2022-09-27 19:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 14:25 [PATCH v5] 9pfs: use GHashTable for fid table Linus Heckemann
2022-09-27 15:14 ` Linus Heckemann
2022-09-27 19:10 ` Christian Schoenebeck [this message]
2022-09-27 19:07 ` Christian Schoenebeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7301097.N5VPtqMtvv@silver \
--to=qemu_oss@crudebyte.com \
--cc=f4bug@amsat.org \
--cc=git@sphalerite.org \
--cc=groug@kaod.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.