OpenCloudOS-Kernel/fs/udf
Jan Kara 74584ae509 udf: fix possible leakage of blocks
We have to take care that when we call udf_discard_prealloc() from
udf_clear_inode() we have to write inode ourselves afterwards (otherwise,
some changes might be lost leading to leakage of blocks, use of free blocks
or improperly aligned extents).

Also udf_discard_prealloc() does two different things - it removes
preallocated blocks and truncates the last extent to exactly match i_size.
We move the latter functionality to udf_truncate_tail_extent(), call
udf_discard_prealloc() when last reference to a file is dropped and call
udf_truncate_tail_extent() when inode is being removed from inode cache
(udf_clear_inode() call).

We cannot call udf_truncate_tail_extent() earlier as subsequent open+write
would find the last block of the file mapped and happily write to the end
of it, although the last extent says it's shorter.

[akpm@linux-foundation.org: Make checkpatch.pl happier]
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Eric Sandeen <sandeen@sandeen.net>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-06-16 13:16:16 -07:00
..
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
balloc.c udf: use get_bh() 2007-05-08 11:15:21 -07:00
crc.c remove pointers to the defunct UDF mailing list 2006-01-03 13:19:13 +01:00
dir.c udf: use get_bh() 2007-05-08 11:15:21 -07:00
directory.c udf: use get_bh() 2007-05-08 11:15:21 -07:00
ecma_167.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
file.c Detach sched.h from mm.h 2007-05-21 09:18:19 -07:00
fsync.c header cleaning: don't include smp_lock.h when not used 2007-05-08 11:15:07 -07:00
ialloc.c [PATCH] inode-diet: Eliminate i_blksize from the inode structure 2006-09-27 08:26:18 -07:00
inode.c udf: fix possible leakage of blocks 2007-06-16 13:16:16 -07:00
lowlevel.c remove pointers to the defunct UDF mailing list 2006-01-03 13:19:13 +01:00
misc.c udf: use get_bh() 2007-05-08 11:15:21 -07:00
namei.c Detach sched.h from mm.h 2007-05-21 09:18:19 -07:00
osta_udf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
partition.c udf: use get_bh() 2007-05-08 11:15:21 -07:00
super.c parse errors in ifdefs 2007-06-01 08:18:28 -07:00
symlink.c udf: use get_bh() 2007-05-08 11:15:21 -07:00
truncate.c udf: fix possible leakage of blocks 2007-06-16 13:16:16 -07:00
udf_i.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
udf_sb.h udf: use get_bh() 2007-05-08 11:15:21 -07:00
udfdecl.h udf: fix possible leakage of blocks 2007-06-16 13:16:16 -07:00
udfend.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
udftime.c [PATCH] UDF filesystem: array '__mon_yday' declared as not static 2005-05-31 14:54:18 -07:00
unicode.c remove pointers to the defunct UDF mailing list 2006-01-03 13:19:13 +01:00