mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Antony Antony <antony.antony@secunet.com>
To: David Howells <dhowells@redhat.com>
Cc: Antony Antony <antony@phenome.org>,
	Sedat Dilek <sedat.dilek@gmail.com>,
	Maximilian Bosch <maximilian@mbosch.me>,
	Linux regressions mailing list <regressions@lists.linux.dev>,
	LKML <linux-kernel@vger.kernel.org>,
	<linux-fsdevel@vger.kernel.org>,
	Christian Brauner <brauner@kernel.org>
Subject: Re: [PATCH] 9p: Don't revert the I/O iterator after reading
Date: Tue, 22 Oct 2024 01:53:26 +0200	[thread overview]
Message-ID: <ZxbpdnA4jR7IYhRH@moon.secunet.de> (raw)
In-Reply-To: <2299159.1729543103@warthog.procyon.org.uk>

Hi David,

On Mon, Oct 21, 2024 at 21:38:23 +0100, David Howells wrote:
> Hi Antony,
> 
> I think I may have a fix already lurking on my netfs-writeback branch for the
> next merge window.  Can you try the attached?

yes. The fix works. I rebooted a few times and no crash.

Tested-by: Antony Antony <antony.antony@secunet.com>

I am running test script in a loop over night. 

thanks,
-antony

> 
> David
> ---
> Don't revert the I/O iterator before returning from p9_client_read_once().
> netfslib doesn't require the reversion and nor doed 9P directory reading.
> 
> Make p9_client_read() use a temporary iterator to call down into
> p9_client_read_once(), and advance that by the amount read.
> 
> Reported-by: Antony Antony <antony@phenome.org>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Eric Van Hensbergen <ericvh@kernel.org>
> cc: Latchesar Ionkov <lucho@ionkov.net>
> cc: Dominique Martinet <asmadeus@codewreck.org>
> cc: Christian Schoenebeck <linux_oss@crudebyte.com>
> cc: v9fs@lists.linux.dev
> cc: netfs@lists.linux.dev
> cc: linux-fsdevel@vger.kernel.org


> ---
>  net/9p/client.c |   10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/net/9p/client.c b/net/9p/client.c
> index 5cd94721d974..be59b0a94eaf 100644
> --- a/net/9p/client.c
> +++ b/net/9p/client.c
> @@ -1519,13 +1519,15 @@ p9_client_read(struct p9_fid *fid, u64 offset, struct iov_iter *to, int *err)
>  	*err = 0;
>  
>  	while (iov_iter_count(to)) {
> +		struct iov_iter tmp = *to;
>  		int count;
>  
> -		count = p9_client_read_once(fid, offset, to, err);
> +		count = p9_client_read_once(fid, offset, &tmp, err);
>  		if (!count || *err)
>  			break;
>  		offset += count;
>  		total += count;
> +		iov_iter_advance(to, count);
>  	}
>  	return total;
>  }
> @@ -1567,16 +1569,12 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to,
>  	}
>  	if (IS_ERR(req)) {
>  		*err = PTR_ERR(req);
> -		if (!non_zc)
> -			iov_iter_revert(to, count - iov_iter_count(to));
>  		return 0;
>  	}
>  
>  	*err = p9pdu_readf(&req->rc, clnt->proto_version,
>  			   "D", &received, &dataptr);
>  	if (*err) {
> -		if (!non_zc)
> -			iov_iter_revert(to, count - iov_iter_count(to));
>  		trace_9p_protocol_dump(clnt, &req->rc);
>  		p9_req_put(clnt, req);
>  		return 0;
> @@ -1596,8 +1594,6 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to,
>  			p9_req_put(clnt, req);
>  			return n;
>  		}
> -	} else {
> -		iov_iter_revert(to, count - received - iov_iter_count(to));
>  	}
>  	p9_req_put(clnt, req);
>  	return received;
> 

  reply	other threads:[~2024-10-21 23:53 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <D4LHHUNLG79Y.12PI0X6BEHRHW@mbosch.me>
2024-10-02 17:31 ` [REGRESSION] 9pfs issues on 6.12-rc1 Linux regression tracking (Thorsten Leemhuis)
2024-10-02 21:48   ` Maximilian Bosch
2024-10-03  1:12     ` Sedat Dilek
2024-10-17 18:00       ` Antony Antony
2024-10-21 13:23         ` Christian Brauner
2024-10-23 18:35         ` Maximilian Bosch
2024-10-21 14:12       ` David Howells
2024-10-21 15:33         ` Antony Antony
2024-10-21 14:45       ` David Howells
2024-10-21 15:53         ` Antony Antony
2024-10-21 19:48         ` David Howells
2025-08-10  5:10         ` Arnout Engelen
2024-10-21 20:38       ` [PATCH] 9p: Don't revert the I/O iterator after reading David Howells
2024-10-21 23:53         ` Antony Antony [this message]
2024-10-22  8:56         ` Christian Brauner
2024-10-23 10:07       ` [REGRESSION] 9pfs issues on 6.12-rc1 David Howells
2024-10-23 19:38         ` Antony Antony
2025-06-12 22:24           ` Ryan Lahfa
2025-06-27  5:44             ` Christian Theune
2025-06-27  6:44               ` Dominique Martinet
2025-06-27  8:19                 ` Christian Theune
2025-08-10 17:57             ` Arnout Engelen
2025-08-11  0:57               ` asmadeus
2025-08-11  7:43                 ` Dominique Martinet
2025-08-11 12:43                   ` Arnout Engelen
2025-06-27 10:00           ` David Howells
2025-06-27 10:33             ` Ryan Lahfa

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=ZxbpdnA4jR7IYhRH@moon.secunet.de \
    --to=antony.antony@secunet.com \
    --cc=antony@phenome.org \
    --cc=brauner@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maximilian@mbosch.me \
    --cc=regressions@lists.linux.dev \
    --cc=sedat.dilek@gmail.com \
    /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®