Possible bug in ata-disk.c

From: Grzegorz Bernacki <gjb_at_semihalf.com>
Date: Fri, 11 Dec 2009 15:10:06 +0100
Hi,

I've looked over ATA code and I've noticed that setting
DISKFLAG_CANDELETE big in disk->d_flags clears DISKFLAGS_CANFLUSHCAHCE
bit if it was set. Below is the patch.

--- a/sys/dev/ata/ata-disk.c
+++ b/sys/dev/ata/ata-disk.c
_at__at_ -133,11 +133,11 _at__at_ ad_attach(device_t dev)
      adp->disk->d_unit = device_get_unit(dev);
      if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE)
         adp->disk->d_flags = DISKFLAG_CANFLUSHCACHE;
      if ((atadev->param.support.command2 & ATA_SUPPORT_CFA) ||
         atadev->param.config == ATA_PROTO_CFA)
-       adp->disk->d_flags |= DISKFLAG_CANDELETE;
+       adp->disk->d_flags = DISKFLAG_CANDELETE;
      snprintf(adp->disk->d_ident, sizeof(adp->disk->d_ident), "ad:%s",
         atadev->param.serial);
      disk_create(adp->disk, DISK_VERSION);
      device_add_child(dev, "subdisk", device_get_unit(dev));
      ad_firmware_geom_adjust(dev, adp->disk);

regards,
Grzesiek
Received on Fri Dec 11 2009 - 13:10:43 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:59 UTC