Bug #80714 Hold S mode rw_lock on bpage when flush dirty page until IO complete
Submitted: 13 Mar 2016 8:27
Reporter: Zhao Jianwei Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S4 (Feature request)
Version:MySQL 5.5.18 OS:Linux
Assigned to: CPU Architecture:Any

[13 Mar 2016 8:27] Zhao Jianwei
Description:
Hi

I have encounter a scenc as below from error log。

```
InnoDB: Warning: a long semaphore wait:
--Thread 47102403548928 has waited at btr0cur.c line 253 for 241.00 seconds the semaphore:
X-lock (wait_ex) on RW-latch at 0x2ad6bdcf9738 '&block->lock'
a writer (thread id 47102403548928) has reserved it in mode  wait exclusive
number of readers 1, waiters flag 0, lock_word: ffffffffffffffff
Last time read locked in file btr0sea.c line 945
Last time write locked in file storage/innobase/row/row0upd.c line 2155
```

```
--------
FILE I/O
--------
I/O thread 6 state: doing file i/o (write thread) ev set
Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 4 [4, 0, 0, 0] ,
0 pending preads, 1 pending pwrites
```

one thread hold s mode rw_lock on block which is flushing. since of the IO device problem, the pending write IO didn't complete for a long time.

but my doubt is:

If I have posted flushable block into double write buffer, It can release S mode rw_lock on the block safely,It is not necessary to hold S lock until the aio complete,so hope you sincere opinion。  

How to repeat:
It is caused by very very slow IO device。