linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Matthew Wilcox <matthew@wil.cx>
Cc: Greg KH <greg@kroah.com>, Joel Becker <joel.becker@oracle.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	"Linux-iSCSI.org Target Dev"
	<linux-iscsi-target-dev@googlegroups.com>,
	SCST-Devel <scst-devel@lists.sourceforge.net>,
	Alan Stern <stern@rowland.harvard.edu>,
	Andrew Morton <akpm@osdl.org>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH] [ConfigFS]: Allow symbolic links from a SysFS struct kobject source.
Date: Fri, 17 Oct 2008 12:02:07 -0700	[thread overview]
Message-ID: <1224270127.5556.331.camel@haakon2.linux-iscsi.org> (raw)
In-Reply-To: <20081017113252.GV15064@parisc-linux.org>

On Fri, 2008-10-17 at 05:32 -0600, Matthew Wilcox wrote:
> On Fri, Oct 17, 2008 at 01:22:18AM -0700, Nicholas A. Bellinger wrote:
> > This of course means that non TYPE_DISK of struct scsi_device would need
> > to appear under /sys/ to be referenced using the symlink method..  I
> > know that drivers/scsi/sr.c currently does not show up under /sys..
> 
> Hmm?
> 
> $ ls -l /sys/block/sr0/
> total 0
> lrwxrwxrwx 1 root root    0 2008-10-17 07:30 bdi -> ../../class/bdi/11:0
> -r--r--r-- 1 root root 4096 2008-10-17 07:30 capability
> -r--r--r-- 1 root root 4096 2008-10-17 07:30 dev
> lrwxrwxrwx 1 root root    0 2008-10-17 07:30 device -> ../../devices/pci0000:00/0000:00:1f.1/host3/target3:0:0/3:0:0:0
> drwxr-xr-x 2 root root    0 2008-10-17 07:30 holders
> drwxr-xr-x 2 root root    0 2008-10-17 07:30 power
> drwxr-xr-x 3 root root    0 2008-10-17 07:30 queue
> -r--r--r-- 1 root root 4096 2008-10-17 07:30 range
> -r--r--r-- 1 root root 4096 2008-10-17 07:30 removable
> -r--r--r-- 1 root root 4096 2008-10-17 07:30 ro
> -r--r--r-- 1 root root 4096 2008-10-17 07:30 size
> drwxr-xr-x 2 root root    0 2008-10-17 07:30 slaves
> -r--r--r-- 1 root root 4096 2008-10-17 07:30 stat
> lrwxrwxrwx 1 root root    0 2008-10-17 07:30 subsystem -> ../../block
> -rw-r--r-- 1 root root 4096 2008-10-17 07:30 uevent
> 

Oh good, I guess I missed that this has been added a while ago for
TYPE_CDROM.  I had been looking at trying to change something with sr0 a
while back, I think it was an incorrectly set max_sectors on the
Playstation3, but I could not find the was to do this with TYPE_CDROM as
is possible with TYPE_DISK.

So now that those two work, what about other SCSI device types that
appear as character devices?  The most obvious ones that come to mind
are TYPE_MEDIUM_CHANGER and TYPE_TAPE.  As they do not appear
under /sys/block, to enable the SCSI passthrough for target_core_mod
using symlinks from sysfs -> configfs using the patch, the sysfs source
needs to point to struct device..  For example, with the current code,
the export of sr0 would now look like:

# Enable sr0 for DVD target passthrough access
mkdir $TARGET/core/pscsi_0/dvd_rom
ln -s /sys/block/sr0/device $TARGET/core/pscsi_0/dvd_rom/dvd_passthrough

So what about for TYPE_TYPE..?  I am guessing you would need to grab the
struct device (to reference the struct scsi_device by struct kobject
using the configfs patch) through /sys/class/$SCSI_HCTL/device, for the
SCSI passthrough case, right..?

# Also enable a SCSI tape for target passthrough access..?
mkdir $TARGET/core/pscsi_1/my_superturbotapearray
ln -s /sys/class/1:0:0:0/device $TARGET/core/pscsi_1/my_superturbotapearray/tape_passthrough

# MEDIUM_CHANGER too..?
mkdir $TARGET/core/pscsi_1/my_superturbomc
ln -s /sys/class/1:0:1:0/device $TARGET/core/pscsi_1/my_superturbomc/mc_passthrough

I don't have real MEDIUM_CHANGER onsite, so if anyone wanted to test
this with my current patches in lio-core-2.6.git please let me know.
I will try hooking up my old SCSI tape drive this weekend and see if
TYPE_TAPE works. :-)

The idea is through the change to allow sysfs source symlinks (the patch
still needs to handle follow_link() correctly) to pass any struct
kobject through the configfs struct config_item_operations API while
calling kobject_get() and kobject_put() to protect/release the reference
to struct kobject inside of fs/configfs/symlink.c.

--nab


  reply	other threads:[~2008-10-17 19:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-17  6:55 [PATCH] [ConfigFS]: Allow symbolic links from a SysFS struct kobject source Nicholas A. Bellinger
2008-10-17  7:44 ` Greg KH
2008-10-17  8:22   ` Nicholas A. Bellinger
2008-10-17 11:32     ` Matthew Wilcox
2008-10-17 19:02       ` Nicholas A. Bellinger [this message]
2008-10-17 17:39     ` Greg KH
2008-10-17 19:19       ` Nicholas A. Bellinger
2008-10-17 20:10         ` Greg KH
2008-10-18  2:41           ` Nicholas A. Bellinger
2008-10-17 19:48     ` Joel Becker
2008-10-17 20:03       ` Nicholas A. Bellinger
2008-10-17 20:07       ` Nicholas A. Bellinger
2008-10-17 19:39 ` Joel Becker
2008-10-17 19:50   ` Nicholas A. Bellinger

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=1224270127.5556.331.camel@haakon2.linux-iscsi.org \
    --to=nab@linux-iscsi.org \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=hch@infradead.org \
    --cc=joel.becker@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-iscsi-target-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=scst-devel@lists.sourceforge.net \
    --cc=stern@rowland.harvard.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 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).