On 02/21/2012 03:35 PM, Candid Shot wrote: > (I hope this list is the right place to ask SG Driver related question ..) > > Background: A FC cable-pull is simulated by disabling the FC switch (Brocade) port. > > > While /sys/class/fc_host/hostx/port_state might confirm the FC connectivity is missing, > > /proc/scsi/sg/devices will show the scsi device to be 'online'. > > My goal is to be able to return an error to the application, should a cable-pull happen. > > Is there a way to be able to tweak this behavior where the scsi driver is able to look at port events, > and possibly return errors during read/write operations? You can listen on the fc scsi netlink socket for fc_host_event_code. You get values like: { FCH_EVT_LIP, "lip" }, { FCH_EVT_LINKUP, "link_up" }, { FCH_EVT_LINKDOWN, "link_down" }, { FCH_EVT_LIPRESET, "lip_reset" }, { FCH_EVT_RSCN, "rscn" }, { FCH_EVT_ADAPTER_CHANGE, "adapter_chg" }, { FCH_EVT_PORT_UNKNOWN, "port_unknown" }, { FCH_EVT_PORT_ONLINE, "port_online" }, { FCH_EVT_PORT_OFFLINE, "port_offline" }, { FCH_EVT_PORT_FABRIC, "port_fabric" }, { FCH_EVT_LINK_UNKNOWN, "link_unknown" }, { FCH_EVT_VENDOR_UNIQUE, "vendor_unique" }, -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html