public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: Mike Christie <michaelc@cs.wisc.edu>
Cc: "James.Bottomley@suse.de" <James.Bottomley@suse.de>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Bhanu Prakash Gollapudi <bprakash@broadcom.com>,
	"Zou, Yi" <yi.zou@intel.com>
Subject: Re: [PATCH 20/28] libfcoe: add implementation to support fcoe transport
Date: Wed, 02 Feb 2011 18:13:52 -0800	[thread overview]
Message-ID: <1296699232.1683.12.camel@fritz> (raw)
In-Reply-To: <4D48FD2E.1000307@cs.wisc.edu>

On Tue, 2011-02-01 at 22:43 -0800, Mike Christie wrote:
> On 01/28/2011 06:04 PM, Robert Love wrote:
> > +static int fcoe_transport_create(const char *buffer, struct kernel_param *kp)
> > +{
> > +	int rc = -ENODEV;
> > +	struct net_device *netdev = NULL;
> > +	struct fcoe_transport *ft = NULL;
> > +	enum fip_state fip_mode = (enum fip_state)(long)kp->arg;
> > +
> > +	if (!mutex_trylock(&ft_mutex))
> > +		return restart_syscall();
> 
> I was just wondering what is the reason for this. I see it in other 
> network related sysfs code but no where else. Is there some networky reason?

I think this may be unnecessary. We initially added a rtnl_trylock in
fcoe_create/destroy (fcoe.ko's sysfs entry-points) with change
34ce27bcf96f5f366e1fa8c4729ffc8a55de4cc3. I cannot think of a good
reason why this is a mutex_trylock/restart_syscall and not just a simple
mutex_lock.

> 
> > +
> > +#ifdef CONFIG_LIBFCOE_MODULE
> > +	/*
> > +	 * Make sure the module has been initialized, and is not about to be
> > +	 * removed.  Module parameter sysfs files are writable before the
> > +	 * module_init function is called and after module_exit.
> > +	 */
> > +	if (THIS_MODULE->state != MODULE_STATE_LIVE)
> > +		goto out_nodev;
> > +#endif
> 
> It seems that this would be a problem for every driver that uses module 
> params. Should the module code be getting a module refcount or doing 
> this test?

I think the problem is that the sysfs entries are created and are
writable before the module is truly initialized, so we could start using
uninitialized variables. It looks like a global solution would be to not
add sysfs files (or at least don't make them writable) until the module
initialization has completed. I have no idea how feasible this is.

//Rob


  reply	other threads:[~2011-02-03  2:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-29  0:03 [PATCH 00/28] libfc/libfcoe/fcoe updates for scsi-misc (2.6.39) Robert Love
2011-01-29  0:03 ` [PATCH 01/28] libfc: always initialize the FCoE DDP exchange id for fsp as FC_XID_UNKNOWN Robert Love
2011-01-29  0:03 ` [PATCH 02/28] libfc: Return a valid return code in fc_fcp_pkt_abort() Robert Love
2011-01-29  0:03 ` [PATCH 03/28] libfc: Cleanup return paths in fc_rport_error_retry Robert Love
2011-01-29  0:03 ` [PATCH 04/28] libfc: dereferencing ERR_PTR in fc_tm_done() Robert Love
2011-01-29  0:03 ` [PATCH 05/28] fnic: fix memory leak Robert Love
2011-01-29  0:03 ` [PATCH 06/28] fnic: Bumping up fnic version from 1.4.0.145 to 1.5.0.1 Robert Love
2011-01-29  0:03 ` [PATCH 07/28] fcoe: Fix module reference count for vports Robert Love
2011-01-29  0:03 ` [PATCH 08/28] fcoe: drop FCoE LOGO in FIP mode Robert Love
2011-01-29  0:03 ` [PATCH 09/28] libfc: fix sparse static and non-ANSI warnings Robert Love
2011-01-29  0:04 ` [PATCH 10/28] libfc: add hook for FC-4 provider registration Robert Love
2011-01-29  0:04 ` [PATCH 11/28] libfc: add method for setting handler for incoming exchange Robert Love
2011-01-29  0:04 ` [PATCH 12/28] libfc: add local port hook for provider session lookup Robert Love
2011-01-29  0:04 ` [PATCH 13/28] libfc: add hook to notify providers of local port changes Robert Love
2011-01-29  0:04 ` [PATCH 14/28] libfc: use PRLI hook to get parameters when sending outgoing PRLI Robert Love
2011-01-29  0:04 ` [PATCH 15/28] libfc: Remove usage of the Scsi_Host's host_lock Robert Love
2011-01-29  0:04 ` [PATCH 16/28] libfc: export seq_release() for users of seq_assign() Robert Love
2011-01-29  0:04 ` [PATCH 17/28] libfc: Enhanced exchange ID selection mechanism and fix related EMA selection logic Robert Love
2011-01-29  0:04 ` [PATCH 18/28] libfcoe: move logging macros into the local libfcoe.h header file Robert Love
2011-01-29  0:04 ` [PATCH 19/28] libfcoe: add fcoe_transport structure defines to include/scsi/libfcoe.h Robert Love
2011-01-29  0:04 ` [PATCH 20/28] libfcoe: add implementation to support fcoe transport Robert Love
2011-02-02  6:43   ` Mike Christie
2011-02-03  2:13     ` Robert Love [this message]
2011-01-29  0:05 ` [PATCH 21/28] libfcoe: rename libfcoe.c to fcoe_cltr.c for the coming fcoe_transport.c Robert Love
2011-01-29  0:05 ` [PATCH 22/28] libfcoe: include fcoe_transport.c into kernel libfcoe module Robert Love
2011-01-29  0:05 ` [PATCH 23/28] fcoe: prepare fcoe for using fcoe transport Robert Love
2011-01-29  0:05 ` [PATCH 24/28] fcoe: convert fcoe.ko to become an fcoe transport provider driver Robert Love
2011-01-29  0:05 ` [PATCH 25/28] libfc: Extending lport's roles for target if there is a registered target Robert Love
2011-01-29  0:05 ` [PATCH 26/28] libfc: introduce LLD event callback Robert Love
2011-01-29  0:05 ` [PATCH 27/28] fcoe: use dedicated workqueue instead of system_wq Robert Love
2011-01-29  0:05 ` [PATCH 28/28] libfcoe: Move common code from fcoe to libfcoe module Robert Love

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=1296699232.1683.12.camel@fritz \
    --to=robert.w.love@intel.com \
    --cc=James.Bottomley@suse.de \
    --cc=bprakash@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=yi.zou@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