[Yaffs] yaffs_iterate + readdir + unlink

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Andre Renaud
Date:  
To: yaffs
Subject: [Yaffs] yaffs_iterate + readdir + unlink
Hi,
I'm re-investigating an old issue that we're still seeing, earlier
discussed here:
http://stoneboat.aleph1.co.uk/lurker/message/20161109.011210.e8aaca1b.gl.html
and I think it's the same issue discussed here:
http://stoneboat.aleph1.co.uk/lurker/message/20170313.063024.e8a1ade9.es.html

This is causing the bonnie++ tool to fail on Yaffs. I've traced it
down to an issue when combining the yaffs_iterate callback with
unlink. yaffs_iterate can be called with a start offset, and all the
files up to that point are skipped. However Bonnie++ uses readdir
+unlink, so it iterates over all items in the directory, unlinking
them. It does this in chunks, and each time it moves onto a new chunk,
it uses the offset at the end of the last chunk. But under the hood
YAFFS has been told to delete files from the directory, and as such
the offsets are now incorrect.

I think that inside yaffs_remove_obj_callback we should be checking if
the removed object has already been emitted by an in-progress search,
in which case we need to decrement the search position.

Any thoughts on this?

Regards,
Andre