intercept IRP_MN_QUERY_ID

Hi all
How can I intercept IRP_MN_QUERY_ID to a disk? I tried with disk lower filter but failed. If I use a SCSIAdapter upper filter driver, there will be a problem of attaching to the disks steadily. When I find a disk exists in completion routine of IRP_MN_QUERY_DEVICE_RELATIONS(BusRelations) I will attach that disk and when missing in BusRelations dettach the disk. But it seems there will be no IRP_MN_QUERY_DEVICE_RELATIONS when update disk’s driver and my device will be dettached, so when the IRP_MN_QUERY_DEVICE_RELATIONS is recieved later and I attach the disk again my device is in the wrong place of device stack(above partmgr).

Any help will be grateful, thanks.