Changing Interrupt Priority in custom driver

Hello,

I have a custom PCIe driver. It has one interrupt attached to the PCI interrupt. I am having a problem where my user application can call an IOCTL and it will preempt the ISR and cause major issues. I have band aids around the problem, like make the IOCTL request wait for the ISR finish or for the IOCTL request to come less frequently. But what I really want to understand is, why the IOCTL can interrupt my ISR in the first place? Can I make the ISR a higher priority then the IOCTL so that I don’t have to worry about this?

Thanks for your help,
Brandy

static int _probe(struct pci_dev *pdev, const struct pci_device_id *ent) {
  //...
    emsi = pci_enable_msi(gDev);

    // Get IRQ from pci_dev structure. It may have been remapped by the kernel,
    // and this value will be the correct one.
    gIrq = gDev->irq;

ret = request_irq(gIrq, (irq_handler_t) IRQHandler, IRQF_SHARED, gDrvrName, gDev);
    if (ret) {
        printk(KERN_WARNING"%s: Init: Unable to allocate IRQ: %d\n", gDrvrName, ret);
        return (CRIT_ERR);
    }
 //...
}

irq_handler_t IRQHandler(int irq, void *dev_id, struct pt_regs *regs) {

    spin_lock_irqsave(&irqlock, irqflags);

    intr_state = INTR_STARTED;

//// DO STUFF!!

    intr_state = INTR_FINISHED;
    spin_unlock_irqrestore(&irqlock, irqflags);

    return (irq_handler_t) IRQ_HANDLED;

}