]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
hfsplus: prevent btree data loss on ENOSPC
authorErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
Tue, 30 Oct 2018 22:06:14 +0000 (15:06 -0700)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:20:59 +0000 (14:20 -0300)
commit3306e1aaeca57d24f6a4c05e734d073da25aad19
treecbead11220ded81e556c05b96f2a3bcaa31043f2
parent2aeb861a64ccaa19c8c7143e96bef78e52916359
hfsplus: prevent btree data loss on ENOSPC

BugLink: https://bugs.launchpad.net/bugs/1854975
[ Upstream commit d92915c35bfaf763d78bf1d5ac7f183420e3bd99 ]

Inserting or deleting a record in a btree may require splitting several of
its nodes.  If we hit ENOSPC halfway through, the new nodes will be left
orphaned and their records will be lost.  This could mean lost inodes,
extents or xattrs.

Henceforth, check the available disk space before making any changes.
This still leaves the potential problem of corruption on ENOMEM.

The patch can be tested with xfstests generic/027.

Link: http://lkml.kernel.org/r/4596eef22fbda137b4ffa0272d92f0da15364421.1536269129.git.ernesto.mnd.fernandez@gmail.com
Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/hfsplus/attributes.c
fs/hfsplus/btree.c
fs/hfsplus/catalog.c
fs/hfsplus/extents.c
fs/hfsplus/hfsplus_fs.h