Re: [PATCH 2.6.31-rc4] gigaset: really fix chars_in_buffer

From: Tilman Schmidt
Date: Sat Aug 01 2009 - 19:38:20 EST


Hi Alan,

thanks a lot for getting in contact with me, and for your
explanation of the rationale behind your patch.

On Sat, 1 Aug 2009 17:11:41 +0100, Alan Cox wrote:
> Is that correct. If you take a signal so the mutex_lock_interruptible
> takes the error path we'll exit any waits for characters to be flushed
> from buffers and lose the bytes in some cases ?

You are right. I'll have to change it to use non-interruptible
mutex_lock. I'll prepare a new patch.

> Thats why I didn't
> convert it - I didn't understand why it was using _interruptible at all ?

No specific reason. just the general rule to prefer sleeping
interuptibly whenever possible, because unkillable processes are
so annoying. Seeing that chars_in_buffer was declared as returning
int, I assumed (wrongly as it now turns out) that it would be
allowed to return the customary negative values for errors, so
that it could use the _interruptible variant. When I saw your
patch I read into it that zero would be the appropriate return
value for all error cases, including a signal while waiting for
the mutex. I guess there was a bit of wishful thinking in that.

Well, thanks again for your help. I'll follow up with a revised
patch.

Regards,
Tilman

--
Tilman Schmidt E-Mail: tilman@xxxxxxx
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)

Attachment: signature.asc
Description: OpenPGP digital signature