lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 6 Mar 2012 23:08:57 +0530
From:	Amit Sahrawat <amit.sahrawat83@...il.com>
To:	James Bottomley <James.Bottomley@...senpartnership.com>
Cc:	Jeff Garzik <jgarzik@...ox.com>,
	Nam-Jae Jeon <namjae.jeon@...sung.com>,
	linux-ide@...r.kernel.org, linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Amit Sahrawat <a.sahrawat@...sung.com>
Subject: Re: [PATCH 2/2] scsi: retrieve cache mode using ATA_16 cmd if normal
 routine fails

Hi James,

Few queries relating to solution for this long pending problem.
As per your suggestions - it is clear - we cannot have this as part of
default routine to retrieve WCE using ATA - as for some USB HDD - it
will result in halting their operations.
So,
1) USB quirks -> i think this will only be a workaround for few USB
hard disks - wherein we can their add their entries in the quirks list
and control this WC. So, this wont be a solution which can be used as
part of a long term solution.
2) As part of 'sysfs' interface - there is already an array for
cache_types in sd.c - Can we make an entry in this array for "write
back(ata cmd)" and make corresponding changes - to reflect this when
we do " echo "write back(ata cmd) >
/sys/class/scsi_disk/<>/cache_type".
So, these changes won't be part of default routine - but this will
still need minor changes in sd.c - will those changes be acceptable?
sd_store_cache_type()->revalidate_disk()->sd_revalidate_disk()->sd_read_cache_type()

Please share your opinion to bring out a solution to this.

Thanks & Regards,
Amit Sahrawat

On Thu, Feb 16, 2012 at 6:58 PM, James Bottomley
<James.Bottomley@...senpartnership.com> wrote:
> On Thu, 2012-02-16 at 12:22 +0530, Amit Sahrawat wrote:
>
>> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
>> index c691fb5..3ca507a 100644
>> --- a/drivers/scsi/sd.c
>> +++ b/drivers/scsi/sd.c
>> @@ -50,6 +50,11 @@
>>  #include <linux/string_helpers.h>
>>  #include <linux/async.h>
>>  #include <linux/slab.h>
>> +
>> +#ifdef CONFIG_ATA
>> +#include <linux/libata.h>
>> +#endif
>> +
>>  #include <linux/pm_runtime.h>
>>  #include <asm/uaccess.h>
>>  #include <asm/unaligned.h>
>> @@ -2129,7 +2134,11 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
>>               if (modepage == 0x3F) {
>>                       sd_printk(KERN_ERR, sdkp, "No Caching mode page "
>>                                 "present\n");
>> +#ifdef CONFIG_ATA
>> +                     goto WCE_USING_ATA;
>> +#else
>>                       goto defaults;
>> +#endif
>>               } else if ((buffer[offset] & 0x3f) != modepage) {
>>                       sd_printk(KERN_ERR, sdkp, "Got wrong page\n");
>>                       goto defaults;
>> @@ -2149,6 +2158,15 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
>>                                 "Uses READ/WRITE(6), disabling FUA\n");
>>                       sdkp->DPOFUA = 0;
>>               }
>> +#ifdef CONFIG_ATA
>> +WCE_USING_ATA:
>> +             if (!sdp->removable && !sdkp->WCE) {
>> +                     sd_printk(KERN_NOTICE, sdkp, "Try to check write cache"
>> +                             " enable/disable using ATA command\n");
>> +                     sdkp->WCE = ata_get_cachestatus(sdp);
>> +             }
>> +#endif
>> +
>
> I already said before, this is a non starter: we can't randomly send
> SCSI encapsulated ATA commands to disks from sd.  What we can do is give
> you a WCE variable you can change on the fly in sysfs via whatever
> mechanism is most appropriate (but this would have to be a mechanism
> external to sd.c).
>
> Alternatively, you can co-opt the USB quirks handling to set it for you.
>
> James
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