All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Benny Halevy <bhalevy@panasas.com>,
	Mike Christie <michaelc@cs.wisc.edu>, Pete Wyckoff <pw@osc.edu>,
	Christoph Hellwig <hch@infradead.org>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	open-osd ml <osd-dev@open-osd.org>
Subject: Re: [RFC 03/14] osd_uld: OSD scsi ULD
Date: Wed, 06 Aug 2008 20:25:18 +0300	[thread overview]
Message-ID: <4899DE7E.9040601@panasas.com> (raw)
In-Reply-To: <1217193375.3503.31.camel@localhost.localdomain>

James Bottomley wrote:
> On Thu, 2008-07-24 at 20:47 +0300, Boaz Harrosh wrote:
>> Add a Linux driver module that registers as a SCSI ULD and probes for OSD type
>> SCSI devices.
>>
>> When an OSD-type SCSI device is found a character device is created in the form
>> of /dev/osdX - where X goes from 0 up to hard coded 64.
>> The Major character device number used is *232*, which is free (as of Linux
>> v2.6.27). The same Major was used by the old IBM initiator project.
>>
>> TODO: How to dynamically allocate a Major and have a /dev/osdX entry linked
>> to it? Do I need/should reserve the minor range in advance, if not how?
>>
>> A single ioctl is currently supported that will invoke an in-kernel test on
>> the specified OSD device (lun).
> 
> The first thing that immediately leaps to mind is are you sure this
> should be a character device?  Since it's only open/close/ioctl (as in
> no read/write) you could then use all the file bdev handling to get back
> to struct osd_device, plus you can bind to bsg (and SG_IO) which is
> unaccountably missing in this prototype.

AN OSD device is by no means a BLOCK device and it does not export any
such functionality per-se. It is a completely new SCSI command-set and
does not inherent any SCSI block functionality. Except these commands 
explicitly specified that allow the device probing and login(iscsi).

There is a provision to send standard SCSI commnds (READ/WRITE etc..)
to individual objects inside the OSD. But only after all proper 
administration and security was set for the device, partition, and 
object in question.

We have thought about emulating such a layer where once login into
an OSD device. a scan will look for all objects that, say, have an
"export-block-device" special user defined attribute, and will export
these as scsi-block devices, which lives inside OSD objects. This
way you can have over commits, OSD-security, data migration, raid and
all kind of fun stuff. Over an OSD grid. But people we ask did not
like it. and frankly we didn't either. So we are not going to do that.

So an OSD can be used for data storage but not in the traditional sense
there must be an higher layer that makes policy decisions on how a traditional
file system sits over an OSD device. But this is not the scope of this layer.
We have in our labs two such higher beasts that do that. One is the 
pNFS-objects that caries out policy governed by a network Object-based file
system, and initiates all the proper OSD commands to read/write etc .. to
OSD targets. And an osdfs from IBM that we have converted to use our
Initiator. These higher level layers will make policy decisions (break
some eggs) and will have to issue the right OSD commands in the proper
state, for flushing read/write create and all these things that they
need to take care of. At this layer of Initiator library we cannot know
all this because we don't set any policy.

So to answer your question It's a char device because that was the easiest
way for us to export a Kernel API for issuing test vectors to OSD targets.
Perhaps we could make a sysfs API to do the same thing.

> 
> The second observation is that refcounting in this driver is
> non-existent.  Doing a kfree(osd_dev) from osd_remove makes open device
> remove module do something else look to be a certain oops ... you can
> use the refcounting models of sd or st to see how this is done.
> 

I will look into this thanks

I have done some tests and I saw that as long as I have files open the
cdev will not die. and since I'm only removed when .remove is called by
the scsi-ml then I'm some how protect as long as I'm working. So it looks
like the system protects me from deletion while working. (Note that I only
have synchronous ioctl)

What I have not checked, is the coupling between the driver module, and it's 
open devices. I assumed the Kernel takes care of that as long as I have files
open on devices made by the driver, but apparently I was wrong.

