diff options
author | Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com> | 2018-10-30 15:06:17 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-31 08:54:13 -0700 |
commit | 54640c7502e5ed41fbf4eedd499e85f9acc9698f (patch) | |
tree | 0745ae35891531719808bf29bdcecf0bf8cf1119 /fs/hfs/btree.h | |
parent | d92915c35bfaf763d78bf1d5ac7f183420e3bd99 (diff) | |
download | lwn-54640c7502e5ed41fbf4eedd499e85f9acc9698f.tar.gz lwn-54640c7502e5ed41fbf4eedd499e85f9acc9698f.zip |
hfs: prevent btree data loss on ENOSPC
Inserting a new 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 or
extents.
Henceforth, check the available disk space before making any changes.
This still leaves the potential problem of corruption on ENOMEM.
There is no need to reserve space before deleting a catalog record, as we
do for hfsplus. This difference is because hfs index nodes have fixed
length keys.
Link: http://lkml.kernel.org/r/ab5fc8a7d5ffccfd5f27b1cf2cb4ceb6c110da74.1536269131.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>
Diffstat (limited to 'fs/hfs/btree.h')
-rw-r--r-- | fs/hfs/btree.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/hfs/btree.h b/fs/hfs/btree.h index c8b252dbb26c..dcc2aab1b2c4 100644 --- a/fs/hfs/btree.h +++ b/fs/hfs/btree.h @@ -82,6 +82,7 @@ struct hfs_find_data { extern struct hfs_btree *hfs_btree_open(struct super_block *, u32, btree_keycmp); extern void hfs_btree_close(struct hfs_btree *); extern void hfs_btree_write(struct hfs_btree *); +extern int hfs_bmap_reserve(struct hfs_btree *, int); extern struct hfs_bnode * hfs_bmap_alloc(struct hfs_btree *); extern void hfs_bmap_free(struct hfs_bnode *node); |