Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Sep 2012 10:29:53 +0530
From:      Jack <jacks.1785@gmail.com>
To:        Alexander Motin <mav@freebsd.org>
Cc:        freebsd-drivers <freebsd-drivers@freebsd.org>
Subject:   Re: Exclusive access of SCSI/ATA devices from user space
Message-ID:  <CACmXQA2jmVTzgqgT=X4_GFLq6u%2BO3DZNYV1HRhyp6Jvkav=Ypg@mail.gmail.com>
In-Reply-To: <CACmXQA2W4CBeiBvAZ5xcMAxKDHqgjwk4CaxVidMPgD%2BT_biJmw@mail.gmail.com>
References:  <CACmXQA09W56rSvVrprD8cuAbZ3T7hFmFKmfREiyXGOZwfpH5=g@mail.gmail.com> <201209190825.07384.jhb@freebsd.org> <5059CC56.8040705@FreeBSD.org> <505B6D1B.7070506@FreeBSD.org> <CACmXQA2W4CBeiBvAZ5xcMAxKDHqgjwk4CaxVidMPgD%2BT_biJmw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 9/21/12, Jack <jacks.1785@gmail.com> wrote:

>
> Thanks Alexander. So, I only need to modify da/ada/sa drivers such
> that they do not attach themselves to the selected device. Then I will
> access the device via CAM pass driver.
>
> Is it possible that 2 different processes can access the same device
> via cam pass through driver?
>
> Actually there are 2 perspectives here, I'm talking about:
> (  Assume we have modified da/ada/sa drivers such that they do not
> attach themselves to the selected device, and utility is loaded in
> main memory. )
>
> a) While one processes is accessing the selected device via cam pass
> driver, is it possible for another process to access this same
> selected device via cam pass driver(it can't access through da/ada/sa
> drivers as they are not attached to the selected device rightnow). I'm
> trying to deactivate/disable simultaneous access to the selected
> device.
> 	
> b) Assume that none of the process is currently accessing the selected
> device. Is it possible that except my utility, none of the other
> userland  processes be able to access the selected device via cam pass
> driver(again, it can't access through da/ada/sa drivers), even if my
> utility is not accessing  the device  at this time. I mean, is there
> some kind of automatic or forced locking so that only utility process
> can access the selected device via CAM    passthrough driver.
>
> --
> Jack
>

It seems that I misunderstood your first post. I'm quoting it for reference.

>
> ... CAM does not restrict simultaneous access to the devices, so the same device can be
> accessed through both pass and da/ada drivers (or any other if they happen) at the same
> time. Usually it is not a problem because pass interface is used only by short list of tools,
> like ones for CD/DVD recording.
>

So, two or more processes can access the same device simultaneously,
via cam pass driver, or one via cam pass driver and other one via
block access, but two or more processes simultaneously can't access
same device via block interface - GEOM does controls concurrent device
access.

Now is it possible that we can restrict access to a pass device solely
to a particular process(ie my utility), so that no other
process(neither simultaneously, nor at time when no other process is
accessing the selected device), would ever be able to access the
selected device via cam pass driver - e.g. some sort of lock on pass
device or something like that.

Assuming that da/ada/sa drivers are not attached to the selected
device, if it is possible to put the above mentioned restriction on
pass device, then the only process, that can access the selected
device will be the utility's process, and none else.

-- 
Jack



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACmXQA2jmVTzgqgT=X4_GFLq6u%2BO3DZNYV1HRhyp6Jvkav=Ypg>