Re: [PATCH 4/4][diskdump] x86-64 support

From: Christoph Hellwig
Date: Sat Aug 28 2004 - 05:32:18 EST


On Sat, Aug 28, 2004 at 06:48:11PM +0900, Takao Indoh wrote:
> +/*
> + * Dump stuff...
> + */
> +#include <linux/diskdump.h>
> +
> +#define MPT_HOST_LOCK(host_lock) \
> + if (crashdump_mode()) \
> + spin_lock(host_lock); \
> + else \
> + spin_lock_irq(host_lock);
> +
> +#define MPT_HOST_UNLOCK(host_lock) \
> + if (crashdump_mode()) \
> + spin_unlock(host_lock); \
> + else \
> + spin_unlock_irq(host_lock);
> +

Please stop this macro madness. Why can't you simply use
spin+lock_irqsave?

> +mptscsih_sanity_check(struct scsi_device *sdev)
> +{
> + MPT_ADAPTER *ioc;
> + MPT_SCSI_HOST *hd;
> +
> + hd = (MPT_SCSI_HOST *) sdev->host->hostdata;
> + if (!hd)
> + return -ENXIO;
> + ioc = hd->ioc;
> +
> + /* message frame freeQ is busy */
> + if (spin_is_locked(&ioc->FreeQlock))
> + return -EBUSY;

As in the scsi code spin_is_locked checks are bogus and racy. Only
a spin_trylock would be safe. hd can't be NULL.

-
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/