[dm-devel] Probably unnecessary spinlock in dm.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> static inline void dec_pending(struct dm_io *io, int error)
> {
>     static spinlock_t _uptodate_lock = SPIN_LOCK_UNLOCKED;
>     unsigned long flags;
>
>     if (error) {
>         spin_lock_irqsave(&_uptodate_lock, flags);
>         io->error = error;
>         spin_unlock_irqrestore(&_uptodate_lock, flags);
>     }

I think this spinlock is unnecessary. Yes, there can be a race, but it
doesn't matter. If there are two threads racing for io->error, what
happens? io->error will be non-null.

There are other places in the kernel where racing is explicitly allowed
in order to save a spinlock. We don't even have to take additional care
in this case.





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux