All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: NeilBrown <neil@brown.name>
Cc: Jeff Layton <jlayton@kernel.org>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
	linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [RFC PATCH] NFSD: Remove WARN_ON_ONCE in nfsd_iter_read()
Date: Sat, 13 Sep 2025 12:01:14 -0400	[thread overview]
Message-ID: <49025423-30cc-4ac7-a37c-2767321e5982@kernel.org> (raw)
In-Reply-To: <175774182203.1696783.2451676793107977604@noble.neil.brown.name>

On 9/13/25 1:37 AM, NeilBrown wrote:
>> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
>> index 714777c221ed..e2f0fe3f82c0 100644
>> --- a/fs/nfsd/vfs.c
>> +++ b/fs/nfsd/vfs.c
>> @@ -1120,13 +1120,13 @@ __be32 nfsd_iter_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
>>  		bvec_set_page(&rqstp->rq_bvec[v], *(rqstp->rq_next_page++),
>>  			      len, base);
>>  		total -= len;
>> -		++v;
>>  		base = 0;
>> +		if (++v >= rqstp->rq_maxpages)
>> +			break;
> I would have changed the head of the while loop to be
> 
>   while (total > 0 && rqstp->rq_next_page < ....)
> 
> and then realised that I don't know what to put there.
> I don't think that counting up to rq_maxpages is safe when there could
> be two READ ops in an NFSv4 Compound.
> 
> And if we are cleaning up this function I woul put the increments of v
> and rq_next_page next to each other..
> </bikeshed>
> 
> The patch is an improvement.  I wonder if it is enough.

I'm planning a second patch that adds protection against overrunning
the rq_pages array. Is there anything else you feel is needed?


-- 
Chuck Lever

  reply	other threads:[~2025-09-13 16:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11 20:18 [RFC PATCH] NFSD: Remove WARN_ON_ONCE in nfsd_iter_read() Chuck Lever
2025-09-12 13:25 ` Mike Snitzer
2025-09-13  5:37 ` NeilBrown
2025-09-13 16:01   ` Chuck Lever [this message]
2025-09-14  0:34     ` NeilBrown

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=49025423-30cc-4ac7-a37c-2767321e5982@kernel.org \
    --to=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.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 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.