]> git.baikalelectronics.ru Git - kernel.git/commit
hpfs: don't truncate the file when delete fails
authorMikulas Patocka <mikulas@twibright.com>
Thu, 25 Feb 2016 17:17:38 +0000 (18:17 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 28 Feb 2016 00:15:51 +0000 (19:15 -0500)
commit0960d4b2c99e9781f66b78d64f847c4c14fec3d0
tree163114c508c577d3c6228d80667ffc17d2a60c13
parentc409b46b17800a995205eec20cb74fd15faada33
hpfs: don't truncate the file when delete fails

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
fdda863f6cf1fc9137fdad5c4cbf7accc4e06a89 ("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>
fs/hpfs/namei.c