9front - general discussion about 9front
 help / color / mirror / Atom feed
From: qwx@sciops.net
To: 9front@9front.org
Subject: [9front] aux/wacom: possible race
Date: Mon, 06 Dec 2021 03:50:19 +0100	[thread overview]
Message-ID: <5FA0662D627A99E4DF5914FDD6E872E7@wopr.sciops.net> (raw)

Hello,

I've been playing with aux/wacom and aux/tablet on x61t.
aux/tablet often crashes with a `no concurrent reads, please'
error mid-drawing.  From what I can tell both of these
programs are early 9front additions.  Has anyone else seen
these errors?

I think that the issue is that nothing prevents the .req
field of each Reader from being modified at the same time
as a read(2) comes in, so at some point a new read could
check the field before sendout() can clear it.  The patch
below seems to work.

What do you think?

Thanks,
qwx


diff 69249e8313fb8853c5c162dd16b927099e25bb15 uncommitted
--- a//sys/src/cmd/aux/wacom.c
+++ b//sys/src/cmd/aux/wacom.c
@@ -303,11 +303,13 @@
 		reply(req, m);
 		msgdecref(m);
 	} else {
+		lock(&readers);
 		if(r->req) {
 			respond(req, "no concurrent reads, please");
 		} else {
 			r->req = req;
 		}
+		unlock(&readers);
 	}
 }
 

             reply	other threads:[~2021-12-06 10:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06  2:50 qwx [this message]
2021-12-06  3:08 ` Stanley Lieber
2021-12-14 23:55 ` qwx
2021-12-15  0:00   ` Stanley Lieber

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=5FA0662D627A99E4DF5914FDD6E872E7@wopr.sciops.net \
    --to=qwx@sciops.net \
    --cc=9front@9front.org \
    --subject='Re: [9front] aux/wacom: possible race' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).