ocfs2: free allocated clusters if error occurs after ocfs2_claim_clusters
Even if using the same jbd2 handle, we cannot rollback a transaction. So once some error occurs after successfully allocating clusters, the allocated clusters will never be used and it means they are lost. For example, call ocfs2_claim_clusters successfully when expanding a file, but failed in ocfs2_insert_extent. So we need free the allocated clusters if they are not used indeed. Signed-off-by: Zongxun Wang <wangzongxun@huawei.com> Signed-off-by: Joseph Qi <joseph.qi@huawei.com> Acked-by: Joel Becker <jlbec@evilplan.org> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Li Zefan <lizefan@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
277cba1d28
commit
fb951eb5e1
@@ -55,6 +55,12 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,
|
||||
u32 *bit_off,
|
||||
u32 *num_bits);
|
||||
|
||||
int ocfs2_free_local_alloc_bits(struct ocfs2_super *osb,
|
||||
handle_t *handle,
|
||||
struct ocfs2_alloc_context *ac,
|
||||
u32 bit_off,
|
||||
u32 num_bits);
|
||||
|
||||
void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb,
|
||||
unsigned int num_clusters);
|
||||
void ocfs2_la_enable_worker(struct work_struct *work);
|
||||
|
Reference in New Issue
Block a user