Failed writes to block devices don't report an error

Chris Johns chrisj at rtems.org
Fri Jun 25 23:10:45 UTC 2010


On 25/06/10 8:07 PM, Arnout Vandecappelle wrote:
>
> On Thursday 24 June 2010 01:12:14, Chris Johns wrote:
>>>> This would be good to have. I see it being needed which ever way we
>>>> go.
>>>>
>>>> I also see the following:
>>>>     if (write(fd, buf, size) != size)
>>>>       goto handle_error
>>>>     if (sync_call(..)<   0)
>>>>       goto handle_error
>>>>
>>>> in an application could be a work around until a more standard
>>>> approach is made. I prefer this over the other suggestions.
>>>
>>> ...which is why I put it as the first one :-)
>>
>> If you are using the DOSFS it may pay to check if it has hold of a
>> buffer that may not be flushed. I think there are paths that can result
>> in it holding a buffer. The sync call currently does not touch the file
>> systems.
>
>   sync_call() doesn't, but fsync(fd) does.
>

Ah yes. Thanks for correcting this.

>   However, I'm not sure if dosfs also syncs the FAT in that case.  It really
> should.

Agreed. I think it is a hole in the sync API. The only way to solve this 
I can think of is another file system handler.

Chris



More information about the users mailing list