mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Rahul Priolkar <rahul.priolkar@asu.edu>
Cc: Eric Van Hensbergen <ericvh@kernel.org>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Christian Schoenebeck <linux_oss@crudebyte.com>,
	v9fs@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [BUG] 9p: fd: p9_conn_cancel publishes status before t_err
Date: Mon, 14 Sep 2026 01:15:05 +0900	[thread overview]
Message-ID: <aqbMCR3_s2m_A9we@codewreck.org> (raw)
In-Reply-To: <20260911092132.3328659-1-rahul.priolkar@asu.edu>


(I didn't read 90% of that mail)

Rahul Priolkar wrote on Fri, Sep 11, 2026 at 02:21:32AM -0700:
> Conflicting accesses
> --------------------
> 
> The conflicting read is in p9_client_rpc() at net/9p/client.c:612:
> 
>     if (READ_ONCE(req->status) == REQ_STATUS_ERROR) {
>             ...
>             err = req->t_err;          /* racing read */
>     }
> 
> The conflicting write is in p9_conn_cancel() at net/9p/trans_fd.c:182.
> In the same function, req->status is published at line 169 or 173 before
> the lock is released at line 176 (abridged):
> 
>     spin_lock(&m->req_lock);
>     ...
>     WRITE_ONCE(req->status, REQ_STATUS_ERROR);
>     ...
>     spin_unlock(&m->req_lock);
> 
>     ...
>     if (!req->t_err)
>             req->t_err = err;          /* racing write */

That looks like a bug, if someone cares we could set all the errs first,
wmb, then set status to error before dropping the lock; at this point
I'm starting to wonder if we could just run the cb under lock but either
way I've given up on fighting with connection teardown bugs.

Please send a patch if you have time to check what you're doing
-- 
Dominique

      reply	other threads:[~2026-09-13 16:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11  9:21 Rahul Priolkar
2026-09-13 16:15 ` Dominique Martinet [this message]

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=aqbMCR3_s2m_A9we@codewreck.org \
    --to=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=rahul.priolkar@asu.edu \
    --cc=v9fs@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®