Re: fsync() on read-only RAID triggers BUG
From: Ben Hutchings <hidden>
Date: 2013-01-26 19:44:40
Attachments
- signature.asc [application/pgp-signature] 828 bytes
From: Ben Hutchings <hidden>
Date: 2013-01-26 19:44:40
On Fri, 2013-01-25 at 16:09 +0100, Sebastian Riemer wrote:
On 20.01.2013 19:44, Ben Hutchings wrote:quoted
# Call fsync() python -c "import os; os.fsync(os.open('/dev/md0', os.O_RDWR))"--- END ---I assume that the sync request should be filtered out at some point before this assertion is made, since there can be nothing to sync.I wrote a test case in C. It gets SIGSEGV upon fsync. When making the rdevs below also read-only the MD device can't be stopped anymore as it thinks that there is still active IO. The attached patch should fix it. Please confirm.
I applied this on top of 3.2.37 and it certainly fixes the crash. However I wonder whether fsync() should fail or should immediately succeed. I don't know whether the installer expects it to succeed. Ben.
We have to return a completion without incrementing the active IO count. Error code -EROFS seems to be suited best. But the libc fsync gets -EIO anyway: Input/output error Any objection? Cheers, Sebastian
-- Ben Hutchings Any smoothly functioning technology is indistinguishable from a rigged demo.