]> git.proxmox.com Git - mirror_ubuntu-zesty-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)
committerTim Gardner <tim.gardner@canonical.com>
Wed, 6 Apr 2016 09:24:15 +0000 (10:24 +0100)
commit1f07afc86197ad5400d582366265f3933dcd56a3
tree6bd16eea0de3bdc5bf609880f55a3bd603dc5d94
parent6a2721a301d308ecdb30201258e4de338a11f3d4
hpfs: don't truncate the file when delete fails

BugLink: http://bugs.launchpad.net/bugs/1553179
commit b6853f78e763d42c7a158d8de3549c9827c604ab upstream.

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
7dd29d8d865efdb00c0542a5d2c87af8c52ea6c7 ("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>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
fs/hpfs/namei.c