lkml.org 
[lkml]   [2000]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
Hi !

I've read the discussion about the truncate() problem and tried to
understand ;) However, there's somethign I don't catch in your code (typo
? bug ? misunderstanding on my side ?)

Linus wrote:

There's a really simple way to avoid this: compare the thing you're going
to zero out against zero before you memset() it to zero. If it was already
zero, you just unlock the page and release.

Your code does:

>+ kaddr = (char*)kmap(page);
>+ err = 0;
>+ if (!mem_is_zero(kaddr+offset, length))
>+ goto unmap;
>+ memset(kaddr+offset, 0, length);
>+ flush_dcache_page(page);
>+ __block_commit_write(inode, page, offset, offset+length);
>+unmap:
>+ kunmap(page);

Which seem to be the the opposite of what Linus says: You memset() the
page when it's _already_ zero and exit when it's not.

Ben.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.066 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site