Re: [PATCH]: uClinux (MMU-less) patches against 2.5.28

Alan Cox
2002-07-26T16:10:47Z

On Fri, 2002-07-26 at 17:01, David Woodhouse wrote:
> What locks the page? Surely our write() implementation is just using
> copy_from_user(), to get the data from the user, and each erase and write
> to the flash chip can be considered atomic -- what's holding a lock, and
> what's causing the deadlock?

That is going to depend on the exact ordering that is done. You would
need to copy the user data into a temporary memory buffer (possibly
paging) then lock the flash write and restore.

Also a page can be locked because another I/O read is pending on it (ie
its already in someone elses read/page in handling and currently has
invalid data). You would need to be sure we never ended up with
deadlocks for any case where we have

process 1 copying page X from flash 2 to flash 1 page Y
process 2 copying page Y from flash 1 to flash 2 page X

With jffs2 and temporary buffering I guess it works out.