linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Benjamin Coddington" <bcodding@redhat.com>
To: "Chuck Lever" <chuck.lever@oracle.com>
Cc: "Jason L Tibbitts III" <tibbs@math.uh.edu>,
	"Bruce Fields" <bfields@fieldses.org>,
	"Wolfgang Walter" <linux@stwm.de>,
	"Linux NFS Mailing List" <linux-nfs@vger.kernel.org>,
	km@cm4all.com, linux-kernel@vger.kernel.org
Subject: Re: Regression in 5.1.20: Reading long directory fails
Date: Thu, 12 Sep 2019 08:29:47 -0400	[thread overview]
Message-ID: <EC2B51FB-8C22-4513-B59F-0F0741F694EB@redhat.com> (raw)
In-Reply-To: <B8CDE765-7DCE-4257-91E1-CC85CB7F87F7@oracle.com>

On 11 Sep 2019, at 13:54, Chuck Lever wrote:

>> On Sep 11, 2019, at 1:50 PM, Benjamin Coddington 
>> <bcodding@redhat.com> wrote:
>>
>> On 11 Sep 2019, at 13:40, Benjamin Coddington wrote:
>>
>>> On 11 Sep 2019, at 13:29, Chuck Lever wrote:
>>>
>>>>> On Sep 11, 2019, at 1:26 PM, Benjamin Coddington 
>>>>> <bcodding@redhat.com> wrote:
>>>>>
>>>>>
>>>>> On 11 Sep 2019, at 12:39, Chuck Lever wrote:
>>>>>
>>>>>>> On Sep 11, 2019, at 12:25 PM, Benjamin Coddington 
>>>>>>> <bcodding@redhat.com> wrote:
>>>>>>>
>>>>>
>>>>>>> Instead, I think we want to make sure the mic falls squarely 
>>>>>>> into the tail
>>>>>>> every time.
>>>>>>
>>>>>> I'm not clear how you could do that. The length of the page data 
>>>>>> is not
>>>>>> known to the client before it parses the reply. Are you 
>>>>>> suggesting that
>>>>>> gss_unwrap should do it somehow?
>>>>>
>>>>> Is it too niave to always put the mic at the end of the tail?
>>>>
>>>> The size of the page content is variable.
>>>>
>>>> The only way the MIC will fall into the tail is if the page content 
>>>> is
>>>> exactly the largest expected size. When the page content is smaller 
>>>> than
>>>> that, the receive logic will place part or all of the MIC in 
>>>> ->pages.
>>>
>>> Ok, right.  But what I meant is that xdr_buf_read_netobj() should be 
>>> renamed
>>> and repurposed to be "move the mic from wherever it is to the end of
>>> xdr_buf's tail".
>>>
>>> But now I see what you mean, and I also see that it is already 
>>> trying to do
>>> that.. and we don't want to overlap the copy..
>>>
>>> So, really, we need the tail to be larger than twice the mic.. less 
>>> 1.  That
>>> means the fix is probably just increasing rslack for krb5i.
>>
>> .. or we can keep the tighter tail space, and if we detect the mic 
>> straddles
>> the page and tail, we can move the mic into the tail with 2 copies, 
>> first
>> move the bit in the tail back, then move the bit in the pages.
>>
>> Which is preferred, less allocation, or in the rare case this occurs, 
>> doing
>> copy twice?
>
> It sounds like the bug is that the current code does not deal 
> correctly
> when the MIC crosses the boundary between ->pages and ->tail? I'd like
> to see that addressed rather than changing rslack.

Here's what I'm about to run through my testing:

diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 48c93b9e525e..d6ffc9011269 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -1238,14 +1238,21 @@ EXPORT_SYMBOL_GPL(xdr_encode_word);

  /* If the netobj starting offset bytes from the start of xdr_buf is 
contained
   * entirely in the head or the tail, set object to point to it; 
otherwise
- * try to find space for it at the end of the tail, copy it there, and
- * set obj to point to it. */
+ * try to find space for it at the end of the tail, and copy it there.  
If
+ * the netobj is partly within the page data and tail, shrink the pages 
to
+ * move the object into the tail */
  int xdr_buf_read_netobj(struct xdr_buf *buf, struct xdr_netobj *obj, 
unsigned int offset)
  {
         struct xdr_buf subbuf;
+       unsigned int page_range;

         if (xdr_decode_word(buf, offset, &obj->len))
                 return -EFAULT;
+
+       page_range = buf->head->iov_len + buf->page_len - offset + 4;
+       if (page_range > 0 && page_range < obj->len)
+               xdr_shrink_pagelen(buf, page_range);
+
         if (xdr_buf_subsegment(buf, &subbuf, offset + 4, obj->len))
                 return -EFAULT;


Is the use of xdr_shrink_pagelen() at this point in the decoding a 
problem for RDMA?

Ben

  reply	other threads:[~2019-09-12 12:29 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13 15:08 Regression in 5.1.20: Reading long directory fails Jason L Tibbitts III
2019-08-13 17:00 ` Jason L Tibbitts III
2019-08-22 19:39 ` Jason L Tibbitts III
2019-08-28 17:46   ` J. Bruce Fields
2019-08-28 18:29     ` Jason L Tibbitts III
2019-08-28 18:33       ` J. Bruce Fields
2019-09-03 15:49       ` Jason L Tibbitts III
2019-09-03 18:02         ` Wolfgang Walter
2019-09-03 19:06           ` Jason L Tibbitts III
2019-09-03 19:08             ` Chuck Lever
2019-09-03 21:37             ` Wolfgang Walter
2019-09-04  1:50               ` Jason L Tibbitts III
2019-09-06 14:48                 ` J. Bruce Fields
2019-09-06 20:47                   ` Jason L Tibbitts III
2019-09-06 20:50                     ` Chuck Lever
2019-09-08 11:39                       ` Benjamin Coddington
2019-09-08 15:19                         ` Trond Myklebust
2019-09-08 15:48                           ` Chuck Lever
2019-09-08 16:47                             ` Trond Myklebust
2019-09-08 16:51                               ` Chuck Lever
2019-09-11 16:25                       ` Benjamin Coddington
2019-09-11 16:39                         ` Chuck Lever
2019-09-11 17:26                           ` Benjamin Coddington
2019-09-11 17:27                             ` Benjamin Coddington
2019-09-11 17:29                             ` Chuck Lever
2019-09-11 17:40                               ` Benjamin Coddington
2019-09-11 17:43                                 ` Chuck Lever
2019-09-11 17:59                                   ` Benjamin Coddington
2019-09-11 17:50                                 ` Benjamin Coddington
2019-09-11 17:54                                   ` Chuck Lever
2019-09-12 12:29                                     ` Benjamin Coddington [this message]
2019-09-12 12:53                                       ` Trond Myklebust
2019-09-12 13:08                                         ` Benjamin Coddington
2019-09-12 13:13                                           ` J. Bruce Fields
2019-09-12 13:25                                             ` Trond Myklebust
2019-09-12 13:35                                               ` Benjamin Coddington
2019-09-12 13:14                                           ` Trond Myklebust

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=EC2B51FB-8C22-4513-B59F-0F0741F694EB@redhat.com \
    --to=bcodding@redhat.com \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=km@cm4all.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux@stwm.de \
    --cc=tibbs@math.uh.edu \
    /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;
as well as URLs for NNTP newsgroup(s).