> There's a convention that gendisk->private_data points to a pointer to
> the driver.  This was originally a viro clever trick to allow the
> private_data to store both the driver and the uld device (struct
> osd_dev).  I think we've dispensed with needing the driver, so perhaps
> this trick is unnecessary, but you'll need something similar to do
> refcounting properly.
> 

I'm not sure I understand what you mean. I only have a 
struct osd_uld_device allocated per scsi_device that holds pointers to
allocated resources that are freed when .remove is called on the 
associated scsi_device. I do not keep any driver information.

If you meant that when I'll do a refcounting I will need one then
I thought I will just keep a global counter and locks so I don't need
a pointer per se.

> Since OSDs are currently potentially removable spinning media with
> caches, it looks like you potentially also need locking control.  You
> might also need a shutdown method to cope with object flushing before
> power down.
> 

Again as explained above this is out of scope here. This is not a file 
system or block device that exports any data storage to users. Higher
level systems like osdfs or pNFS-objects layout driver will (do) take
care of that at the proper state. This here is just a library that exports
OSD command set, and a ULD that let you issue test vectors to an OSD target.

> Somehow the capacity has to be plumbed in (this also really makes them
> block devices not character devices).  It looks like the total capacity
> attribute of the root information attributes page would be appropriate
> for this.
> 

Again an higher level that actually knows these things does that, this
OSD-library does not make any policy decisions.

> The ioctl flow needs to be plumbed into scsi_ioctl() since the gendisk
> ULD will need to handle all the standard SCSI ioctls.
> 
Again not at this level

> You can't have 232 char as the major for this ... it's already assigned
> to biometric devices (although I think 232 block is free).  Whatever
> number you choose has to be requested through lanana and
> Documentation/device-list.txt updated accordingly.
> 

Sorry last I checked it was free, or perhaps I did not identify it
correctly. I'll fix that.

> (as you noted, TYPE_OSD has to be correctly in the global headers)
> 
> Please don't use sysfs_create_file (it can be racy and accident prone);
> just do the extra files as declared attributes of the osd class and let
> drivers/base handle all the setup/teardown  (sd is a good template).
> 

I will not, thanks. Though currently I don't have any planed and it is
all in comments. I will remove these comments for the final version.

> James
> 
> 

Sorry for the late response I was cut up into something else.

As I said in introductory email. I have no good use planed for
an OSD ULD. It is only used for sending test vectors to make 
sure changes work and there are no new regressions.
I do not know what is the policy for these things in Linux
Should it stay out-of-tree and risk bit-rot or it should be in-tree
but Kconfigured in such a way that distributions don't end up
putting it on CDs. Please advise.

Thank you very much for the review
Boaz

  reply	other threads:[~2008-08-06 17:26 UTC|newest]

