All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Tucker <tom@opengridcomputing.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>,
	Jeff Moyer <jmoyer@redhat.com>,
	linux-nfs@vger.kernel.org
Subject: Re: list corruption in locks_start_grace with 2.6.28-rc3
Date: Sat, 22 Nov 2008 14:48:05 -0600	[thread overview]
Message-ID: <49287005.5050009@opengridcomputing.com> (raw)
In-Reply-To: <20081122092237.1ab81cdb-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>


So I think I know what's going on here. The svc_create_xprt function 
takes a reference on the module that implements the transport and 
svc_xprt_free releases it.

The svc_xprt_free function is called from svc_xprt_put when the kref 
goes to zero. nfsd and other services will put any transports they've 
created when unloaded.

The issue is that the "built in" transports of TCP and UDP are not 
created with svc_create_xprt and therefore the initial transport module 
reference is not taken. So when services exit, the sunrpc module 
reference count is getting incorrectly decremented (twice), once for TCP 
and once for UDP.

What I don't know is what changed to cause this to happen. These 
transports have always been created by svc_addsock and that hasn't
changed. Maybe xcl_owner was NULL for these transports initially?

I'll dig around and see what I can find out.

Tom

Jeff Layton wrote:
> On Fri, 21 Nov 2008 19:54:00 -0500
> "J. Bruce Fields" <bfields@fieldses.org> wrote:
> 
>> On Fri, Nov 21, 2008 at 10:28:18AM -0500, Jeff Moyer wrote:
>>> "J. Bruce Fields" <bfields@fieldses.org> writes:
>>>
>>>> On Wed, Nov 12, 2008 at 11:15:23AM -0500, Jeff Moyer wrote:
>>>>> Hi,
>>>>>
>>>>> I'm doing some testing which involves roughly the following:
>>>>>
>>>>> o mount a file system on the server
>>>>> o start the nfs service
>>>>> - mount the nfs-exported file system from a client
>>>>> - perform a dd from the client
>>>>> - umount the nfs-exported file system from a client
>>>>> o stop the nfs service
>>>>> o unmount the file system on the server
>>>>>
>>>>> After several iterations of this, varying the number of nfsd threads
>>>>> started, I get the attached backtrace.  I've reproduced it twice, now.
>>>>>
>>>>> Let me know if I can be of further help.
>>>> Apologies for the delay, and thanks for the report.  Does the following
>>>> help?  (Untested).
>>> I get a new and different backtrace with this patch applied.  ;)
>>> I'm testing with 2.6.28-rc5, fyi.
>> Thanks for the testing....
>>
>>> static inline void __module_get(struct module *module)
>>> {
>>>         if (module) {
>>>                 BUG_ON(module_refcount(module) == 0);      <------------
>>>                 local_inc(&module->ref[get_cpu()].count);
>>>                 put_cpu();
>>>         }
>>> }
>>>
>>> Called from net/sunrpc/svcexport.c:svc_recv:687
>> You meant svc_xprt.c.  OK.
>>
>>>         } else if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) {
>>>                 struct svc_xprt *newxpt;
>>>                 newxpt = xprt->xpt_ops->xpo_accept(xprt);
>>>                 if (newxpt) {
>>>                         /*
>>>                          * We know this module_get will succeed because the
>>>                          * listener holds a reference too
>>>                          */
>> So clearly the assumption stated in the comment is wrong.
>>
>> I can't see any relationship between this and the previous bug, but
>> perhaps it was covering this up somehow.
>>
>>>                         __module_get(newxpt->xpt_class->xcl_owner);
>> I don't see the problem yet, but I'll look some more....
>>
> 
> FWIW, I've noticed some problems with refcounting when starting and
> stopping nfsd. When you bring it up and take it back down again
> repeatedly (i.e. run "rpc.nfsd 1" and "rpc.nfsd 0"), you'll lose 2
> sunrpc module refs on each cycle.
> 
> I suspect the problem Jeff is hitting is due to that. Maybe he was just
> reliably crashing before it got to 0 before. It's on my to-do list once
> I get some other things off my plate. If someone wants to track it down
> first, be my guest :)
> 
> I have a little more info in this RHBZ, but haven't had time to nail it
> down yet:
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=464123#c10
> 


  parent reply	other threads:[~2008-11-22 20:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-12 16:15 list corruption in locks_start_grace with 2.6.28-rc3 Jeff Moyer
     [not found] ` <x498wrokjj8.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
2008-11-20 20:37   ` J. Bruce Fields
2008-11-21 15:28     ` Jeff Moyer
     [not found]       ` <x49ej15gktp.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
2008-11-22  0:54         ` J. Bruce Fields
2008-11-22 14:22           ` Jeff Layton
     [not found]             ` <20081122092237.1ab81cdb-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2008-11-22 20:48               ` Tom Tucker [this message]
2008-11-22 23:52                 ` Tom Tucker
2008-11-23  1:00                   ` Jeff Layton
2008-11-24 15:26                   ` Jeff Moyer
     [not found]                     ` <x49wsetdu24.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
2008-11-24 16:16                       ` J. Bruce Fields

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=49287005.5050009@opengridcomputing.com \
    --to=tom@opengridcomputing.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@redhat.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /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.