linux/fs/hpfs
Mikulas Patocka 6cb69cb284 hpfs: don't truncate the file when delete fails
[ Upstream commit b6853f78e7 ]

The delete opration can allocate additional space on the HPFS filesystem
due to btree split. The HPFS driver checks in advance if there is
available space, so that it won't corrupt the btree if we run out of space
during splitting.

If there is not enough available space, the HPFS driver attempted to
truncate the file, but this results in a deadlock since the commit
7dd29d8d86 ("HPFS: Introduce a global mutex
and lock it on every callback from VFS").

This patch removes the code that tries to truncate the file and -ENOSPC is
returned instead. If the user hits -ENOSPC on delete, he should try to
delete other files (that are stored in a leaf btree node), so that the
delete operation will make some space for deleting the file stored in
non-leaf btree node.

Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Cc: stable@vger.kernel.org	# 2.6.39+
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
History 2016-03-09 13:15:12 -05:00
..
alloc.c fs/hpfs: convert printk to pr_foo() 2014-06-06 16:08:10 -07:00
anode.c hpfs: convert to use leXX_add_cpu() 2012-10-06 03:05:08 +09:00
buffer.c fs/hpfs: increase pr_warn level 2014-06-06 16:08:10 -07:00
dentry.c Don't pass inode to ->d_hash() and ->d_compare() 2013-06-29 12:57:36 +04:00
dir.c fs/hpfs: increase pr_warn level 2014-06-06 16:08:10 -07:00
dnode.c fs/hpfs/dnode.c: fix suspect code indent 2014-08-08 15:57:22 -07:00
ea.c fs/hpfs: increase pr_warn level 2014-06-06 16:08:10 -07:00
file.c make new_sync_{read,write}() static 2015-04-11 22:29:40 -04:00
hpfs.h hpfs: assorted endianness annotations 2012-05-29 23:28:39 -04:00
hpfs_fn.h fs/hpfs: use pr_fmt for logging 2014-06-06 16:08:10 -07:00
inode.c VFS: normal filesystems (and lustre): d_inode() annotations 2015-04-15 15:06:57 -04:00
Kconfig HPFS: Make HPFS compile on preempt and SMP 2011-05-09 09:04:23 -07:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
map.c fs/hpfs: increase pr_warn level 2014-06-06 16:08:10 -07:00
name.c fs/hpfs: increase pr_warn level 2014-06-06 16:08:10 -07:00
namei.c hpfs: don't truncate the file when delete fails 2016-03-09 13:15:12 -05:00
super.c hpfs: hpfs_error: Remove static buffer, use vsprintf extension %pV instead 2015-08-03 09:29:19 -07:00