Re: [PATCH 1/3] PCI: vpd handle longer delays in access

From: Matthew Wilcox
Date: Fri Sep 05 2008 - 08:41:19 EST


On Thu, Sep 04, 2008 at 01:56:37PM -0700, Stephen Hemminger wrote:
> - udelay(10);
> + if (signal_pending(current))
> + return -EINTR;

If you're going to use _killable instead of _interruptible, this needs
to be fatal_signal_pending(). Otherwise the one who owns the lock can
be interrupted by _any_ signal while those waiting for the lock can only
be interrupted by fatal signals. Which seems daft to me.

> - spin_lock_irq(&vpd->lock);
> + ret = mutex_lock_killable(&vpd->lock);
> + if (ret)
> + return ret;

What's wrong with the shorter:

if (mutex_lock_killable(&vpd->lock))
return -EINTR;
?

The actual error is irrelevant here since userspace will never consume it.

(I agree with Peter about use of yield())

--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/