diff options
-rw-r--r-- | fs/buffer.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 12bdb2791127..13e5938a64f6 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1926,7 +1926,6 @@ static int __block_prepare_write(struct inode *inode, struct page *page, | |||
1926 | if (err) | 1926 | if (err) |
1927 | break; | 1927 | break; |
1928 | if (buffer_new(bh)) { | 1928 | if (buffer_new(bh)) { |
1929 | clear_buffer_new(bh); | ||
1930 | unmap_underlying_metadata(bh->b_bdev, | 1929 | unmap_underlying_metadata(bh->b_bdev, |
1931 | bh->b_blocknr); | 1930 | bh->b_blocknr); |
1932 | if (PageUptodate(page)) { | 1931 | if (PageUptodate(page)) { |
@@ -1968,9 +1967,14 @@ static int __block_prepare_write(struct inode *inode, struct page *page, | |||
1968 | if (!buffer_uptodate(*wait_bh)) | 1967 | if (!buffer_uptodate(*wait_bh)) |
1969 | err = -EIO; | 1968 | err = -EIO; |
1970 | } | 1969 | } |
1971 | if (!err) | 1970 | if (!err) { |
1972 | return err; | 1971 | bh = head; |
1973 | 1972 | do { | |
1973 | if (buffer_new(bh)) | ||
1974 | clear_buffer_new(bh); | ||
1975 | } while ((bh = bh->b_this_page) != head); | ||
1976 | return 0; | ||
1977 | } | ||
1974 | /* Error case: */ | 1978 | /* Error case: */ |
1975 | /* | 1979 | /* |
1976 | * Zero out any newly allocated blocks to avoid exposing stale | 1980 | * Zero out any newly allocated blocks to avoid exposing stale |