linux/scripts/coccinelle
Kirill Smelkov 0c4ab18fc3 coccinelle: api/stream_open: treat all wait_.*() calls as blocking
Previously steam_open.cocci was treating only wait_event_.* - e.g.
wait_event_interruptible - as a blocking operation. However e.g.
wait_for_completion_interruptible is also blocking, and so from this
point of view it would be more logical to treat all wait_.* as a
blocking point.

The logic of this change actually came up for real when
drivers/pci/switch/switchtec.c changed from using
wait_event_interruptible to wait_for_completion_interruptible:

	https://lore.kernel.org/linux-pci/20190413170056.GA11293@deco.navytux.spb.ru/
	https://lore.kernel.org/linux-pci/20190415145456.GA15280@deco.navytux.spb.ru/
	https://lore.kernel.org/linux-pci/20190415154102.GB17661@deco.navytux.spb.ru/

For a driver that uses nonseekable_open with read/write having stream
semantic and read also calling e.g. wait_for_completion_interruptible,
running stream_open.cocci before this patch would produce:

	WARNING: <driver>_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.

while after this patch it will report:

	ERROR: <driver>_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.

Signed-off-by: Kirill Smelkov <kirr@nexedi.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-07-08 02:25:59 +09:00
..
api coccinelle: api/stream_open: treat all wait_.*() calls as blocking 2019-07-08 02:25:59 +09:00
free coccinelle: put_device: Add a cast to an expression for an assignment 2019-07-08 02:25:59 +09:00
iterators scripts: coccinelle: check for redeclaration 2019-01-06 09:46:51 +09:00
locks coccinelle: mini_lock: improve performance 2018-05-22 23:00:23 +09:00
misc scripts: coccinelle: Fix description of badty.cocci 2019-03-28 23:46:56 +09:00
null coccinelle: deref_null: improve performance 2018-05-22 23:00:23 +09:00
tests Coccinelle: doubletest: reduce side effect false positives 2018-08-14 08:58:49 +09:00