Bug#696650: fsync() on read-only RAID triggers BUG

2013-01-27 Thread Christoph Hellwig
On Sat, Jan 26, 2013 at 07:44:40PM +, Ben Hutchings wrote:
 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.

It should succeed.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#696650: fsync() on read-only RAID triggers BUG

2013-01-26 Thread Ben Hutchings
On Fri, 2013-01-25 at 16:09 +0100, Sebastian Riemer wrote:
 On 20.01.2013 19:44, Ben Hutchings wrote:
  # 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.


signature.asc
Description: This is a digitally signed message part


Bug#696650: fsync() on read-only RAID triggers BUG

2013-01-20 Thread Ben Hutchings
We've had a report of the BUG in md_write_start() being triggered while
running the Debian installer: http://bugs.debian.org/696650.
Based on the call trace, I came up with the following script that
reproduces this under Linux 3.2.35 and 3.7.3:

--- BEGIN ---
#!/bin/bash -ex

# Set up temporary RAID1 on /dev/md0
dd if=/dev/zero of=/tmp/disk0 bs=1M count=1
losetup /dev/loop0 /tmp/disk0
dd if=/dev/zero of=/tmp/disk1 bs=1M count=1
losetup /dev/loop1 /tmp/disk1
yes | mdadm -C /dev/md0 -l 1 -n 2 /dev/loop{0,1}

# Make it read-only
while ! mdadm -o /dev/md0; do sleep 1; done

# 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.

Ben.

-- 
Ben Hutchings
Never attribute to conspiracy what can adequately be explained by stupidity.


signature.asc
Description: This is a digitally signed message part