Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hfsplus: add error propagation to __hfsplus_ext_write_extent()

__hfsplus_ext_write_extent() suppresses errors coming from
hfs_brec_find(). The patch implements error code propagation.

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.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>

authored by

Alexey Khoroshilov and committed by
Linus Torvalds
d7a475d0 d6142673

+13 -8
+13 -8
fs/hfsplus/extents.c
··· 83 83 return be32_to_cpu(ext->start_block) + be32_to_cpu(ext->block_count); 84 84 } 85 85 86 - static void __hfsplus_ext_write_extent(struct inode *inode, 86 + static int __hfsplus_ext_write_extent(struct inode *inode, 87 87 struct hfs_find_data *fd) 88 88 { 89 89 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); ··· 98 98 res = hfs_brec_find(fd, hfs_find_rec_by_key); 99 99 if (hip->extent_state & HFSPLUS_EXT_NEW) { 100 100 if (res != -ENOENT) 101 - return; 101 + return res; 102 102 hfs_brec_insert(fd, hip->cached_extents, 103 103 sizeof(hfsplus_extent_rec)); 104 104 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); 105 105 } else { 106 106 if (res) 107 - return; 107 + return res; 108 108 hfs_bnode_write(fd->bnode, hip->cached_extents, 109 109 fd->entryoffset, fd->entrylength); 110 110 hip->extent_state &= ~HFSPLUS_EXT_DIRTY; ··· 117 117 * to explicily mark the inode dirty, too. 118 118 */ 119 119 set_bit(HFSPLUS_I_EXT_DIRTY, &hip->flags); 120 + 121 + return 0; 120 122 } 121 123 122 124 static int hfsplus_ext_write_extent_locked(struct inode *inode) 123 125 { 124 - int res; 126 + int res = 0; 125 127 126 128 if (HFSPLUS_I(inode)->extent_state & HFSPLUS_EXT_DIRTY) { 127 129 struct hfs_find_data fd; ··· 131 129 res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd); 132 130 if (res) 133 131 return res; 134 - __hfsplus_ext_write_extent(inode, &fd); 132 + res = __hfsplus_ext_write_extent(inode, &fd); 135 133 hfs_find_exit(&fd); 136 134 } 137 - return 0; 135 + return res; 138 136 } 139 137 140 138 int hfsplus_ext_write_extent(struct inode *inode) ··· 177 175 178 176 WARN_ON(!mutex_is_locked(&hip->extents_lock)); 179 177 180 - if (hip->extent_state & HFSPLUS_EXT_DIRTY) 181 - __hfsplus_ext_write_extent(inode, fd); 178 + if (hip->extent_state & HFSPLUS_EXT_DIRTY) { 179 + res = __hfsplus_ext_write_extent(inode, fd); 180 + if (res) 181 + return res; 182 + } 182 183 183 184 res = __hfsplus_ext_read_extent(fd, hip->cached_extents, inode->i_ino, 184 185 block, HFSPLUS_IS_RSRC(inode) ?