Whamcloud - gitweb
libext2fs: Make ext2fs_extent_set_bmap() more robust against ENOSPC
authorTheodore Ts'o <tytso@mit.edu>
Fri, 10 Jul 2009 04:19:28 +0000 (00:19 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 10 Jul 2009 23:51:43 +0000 (19:51 -0400)
commit0dc29161125fa4650e4b8832fc0f570435ef0fe3
treeabd912dc64094d1af8780c61ac5599f91d5910bd
parentef1a526dfbe663bb80ab75c2e7985ae8d9021b76
libext2fs: Make ext2fs_extent_set_bmap() more robust against ENOSPC

In the case where we ext2fs_extent_set_bmap() is replacing the block
mapping at the beginning of an already-existing extent, insert a new
extent if necessary before shrinking an existing extent, to avoid data
loss if the disk is full.

This mostly addresses the problem described in Red Hat Bugzilla's
statistics are still wrong, but at least the files on the filesystem
are not corrupted.  If there is a failure during the
inode_scan_and_fix pass, the simplest thing to do may be to tell the
user to run e2fsck -fy.

Addresses-Red-Hat-Bug: #510379

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/extent.c