Thread overview: 183+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <48876009.8010701@panasas.com>
2008-07-24 17:30 ` [RFC 00/14] open-osd: OSD Initiator library for Linux Boaz Harrosh
2008-07-24 17:40   ` [RFC 01/14] libosd: OSDv1 Headers Boaz Harrosh
2008-07-24 17:45   ` [RFC 02/14] libosd: OSDv1 preliminary implementation Boaz Harrosh
2008-07-24 17:47   ` [RFC 03/14] osd_uld: OSD scsi ULD Boaz Harrosh
2008-07-27 21:16     ` James Bottomley
2008-08-06 17:25       ` Boaz Harrosh [this message]
2008-07-24 17:49   ` [RFC 04/14] osd_ktests: Add basic OSD tests Boaz Harrosh
2008-07-24 17:51   ` [RFC 05/14] libosd: attributes Support Boaz Harrosh
2008-07-24 17:53   ` [RFC 06/14] osd_ktests: Test Attribute lists Boaz Harrosh
2008-07-24 17:54   ` [RFC 07/14] libosd: OSD Security processing stubs Boaz Harrosh
2008-07-24 17:55   ` [RFC 08/14] libosd: Add Flush and List-objects support Boaz Harrosh
2008-07-24 17:57   ` [RFC 09/14] libosd: Not implemented commands Boaz Harrosh
2008-07-24 17:58   ` [RFC 10/14] libosd: OSD version 2 Support Boaz Harrosh
2008-07-24 17:59   ` [RFC 11/14] osd_ktests: OSDv2 auto detection Boaz Harrosh
2008-07-24 18:00   ` [RFC 12/14] osd: Kconfig file for in-tree builds Boaz Harrosh
2008-07-24 18:02   ` [RFC 13/14] osd: Documentation for OSD library Boaz Harrosh
2008-07-24 18:03   ` [RFC 14/14] scsi: Add osd library to build system Boaz Harrosh
2008-11-04 16:09 ` [PATCHSET 00/18] open-osd: OSD Initiator library for Linux Boaz Harrosh
2008-11-04 16:09   ` Boaz Harrosh
2008-11-04 16:17   ` [PATCH 01/18] major.h: char-major number for OSD device driver Boaz Harrosh
2008-11-04 16:17     ` Boaz Harrosh
2008-11-26 17:33     ` [osd-dev] " Boaz Harrosh
2008-11-26 18:07       ` Randy Dunlap
2008-11-26 18:07         ` Randy Dunlap
2008-11-04 16:42   ` [PATCH 02/18] scsi: OSD_TYPE Boaz Harrosh
2008-11-04 16:42   ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 03/18] libosd: OSDv1 Headers Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 19:10     ` Andrew Morton
2008-11-04 19:42       ` Jörn Engel
2008-11-04 19:42         ` Jörn Engel
2008-11-04 20:29         ` Jörn Engel
2008-11-05 13:00         ` Boaz Harrosh
2008-11-05 13:00           ` Boaz Harrosh
2008-11-05 12:54       ` Boaz Harrosh
2008-11-05 12:54         ` Boaz Harrosh
2008-11-05 13:09         ` James Bottomley
2008-11-05 13:29           ` Boaz Harrosh
2008-11-09 14:52     ` [PATCH 03/18 ver2] " Boaz Harrosh
2008-11-09 14:52       ` Boaz Harrosh
2008-11-09 17:45       ` Jörn Engel
2008-11-09 17:45         ` Jörn Engel
2008-11-10  8:47         ` Boaz Harrosh
2008-11-10  8:47           ` Boaz Harrosh
2008-11-10 15:17           ` Jörn Engel
2008-11-10 15:17             ` Jörn Engel
2008-11-10 17:29       ` Randy Dunlap
2008-11-12 13:10         ` Boaz Harrosh
2008-11-12 13:10           ` Boaz Harrosh
2008-11-12 16:48           ` Randy Dunlap
2008-11-12 17:09             ` Boaz Harrosh
2008-11-12 17:15             ` Johannes Berg
2008-11-12 13:13         ` [PATCH 03/18 ver3] " Boaz Harrosh
2008-11-12 13:13           ` Boaz Harrosh
2008-11-12 18:59           ` Randy Dunlap
2008-11-13  9:38             ` Boaz Harrosh
2008-11-13 12:25             ` [PATCH 03/18 ver4] " Boaz Harrosh
2008-11-13 12:25               ` Boaz Harrosh
2008-11-13 18:16               ` Randy Dunlap
2008-11-13 15:41                 ` [osd-dev] " Benny Halevy
2008-11-04 16:44   ` [PATCH 04/18] libosd: OSDv1 preliminary implementation Boaz Harrosh
2008-11-04 16:44   ` Boaz Harrosh
2008-11-04 18:03     ` Sam Ravnborg
2008-11-05 13:12       ` Boaz Harrosh
2008-11-09 14:55         ` [osd-dev] " Boaz Harrosh
2008-11-10  5:37           ` Randy Dunlap
2008-11-10  9:00             ` Boaz Harrosh
2008-11-05 16:39       ` [Patch] Always include <linux/types.h> Jörn Engel
2008-11-05 17:23         ` Alexey Dobriyan
2008-11-05 19:16           ` Jörn Engel
2008-11-05 19:48             ` Andreas Schwab
2008-11-05 20:02             ` Jörn Engel
2008-11-05 20:32               ` Alexey Dobriyan
2008-11-07  8:02                 ` Jörn Engel
2008-11-05 20:20             ` Alexey Dobriyan
2008-11-05 17:48         ` Boaz Harrosh
2008-11-04 19:16     ` [PATCH 04/18] libosd: OSDv1 preliminary implementation Andrew Morton
2008-11-05 13:44       ` Boaz Harrosh
2008-11-09 14:50     ` [PATCH 04/18 ver2] " Boaz Harrosh
2008-11-04 16:44   ` [PATCH 05/18] osd_uld: OSD scsi ULD Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 06/18] osd_uld: API for retrieving osd devices from Kernel Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 07/18] osd_test: User-mode application to run the OSD tests Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 08/18] osd_ktests: Add basic " Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 09/18] libosd: attributes Support Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 10/18] osd_ktests: Test Attribute lists Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 11/18] libosd: OSD Security processing stubs Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 12/18] libosd: Add Flush and List-objects support Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 13/18] libosd: Not implemented commands Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 14/18] libosd: OSD version 2 Support Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 15/18] libosd: OSDv2 auto detection Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 16/18] osd: Documentation for OSD library Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 17/18] osd: Kconfig file for in-tree builds Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 16:44   ` [PATCH 18/18] scsi: Add osd library to build system Boaz Harrosh
2008-11-04 16:44     ` Boaz Harrosh
2008-11-04 19:19   ` [PATCHSET 00/18] open-osd: OSD Initiator library for Linux Andrew Morton
2008-11-05 13:56     ` Boaz Harrosh
2008-11-09 14:58     ` Boaz Harrosh
2008-11-09 23:26       ` Stephen Rothwell
2008-11-10 12:52         ` Boaz Harrosh
2008-11-10 13:04           ` Stephen Rothwell
2008-12-22 12:32 ` Boaz Harrosh
2008-12-22 12:32   ` Boaz Harrosh
2008-12-22 12:37   ` [PATCH 01/18] major.h: char-major number for OSD device driver Boaz Harrosh
2008-12-22 12:37     ` Boaz Harrosh
2008-12-22 12:39   ` [PATCH 02/18] scsi: OSD_TYPE Boaz Harrosh
2008-12-22 12:39     ` Boaz Harrosh
2008-12-22 12:41   ` [PATCH 03/18] libosd: OSDv1 Headers Boaz Harrosh
2008-12-22 12:41     ` Boaz Harrosh
2008-12-22 12:43   ` [PATCH 04/18] libosd: OSDv1 preliminary implementation Boaz Harrosh
2008-12-22 12:43     ` Boaz Harrosh
2008-12-22 12:46   ` [PATCH 05/18] osd_uld: OSD scsi ULD Boaz Harrosh
2008-12-22 12:46     ` Boaz Harrosh
2008-12-22 12:49   ` [PATCH 06/18] osd_uld: API for retrieving osd devices from Kernel Boaz Harrosh
2008-12-22 12:49     ` Boaz Harrosh
2008-12-22 12:51   ` [PATCH 07/18] osd_ktests: Add basic OSD tests Boaz Harrosh
2008-12-22 12:51     ` Boaz Harrosh
2008-12-22 12:55   ` [PATCH 08/18] libosd: attributes Support Boaz Harrosh
2008-12-22 12:55     ` Boaz Harrosh
2008-12-22 12:57   ` [PATCH 09/18] osd_ktests: Test Attribute lists Boaz Harrosh
2008-12-22 12:57     ` Boaz Harrosh
2008-12-22 13:00   ` [PATCH 10/18] libosd: OSD Security processing stubs Boaz Harrosh
2008-12-22 13:00     ` Boaz Harrosh
2008-12-22 13:02   ` [PATCH 11/18] libosd: Add Flush and List-objects support Boaz Harrosh
2008-12-22 13:02     ` Boaz Harrosh
2008-12-22 13:04   ` [PATCH 12/18] libosd: Not implemented commands Boaz Harrosh
2008-12-22 13:04     ` Boaz Harrosh
2008-12-22 13:07   ` [PATCH 13/18] libosd: OSD version 2 Support Boaz Harrosh
2008-12-22 13:07     ` Boaz Harrosh
2008-12-22 13:09   ` [PATCH 14/18] libosd: OSDv2 auto detection Boaz Harrosh
2008-12-22 13:09     ` Boaz Harrosh
2008-12-22 13:13   ` [PATCH 15/18] libosd: SCSI/OSD Sense decoding support Boaz Harrosh
2008-12-22 13:13     ` Boaz Harrosh
2008-12-22 13:16   ` [PATCH 16/18] osd: Documentation for OSD library Boaz Harrosh
2008-12-22 13:16     ` Boaz Harrosh
2008-12-22 13:18   ` [PATCH 17/18] osd: Kconfig file for in-tree builds Boaz Harrosh
2008-12-22 13:18     ` Boaz Harrosh
2008-12-22 13:20   ` [PATCH 18/18] scsi: Add osd library to build system Boaz Harrosh
2008-12-22 13:20     ` Boaz Harrosh
2009-01-06 14:04 ` [PATCHSET 00/18] open-osd: OSD Initiator library for 2.6.29 Boaz Harrosh
2009-01-06 14:07   ` [PATCH 01/18] major.h: char-major number for OSD device driver Boaz Harrosh
2009-01-06 14:10   ` [PATCH 02/18] scsi: OSD_TYPE Boaz Harrosh
2009-01-06 14:11   ` [PATCH 03/18] libosd: OSDv1 Headers Boaz Harrosh
2009-01-06 14:13   ` [PATCH 04/18] libosd: OSDv1 preliminary implementation Boaz Harrosh
2009-01-06 14:14   ` [PATCH 05/18] osd_uld: OSD scsi ULD Boaz Harrosh
2009-01-06 16:47     ` [PATCH ver2 05/16] " Boaz Harrosh
2009-01-06 14:16   ` [PATCH 06/18] osd_uld: API for retrieving osd devices from Kernel Boaz Harrosh
2009-01-06 14:17   ` [PATCH 07/18] osd_ktests: Add basic OSD tests Boaz Harrosh
2009-01-06 14:42     ` FUJITA Tomonori
2009-01-06 14:56       ` Boaz Harrosh
2009-01-06 15:12         ` FUJITA Tomonori
2009-01-06 15:49           ` Boaz Harrosh
2009-01-06 16:58             ` FUJITA Tomonori
2009-01-06 17:04               ` Boaz Harrosh
2009-01-06 16:49     ` Boaz Harrosh
2009-01-06 14:19   ` [PATCH 08/18] libosd: attributes Support Boaz Harrosh
2009-01-06 14:20   ` [PATCH 09/18] osd_ktests: Test Attribute lists Boaz Harrosh
2009-01-06 16:50     ` Boaz Harrosh
2009-01-06 14:21   ` [PATCH 10/18] libosd: OSD Security processing stubs Boaz Harrosh
2009-01-06 14:23   ` [PATCH 11/18] libosd: Add Flush and List-objects support Boaz Harrosh
2009-01-06 14:24   ` [PATCH 12/18] libosd: Not implemented commands Boaz Harrosh
2009-01-06 14:25   ` [PATCH 13/18] libosd: OSD version 2 Support Boaz Harrosh
2009-01-06 14:27   ` [PATCH 14/18] libosd: OSDv2 auto detection Boaz Harrosh
2009-01-06 14:29   ` [PATCH 15/18] libosd: SCSI/OSD Sense decoding support Boaz Harrosh
2009-01-06 14:31   ` [PATCH 16/18] osd: Documentation for OSD library Boaz Harrosh
2009-01-06 14:32   ` [PATCH 17/18] osd: Kconfig file for in-tree builds Boaz Harrosh
2009-01-06 17:40     ` Randy Dunlap
2009-01-07  8:48       ` Boaz Harrosh
2009-01-07 17:10         ` Randy Dunlap
2009-01-07  8:53       ` [PATCH ver2 15/16] " Boaz Harrosh
2009-01-06 14:34   ` [PATCH 18/18] scsi: Add osd library to build system Boaz Harrosh

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=4899DE7E.9040601@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bhalevy@panasas.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=hch@infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=osd-dev@open-osd.org \
    --cc=pw@osc.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 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.