From: Nick Piggin Comment was not entirely clear about why we must eliminate all other possibilities. Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton --- mm/filemap.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff -puN mm/filemap.c~mm-fix-pagecache-write-deadlocks-comment mm/filemap.c --- a/mm/filemap.c~mm-fix-pagecache-write-deadlocks-comment +++ a/mm/filemap.c @@ -2157,12 +2157,19 @@ retry_noprogress: if (!PageUptodate(page)) { /* * If the page is not uptodate, we cannot allow a - * partial commit_write, because that might expose - * uninitialised data. + * partial commit_write because when we unlock the + * page below, someone else might bring it uptodate + * and we lose our write. We cannot allow a full + * commit_write, because that exposes uninitialised + * data. We cannot zero the rest of the file and do + * a full commit_write because that exposes transient + * zeroes. * - * We will enter the single-segment path below, which - * should get the filesystem to bring the page - * uputodate for us next time. + * Abort the operation entirely with a zero length + * commit_write. Retry. We will enter the + * single-segment path below, which should get the + * filesystem to bring the page uputodate for us next + * time. */ if (unlikely(copied != bytes)) copied = 0; _