netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Radheka Godse <radheka.godse@intel.com>
Cc: netdev@oss.sgi.com
Subject: Re: [PATCH 2.6.13-rc1 8/17] bonding: SYSFS INTERFACE (large)
Date: Sat, 2 Jul 2005 01:13:46 -0700	[thread overview]
Message-ID: <20050702081346.GA20789@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0507011347060.17459@localhost.localdomain>

On Fri, Jul 01, 2005 at 01:48:44PM -0700, Radheka Godse wrote:
> This large patch adds the sysfs interface to channel bonding. It will
> allow users to add and remove bonds, add and remove slaves, and change
> all bonding parameters without using ifenslave.
> The ifenslave interface still works.

Have a short example of what the sysfs tree looks like, and what the new
files contain and expect to be written to?

> diff -urN -X dontdiff linux-2.6.12post/drivers/net/bonding/bonding.h 
> linux-2.6.12post-sysfs/drivers/net/bonding/bonding.h
> --- linux-2.6.12post/drivers/net/bonding/bonding.h	2005-06-28 
> 18:18:03.000000000 -0700

patch looks linewrapped :(

> +/* Bonding sysfs lock.  Why can't we just use the subsytem lock?

The subsystem lock is no more.  Well, it's still around, but almost no
one uses it, due to the klist changes.  You shouldn't need a lock
either now.

> + * Because kobject_register tries to acquire the subsystem lock.  If
> + * we already hold the lock (which we would if the user was creating
> + * a new bond through the sysfs interface), we deadlock.
> + */
> +
> +struct rw_semaphore bonding_rwsem;
> +
> +
> +
> +
> +/*------------------------------ Functions 
> --------------------------------*/
> +
> +/*
> + * "show" function for the bond_masters attribute.
> + * The class parameter is ignored.
> + */
> +static ssize_t bonding_show_bonds(struct class *cls, char *buffer)
> +{
> +	int res = 0;
> +	struct bonding *bond;
> +
> +	down_read(&(bonding_rwsem));
> +
> +	list_for_each_entry(bond, &bond_dev_list, bond_list) {
> +		res += sprintf(buffer + res, "%s ",
> +			       bond->dev->name);
> +		if (res > (PAGE_SIZE - IFNAMSIZ)) {
> +			dprintk("eek! too many bonds!\n");
> +			break;
> +		}
> +	}
> +	res += sprintf(buffer + res, "\n");
> +	res++;
> +	up_read(&(bonding_rwsem));
> +	return res;

This violates the 1-value-per-sysfs file rule.  Please fix this up.

> +static ssize_t bonding_show_slaves(struct class_device *cd, char *buf)
> +{
> +	struct slave *slave;
> +	int i, res = 0;
> +	struct bonding *bond = to_bond(cd);
> +
> +	down_read(&(bonding_rwsem));
> +
> +	read_lock_bh(&bond->lock);
> +	bond_for_each_slave(bond, slave, i) {
> +		res += sprintf(buf + res, "%s ", slave->dev->name);
> +		if (res > (PAGE_SIZE - IFNAMSIZ)) {
> +			dprintk("eek! too many slaves!\n");
> +			break;
> +		}
> +	}
> +	read_unlock_bh(&bond->lock);
> +	res += sprintf(buf + res, "\n");
> +        res++; 
> +	up_read(&(bonding_rwsem));
> +	return res;
> +}

Same sysfs violation.  I think other files also have problems :(

thanks,

greg k-h

  parent reply	other threads:[~2005-07-02  8:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-01 20:48 [PATCH 2.6.13-rc1 8/17] bonding: SYSFS INTERFACE (large) Radheka Godse
2005-07-02  5:30 ` Dmitry Torokhov
2005-07-06 18:37   ` Mitch Williams
2005-07-06 19:02     ` Stephen Hemminger
2005-07-06 19:09     ` Dmitry Torokhov
2005-07-07 23:32       ` Mitch Williams
2005-07-02  8:13 ` Greg KH [this message]
2005-07-06 18:53   ` Mitch Williams
2005-07-06 19:52     ` Greg KH
2005-07-07 14:25       ` John W. Linville
2005-07-07 23:06         ` Mitch Williams
2005-07-07 23:14           ` Greg KH
2005-07-08 21:14             ` Mitch Williams
2005-07-08 21:31               ` Greg KH

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=20050702081346.GA20789@kroah.com \
    --to=greg@kroah.com \
    --cc=netdev@oss.sgi.com \
    --cc=radheka.godse@intel.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).