aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_buf.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index b82fc5c67fed..da2541e5ff81 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -552,18 +552,20 @@ xfs_buf_get(
552 if (unlikely(!new_bp)) 552 if (unlikely(!new_bp))
553 return NULL; 553 return NULL;
554 554
555 error = xfs_buf_allocate_memory(new_bp, flags);
556 if (error) {
557 kmem_zone_free(xfs_buf_zone, new_bp);
558 return NULL;
559 }
560
555 bp = _xfs_buf_find(target, ioff, isize, flags, new_bp); 561 bp = _xfs_buf_find(target, ioff, isize, flags, new_bp);
556 if (!bp) { 562 if (!bp) {
557 kmem_zone_free(xfs_buf_zone, new_bp); 563 xfs_buf_free(new_bp);
558 return NULL; 564 return NULL;
559 } 565 }
560 566
561 if (bp == new_bp) { 567 if (bp != new_bp)
562 error = xfs_buf_allocate_memory(bp, flags); 568 xfs_buf_free(new_bp);
563 if (error)
564 goto no_buffer;
565 } else
566 kmem_zone_free(xfs_buf_zone, new_bp);
567 569
568 /* 570 /*
569 * Now we have a workable buffer, fill in the block number so 571 * Now we have a workable buffer, fill in the block number so