xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Joe Jin" <joe.jin@oracle.com>
To: Daniel Stodden <daniel.stodden@citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"greg.marsden@oracle.com" <greg.marsden@oracle.com>,
	Joe Jin <joe.jin@oracle.com>, Jan Beulich <JBeulich@novell.com>,
	"deepak.patel@oracle.com" <deepak.patel@oracle.com>,
	Keir Fraser <Keir.Fraser@eu.citrix.com>
Subject: Re: [PATCH] Fix blkback/blktap sysfs read bug.
Date: Thu, 21 Jan 2010 11:13:07 +0800	[thread overview]
Message-ID: <20100121031307.GA29727@joejin-pc.cn.oracle.com> (raw)
In-Reply-To: <1264040197.12544.3679.camel@agari.van.xensource.com>

On 2010-01-20 18:16, Daniel Stodden wrote:
> 
> Hey.
> 
> I think reverted a similar patch when moving past 2.6.18 a while ago,
> but I don't remember the first kernel versions affected right now.
> 
> On Wed, 2010-01-20 at 06:45 -0500, Joe Jin wrote:
> 
> >  static void connect(struct backend_info *);
> >  static int connect_ring(struct backend_info *);
> > @@ -122,10 +123,19 @@
> >  				   struct device_attribute *attr,	\
> >  				   char *buf)				\
> >  	{								\
> > -		struct xenbus_device *dev = to_xenbus_device(_dev);	\
> > -		struct backend_info *be = dev->dev.driver_data;		\
> > +		ssize_t ret = -ENODEV;					\
> > +		struct xenbus_device *dev;				\
> > +		struct backend_info *be;				\
> 
> 
> 								\
> > -		return sprintf(buf, format, ##args);			\
> > +		if (!get_device(_dev))					\
> > +			return ret;					\
> > +		dev = to_xenbus_device(_dev);				\
> 
> I think this deadlocks here:
> > +		read_lock(&sysfs_read_lock);				\
> > +		if ((be = dev->dev.driver_data) != NULL)		\
> > +			ret = sprintf(buf, format, ##args);		\
> > +		read_unlock(&sysfs_read_lock);				\
> > +		put_device(_dev);					\
> > +		return ret;						\
> >  	}								\
> >  	static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
> >  
> > @@ -170,6 +180,7 @@
> >  {
> >  	struct backend_info *be = dev->dev.driver_data;
> >  
> > +	write_lock(&sysfs_read_lock);
> >  	if (be->group_added)
> 
> .. and here:
> >  		xentap_sysfs_delif(be->dev);
> >  	if (be->backend_watch.node) {
> > @@ -187,6 +198,7 @@
> >  	}
> >  	kfree(be);
> >  	dev->dev.driver_data = NULL;
> > +	write_unlock(&sysfs_read_lock);
> >  	return 0;
> >  }
> 
> Sysfs may refcount these nodes, blocking xentap_sysfs_delif().

Would you like to give me some info about of blocking and deadlocks?

Checked xentap_sysfs_delif() -> sysfs_remove_group() and I did not found
blocking codes, maybe I lost something?

Thanks,
Joe

  reply	other threads:[~2010-01-21  3:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-19  9:52 [PATCH] Fix blkback/blktap sysfs read bug Joe Jin
2010-01-19 10:25 ` Jan Beulich
2010-01-19 11:32   ` Joe Jin
2010-01-19 12:06     ` Jan Beulich
2010-01-19 14:13       ` Joe Jin
2010-01-19 16:20         ` Jan Beulich
2010-01-20  2:06           ` Joe Jin
2010-01-20  7:46             ` Jan Beulich
2010-01-20 10:51               ` Joe Jin
2010-01-20 11:06                 ` Jan Beulich
2010-01-20 11:45                   ` Joe Jin
2010-01-20 20:25                     ` Keir Fraser
2010-01-21  2:16                     ` Daniel Stodden
2010-01-21  3:13                       ` Joe Jin [this message]
2010-01-21  7:26                         ` Daniel Stodden
2010-01-21  7:49                           ` Joe Jin
2010-01-21 18:01                             ` Daniel Stodden

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=20100121031307.GA29727@joejin-pc.cn.oracle.com \
    --to=joe.jin@oracle.com \
    --cc=JBeulich@novell.com \
    --cc=Keir.Fraser@eu.citrix.com \
    --cc=daniel.stodden@citrix.com \
    --cc=deepak.patel@oracle.com \
    --cc=greg.marsden@oracle.com \
    --cc=xen-devel@lists.xensource.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;
as well as URLs for NNTP newsgroup(s).