Skip to contentSkip to conversation

Handle possible bio_alloc failure in btrfs

PATCH NAK Nikanth Karthikesan 1 participant 1 message Apr 14, 2009 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 2/6 Handle possible bio_alloc failure in btrfs

Handle possible bio_alloc failure in btrfs.

---

fs/btrfs/inode.c +5 -0
Index: linux-2.6/fs/btrfs/inode.c
===================================================================
@@ -1714,6 +1714,11 @@ static int btrfs_io_failed_hook(struct b
 		return -EIO;
 	}
 	bio = bio_alloc(GFP_NOFS, 1);
+	if (unlikely(!bio)) {
+		kfree(failrec);
+		return -ENOMEM;
+	}
+	
 	bio->bi_private = state;
 	bio->bi_end_io = failed_bio->bi_end_io;
 	bio->bi_sector = failrec->logical >> 9;