[stgt] Write-cache in tgtd during a target-host crash

ronnie sahlberg ronniesahlberg at gmail.com
Thu Apr 22 00:04:20 CEST 2010


I think one should only be able to set a subset of the flags and have
other flags such as O_RDWR and O_LARGEFILE
always be set.

Otherwise someone might try to create a readonly lun by setting
O_RDONLY instead of O_RDWR and while it will not be possible to write
to the LUN, this would break on the initiator side since true readonly
would require a bit more than failing to write. (such as different
data in mode sense as well as specific sense codes when refusing a
write)


regards
ronnie sahlberg

On Thu, Apr 22, 2010 at 7:44 AM, Mike Anderson
<andmike at linux.vnet.ibm.com> wrote:
> Chandra Seetharaman <sekharan at us.ibm.com> wrote:
>>
>> On Wed, 2010-04-21 at 19:51 +1000, ronnie sahlberg wrote:
>> >
>> >
>> > Tomo, would a patch that allows setting the O_DIRECT/O_SYNC flags on
>> > the command line when invoking tgtd be acceptable?
>> >
>> >
>> >
>> >
>> > tgtd -o O_SYNC     tgtd -o O_DIRECT      tgtd -o O_SYNC|O_DIRECT
>> >
>> >
>> >
>> > The appropriate flags in the caching mode page could be intercepted
>> > and use to toggle these fd settings.
>> >
>> > My filesystem of choice would likely benefit greatly from O_DIRECT.
>>
>> I see the feature being useful.
>>
>> But, I would associate this to be a characteristic of the backing store
>> than set it globally at tgtd (or we can have a it at global(read tgtd
>> level) and ability to revert it at the backing store).
>> >
>
> If we associate the open flags to the backing store would we want to allow
> full control of the open flags or just setting a subset of flags.
>
> I hacked up tgtadm and a few of the target.c functions for the examples below.
>
> ./tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /disk1
> --bsoflags "O_RDWR| O_LARGEFILE | O_DIRECT" --device-type disk
>
> or
>
> tgtadm --op update --mode logicalunit --tid 1 --lun 1 --params bsoflags="O_RDWR| O_LARGEFILE | O_DIRECT"
>
> ./tgtadm --op show --mode target
> ...
>      LUN: 1
>            Type: disk
>            SCSI ID: IET     00010001
>            SCSI SN: beaf11
>            Size: 105 MB
>            Online: Yes
>            Removable media: No
>            Backing store type: rdwr
>            Backing store flags: O_RDWR | O_LARGEFILE | O_DIRECT
>            Backing store path: /disk1
> ...
>
> -andmike
> --
> Michael Anderson
> andmike at linux.vnet.ibm.com
>
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list