Index: uspace/srv/bd/hr/raid1.c
===================================================================
--- uspace/srv/bd/hr/raid1.c	(revision dec41507e0de0bebfee6a879cf9990d06233a20a)
+++ uspace/srv/bd/hr/raid1.c	(revision d773bea92b783e9dcfd88271e9fa601ccfa34c0a)
@@ -675,7 +675,19 @@
 
 		if (i + 1 >= vol->extent_no) {
-			HR_ERROR("rebuild on \"%s\" (%lu), failed due to "
-			    "too many failed extents\n",
-			    vol->devname, vol->svc_id);
+			if (rc != ENOMEM) {
+				HR_ERROR("rebuild on \"%s\" (%lu), failed due "
+				    "to too many failed extents\n",
+				    vol->devname, vol->svc_id);
+			}
+
+			/* for now we have to invalidate the rebuild extent */
+			if (rc == ENOMEM) {
+				HR_ERROR("rebuild on \"%s\" (%lu), failed due "
+				    "to too many failed reads, because of not "
+				    "enough memory\n",
+				    vol->devname, vol->svc_id);
+				hr_raid1_ext_state_callback(vol, rebuild_idx,
+				    ENOMEM);
+			}
 
 			return rc;
@@ -685,6 +697,13 @@
 	rc = block_write_direct(rebuild_ext->svc_id, ba, cnt, buf);
 	if (rc != EOK) {
-		if (rc != ENOMEM)
-			hr_raid1_ext_state_callback(vol, rebuild_idx, rc);
+		/*
+		 * Here we dont handle ENOMEM, because maybe in the
+		 * future, there is going to be M_WAITOK, or we are
+		 * going to wait for more memory, so that we don't
+		 * have to invalidate it...
+		 *
+		 * XXX: for now we do
+		 */
+		hr_raid1_ext_state_callback(vol, rebuild_idx, rc);
 
 		HR_ERROR("rebuild on \"%s\" (%lu), failed due to "
@@ -761,5 +780,15 @@
 
 	fibril_rwlock_write_lock(&vol->states_lock);
+
 	hr_update_ext_status(vol, rebuild_idx, HR_EXT_ONLINE);
+	/*
+	 * We can be optimistic here, if some extents are
+	 * still INVALID, FAULTY or MISSING, the update vol
+	 * function will pick them up, and set the volume
+	 * state accordingly.
+	 */
+	hr_update_vol_status(vol, HR_VOL_ONLINE);
+	atomic_store(&vol->state_changed, true);
+
 	fibril_rwlock_write_unlock(&vol->states_lock);
 
@@ -771,6 +800,14 @@
 end:
 	if (rc != EOK) {
+		/*
+		 * We can fail either because:
+		 * - the rebuild extent failing or invalidation
+		 * - there is are no ONLINE extents (vol is FAULTY)
+		 * - we got ENOMEM on all READs (we also invalidate the
+		 *   rebuild extent here, for now)
+		 */
 		fibril_rwlock_write_lock(&vol->states_lock);
 		hr_update_vol_status(vol, HR_VOL_DEGRADED);
+		atomic_store(&vol->state_changed, true);
 		fibril_rwlock_write_unlock(&vol->states_lock);
 	}
