Index: uspace/srv/fs/fat/fat_fat.c
===================================================================
--- uspace/srv/fs/fat/fat_fat.c	(revision 056fa4090104b8518b5d3a4540748ae2e465f0eb)
+++ uspace/srv/fs/fat/fat_fat.c	(revision 93d66ef89933bb5a9e0140b61d986e78b5d2dfae)
@@ -61,12 +61,15 @@
  * @param dev_handle	Device handle of the device with the file.
  * @param firstc	First cluster to start the walk with.
- * @param lastc		If non-NULL, output argument hodling the last cluster number visited.
+ * @param lastc		If non-NULL, output argument hodling the last cluster
+ *			number visited.
+ * @param numc		If non-NULL, output argument holding the number of
+ *			clusters seen during the walk.
  * @param max_clusters	Maximum number of clusters to visit.	
  *
- * @return		Number of clusters seen during the walk.
- */
-uint16_t 
+ * @return		EOK on success or a negative error code.
+ */
+int 
 fat_cluster_walk(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t firstc,
-    fat_cluster_t *lastc, uint16_t max_clusters)
+    fat_cluster_t *lastc, uint16_t *numc, uint16_t max_clusters)
 {
 	block_t *b;
@@ -84,5 +87,7 @@
 		if (lastc)
 			*lastc = firstc;
-		return 0;
+		if (numc)
+			*numc = 0;
+		return EOK;
 	}
 
@@ -98,9 +103,11 @@
 		/* read FAT1 */
 		rc = block_get(&b, dev_handle, rscnt + fsec, BLOCK_FLAGS_NONE);
-		assert(rc == EOK);
+		if (rc != EOK)
+			return rc;
 		clst = uint16_t_le2host(((fat_cluster_t *)b->data)[fidx]);
 		assert(clst != FAT_CLST_BAD);
 		rc = block_put(b);
-		assert(rc == EOK);
+		if (rc != EOK)
+			return rc;
 		clusters++;
 	}
@@ -108,10 +115,13 @@
 	if (lastc && clst < FAT_CLST_LAST1)
 		*lastc = clst;
-
-	return clusters;
+	if (numc)
+		*numc = clusters;
+
+	return EOK;
 }
 
 /** Read block from file located on a FAT file system.
  *
+ * @param block		Pointer to a block pointer for storing result.
  * @param bs		Buffer holding the boot sector of the file system.
  * @param dev_handle	Device handle of the file system.
@@ -121,11 +131,10 @@
  * @param flags		Flags passed to libblock.
  *
- * @return		Block structure holding the requested block.
- */
-block_t *
-_fat_block_get(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t firstc,
-    bn_t bn, int flags)
-{
-	block_t *b;
+ * @return		EOK on success or a negative error code.
+ */
+int
+_fat_block_get(block_t **block, fat_bs_t *bs, dev_handle_t dev_handle,
+    fat_cluster_t firstc, bn_t bn, int flags)
+{
 	unsigned bps;
 	unsigned rscnt;		/* block address of the first FAT */
@@ -134,5 +143,6 @@
 	unsigned sf;
 	unsigned ssa;		/* size of the system area */
-	unsigned clusters, max_clusters;
+	uint16_t clusters;
+	unsigned max_clusters;
 	fat_cluster_t lastc;
 	int rc;
@@ -150,20 +160,20 @@
 		/* root directory special case */
 		assert(bn < rds);
-		rc = block_get(&b, dev_handle, rscnt + bs->fatcnt * sf + bn,
+		rc = block_get(block, dev_handle, rscnt + bs->fatcnt * sf + bn,
 		    flags);
-		assert(rc == EOK);
-		return b;
+		return rc;
 	}
 
 	max_clusters = bn / bs->spc;
-	clusters = fat_cluster_walk(bs, dev_handle, firstc, &lastc,
+	rc = fat_cluster_walk(bs, dev_handle, firstc, &lastc, &clusters,
 	    max_clusters);
+	if (rc != EOK)
+		return rc;
 	assert(clusters == max_clusters);
 
-	rc = block_get(&b, dev_handle, ssa +
-	    (lastc - FAT_CLST_FIRST) * bs->spc + bn % bs->spc, flags);
-	assert(rc == EOK);
-
-	return b;
+	rc = block_get(block, dev_handle,
+	    ssa + (lastc - FAT_CLST_FIRST) * bs->spc + bn % bs->spc, flags);
+
+	return rc;
 }
 
@@ -177,6 +187,8 @@
  *			this argument is ignored.
  * @param pos		Position in the last node block.
- */
-void fat_fill_gap(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl, off_t pos)
+ *
+ * @return		EOK on success or a negative error code.
+ */
+int fat_fill_gap(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl, off_t pos)
 {
 	uint16_t bps;
@@ -196,23 +208,31 @@
 	    	int flags = (o % bps == 0) ?
 		    BLOCK_FLAGS_NOREAD : BLOCK_FLAGS_NONE;
-		b = fat_block_get(bs, nodep, o / bps, flags);
+		rc = fat_block_get(&b, bs, nodep, o / bps, flags);
+		if (rc != EOK)
+			return rc;
 		memset(b->data + o % bps, 0, bps - o % bps);
 		b->dirty = true;		/* need to sync node */
 		rc = block_put(b);
-		assert(rc == EOK);
+		if (rc != EOK)
+			return rc;
 	}
 	
 	if (o >= pos)
-		return;
+		return EOK;
 	
 	/* zero out the initial part of the new cluster chain */
 	for (o = boundary; o < pos; o += bps) {
-		b = _fat_block_get(bs, nodep->idx->dev_handle, mcl,
+		rc = _fat_block_get(&b, bs, nodep->idx->dev_handle, mcl,
 		    (o - boundary) / bps, BLOCK_FLAGS_NOREAD);
+		if (rc != EOK)
+			return rc;
 		memset(b->data, 0, min(bps, pos - o));
 		b->dirty = true;		/* need to sync node */
 		rc = block_put(b);
-		assert(rc == EOK);
-	}
+		if (rc != EOK)
+			return rc;
+	}
+
+	return EOK;
 }
 
@@ -222,14 +242,16 @@
  * @param dev_handle	Device handle for the file system.
  * @param clst		Cluster which to get.
- *
- * @return		Value found in the cluster.
- */
-fat_cluster_t
-fat_get_cluster(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t clst)
+ * @param value		Output argument holding the value of the cluster.
+ *
+ * @return		EOK or a negative error code.
+ */
+int
+fat_get_cluster(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t clst,
+    fat_cluster_t *value)
 {
 	block_t *b;
 	uint16_t bps;
 	uint16_t rscnt;
-	fat_cluster_t *cp, value;
+	fat_cluster_t *cp;
 	int rc;
 
@@ -239,11 +261,11 @@
 	rc = block_get(&b, dev_handle, rscnt +
 	    (clst * sizeof(fat_cluster_t)) / bps, BLOCK_FLAGS_NONE);
-	assert(rc == EOK);
+	if (rc != EOK)
+		return rc;
 	cp = (fat_cluster_t *)b->data + clst % (bps / sizeof(fat_cluster_t));
-	value = uint16_t_le2host(*cp);
+	*value = uint16_t_le2host(*cp);
 	rc = block_put(b);
-	assert(rc == EOK);
-	
-	return value;
+	
+	return rc;
 }
 
@@ -255,6 +277,8 @@
  * @param clst		Cluster which is to be set.
  * @param value		Value to set the cluster with.
- */
-void
+ *
+ * @return		EOK on success or a negative error code.
+ */
+int
 fat_set_cluster(fat_bs_t *bs, dev_handle_t dev_handle, unsigned fatno,
     fat_cluster_t clst, fat_cluster_t value)
@@ -274,10 +298,11 @@
 	rc = block_get(&b, dev_handle, rscnt + sf * fatno +
 	    (clst * sizeof(fat_cluster_t)) / bps, BLOCK_FLAGS_NONE);
-	assert(rc == EOK);
+	if (rc != EOK)
+		return rc;
 	cp = (fat_cluster_t *)b->data + clst % (bps / sizeof(fat_cluster_t));
 	*cp = host2uint16_t_le(value);
 	b->dirty = true;		/* need to sync block */
 	rc = block_put(b);
-	assert(rc == EOK);
+	return rc;
 }
 
@@ -288,17 +313,24 @@
  * @param lifo		Chain of allocated clusters.
  * @param nclsts	Number of clusters in the lifo chain.
- */
-void fat_alloc_shadow_clusters(fat_bs_t *bs, dev_handle_t dev_handle,
+ *
+ * @return		EOK on success or a negative error code.
+ */
+int fat_alloc_shadow_clusters(fat_bs_t *bs, dev_handle_t dev_handle,
     fat_cluster_t *lifo, unsigned nclsts)
 {
 	uint8_t fatno;
 	unsigned c;
+	int rc;
 
 	for (fatno = FAT1 + 1; fatno < bs->fatcnt; fatno++) {
 		for (c = 0; c < nclsts; c++) {
-			fat_set_cluster(bs, dev_handle, fatno, lifo[c],
+			rc = fat_set_cluster(bs, dev_handle, fatno, lifo[c],
 			    c == 0 ? FAT_CLST_LAST1 : lifo[c - 1]);
+			if (rc != EOK)
+				return rc;
 		}
 	}
+
+	return EOK;
 }
 
@@ -347,4 +379,6 @@
 	for (b = 0, cl = 0; b < sf; b++) {
 		rc = block_get(&blk, dev_handle, rscnt + b, BLOCK_FLAGS_NONE);
+		if (rc != EOK)
+			goto error;
 		for (c = 0; c < bps / sizeof(fat_cluster_t); c++, cl++) {
 			fat_cluster_t *clst = (fat_cluster_t *)blk->data + c;
@@ -362,8 +396,11 @@
 					/* we are almost done */
 					rc = block_put(blk);
-					assert(rc == EOK);
+					if (rc != EOK)
+						goto error;
 					/* update the shadow copies of FAT */
-					fat_alloc_shadow_clusters(bs,
+					rc = fat_alloc_shadow_clusters(bs,
 					    dev_handle, lifo, nclsts);
+					if (rc != EOK)
+						goto error;
 					*mcl = lifo[found - 1];
 					*lcl = lifo[0];
@@ -375,5 +412,10 @@
 		}
 		rc = block_put(blk);
-		assert(rc == EOK);
+		if (rc != EOK) {
+error:
+			fibril_mutex_unlock(&fat_alloc_lock);
+			free(lifo);
+			return rc;
+		}
 	}
 	fibril_mutex_unlock(&fat_alloc_lock);
@@ -384,6 +426,10 @@
 	 */
 	while (found--) {
-		fat_set_cluster(bs, dev_handle, FAT1, lifo[found],
+		rc = fat_set_cluster(bs, dev_handle, FAT1, lifo[found],
 		    FAT_CLST_RES0);
+		if (rc != EOK) {
+			free(lifo);
+			return rc;
+		}
 	}
 	
@@ -397,20 +443,31 @@
  * @param dev_handle	Device handle of the file system.
  * @param firstc	First cluster in the chain which is to be freed.
- */
-void
+ *
+ * @return		EOK on success or a negative return code.
+ */
+int
 fat_free_clusters(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t firstc)
 {
 	unsigned fatno;
 	fat_cluster_t nextc;
+	int rc;
 
 	/* Mark all clusters in the chain as free in all copies of FAT. */
 	while (firstc < FAT_CLST_LAST1) {
 		assert(firstc >= FAT_CLST_FIRST && firstc < FAT_CLST_BAD);
-		nextc = fat_get_cluster(bs, dev_handle, firstc);
-		for (fatno = FAT1; fatno < bs->fatcnt; fatno++)
-			fat_set_cluster(bs, dev_handle, fatno, firstc,
+		rc = fat_get_cluster(bs, dev_handle, firstc, &nextc);
+		if (rc != EOK)
+			return rc;
+		for (fatno = FAT1; fatno < bs->fatcnt; fatno++) {
+			rc = fat_set_cluster(bs, dev_handle, fatno, firstc,
 			    FAT_CLST_RES0);
+			if (rc != EOK)
+				return rc;
+		}
+
 		firstc = nextc;
 	}
+
+	return EOK;
 }
 
@@ -420,21 +477,35 @@
  * @param nodep		Node representing the file.
  * @param mcl		First cluster of the cluster chain to append.
- */
-void fat_append_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl)
+ *
+ * @return		EOK on success or a negative error code.
+ */
+int fat_append_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl)
 {
 	dev_handle_t dev_handle = nodep->idx->dev_handle;
 	fat_cluster_t lcl;
+	uint16_t numc;
 	uint8_t fatno;
-
-	if (fat_cluster_walk(bs, dev_handle, nodep->firstc, &lcl,
-	    (uint16_t) -1) == 0) {
+	int rc;
+
+	rc = fat_cluster_walk(bs, dev_handle, nodep->firstc, &lcl, &numc,
+	    (uint16_t) -1);
+	if (rc != EOK)
+		return rc;
+
+	if (numc == 0) {
 		/* No clusters allocated to the node yet. */
 		nodep->firstc = mcl;
 		nodep->dirty = true;		/* need to sync node */
-		return;
-	}
-
-	for (fatno = FAT1; fatno < bs->fatcnt; fatno++)
-		fat_set_cluster(bs, nodep->idx->dev_handle, fatno, lcl, mcl);
+		return EOK;
+	}
+
+	for (fatno = FAT1; fatno < bs->fatcnt; fatno++) {
+		rc = fat_set_cluster(bs, nodep->idx->dev_handle, fatno, lcl,
+		    mcl);
+		if (rc != EOK)
+			return rc;
+	}
+
+	return EOK;
 }
 
@@ -446,11 +517,17 @@
  *			argument is FAT_CLST_RES0, then all clusters will
  *			be chopped off.
- */
-void fat_chop_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t lastc)
-{
+ *
+ * @return		EOK on success or a negative return code.
+ */
+int fat_chop_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t lastc)
+{
+	int rc;
+
 	dev_handle_t dev_handle = nodep->idx->dev_handle;
 	if (lastc == FAT_CLST_RES0) {
 		/* The node will have zero size and no clusters allocated. */
-		fat_free_clusters(bs, dev_handle, nodep->firstc);
+		rc = fat_free_clusters(bs, dev_handle, nodep->firstc);
+		if (rc != EOK)
+			return rc;
 		nodep->firstc = FAT_CLST_RES0;
 		nodep->dirty = true;		/* need to sync node */
@@ -459,16 +536,26 @@
 		unsigned fatno;
 
-		nextc = fat_get_cluster(bs, dev_handle, lastc);
+		rc = fat_get_cluster(bs, dev_handle, lastc, &nextc);
+		if (rc != EOK)
+			return rc;
 
 		/* Terminate the cluster chain in all copies of FAT. */
-		for (fatno = FAT1; fatno < bs->fatcnt; fatno++)
-			fat_set_cluster(bs, dev_handle, fatno, lastc, FAT_CLST_LAST1);
+		for (fatno = FAT1; fatno < bs->fatcnt; fatno++) {
+			rc = fat_set_cluster(bs, dev_handle, fatno, lastc,
+			    FAT_CLST_LAST1);
+			if (rc != EOK)
+				return rc;
+		}
 
 		/* Free all following clusters. */
-		fat_free_clusters(bs, dev_handle, nextc);
-	}
-}
-
-void
+		rc = fat_free_clusters(bs, dev_handle, nextc);
+		if (rc != EOK)
+			return rc;
+	}
+
+	return EOK;
+}
+
+int
 fat_zero_cluster(struct fat_bs *bs, dev_handle_t dev_handle, fat_cluster_t c)
 {
@@ -481,10 +568,16 @@
 	
 	for (i = 0; i < bs->spc; i++) {
-		b = _fat_block_get(bs, dev_handle, c, i, BLOCK_FLAGS_NOREAD);
+		rc = _fat_block_get(&b, bs, dev_handle, c, i,
+		    BLOCK_FLAGS_NOREAD);
+		if (rc != EOK)
+			return rc;
 		memset(b->data, 0, bps);
 		b->dirty = true;
 		rc = block_put(b);
-		assert(rc == EOK);
-	}
+		if (rc != EOK)
+			return rc;
+	}
+
+	return EOK;
 }
 
Index: uspace/srv/fs/fat/fat_fat.h
===================================================================
--- uspace/srv/fs/fat/fat_fat.h	(revision 056fa4090104b8518b5d3a4540748ae2e465f0eb)
+++ uspace/srv/fs/fat/fat_fat.h	(revision 93d66ef89933bb5a9e0140b61d986e78b5d2dfae)
@@ -59,30 +59,32 @@
 typedef uint16_t fat_cluster_t;
 
-#define fat_clusters_get(bs, dh, fc) \
-    fat_cluster_walk((bs), (dh), (fc), NULL, (uint16_t) -1)
-extern uint16_t fat_cluster_walk(struct fat_bs *, dev_handle_t, fat_cluster_t,
-    fat_cluster_t *, uint16_t);
+#define fat_clusters_get(numc, bs, dh, fc) \
+    fat_cluster_walk((bs), (dh), (fc), NULL, (numc), (uint16_t) -1)
+extern int fat_cluster_walk(struct fat_bs *, dev_handle_t, fat_cluster_t,
+    fat_cluster_t *, uint16_t *, uint16_t);
 
-#define fat_block_get(bs, np, bn, flags) \
-    _fat_block_get((bs), (np)->idx->dev_handle, (np)->firstc, (bn), (flags))
+#define fat_block_get(b, bs, np, bn, flags) \
+    _fat_block_get((b), (bs), (np)->idx->dev_handle, (np)->firstc, (bn), \
+    (flags))
 
-extern struct block *_fat_block_get(struct fat_bs *, dev_handle_t,
+extern int _fat_block_get(block_t **, struct fat_bs *, dev_handle_t,
     fat_cluster_t, bn_t, int);
   
-extern void fat_append_clusters(struct fat_bs *, struct fat_node *,
+extern int fat_append_clusters(struct fat_bs *, struct fat_node *,
     fat_cluster_t);
-extern void fat_chop_clusters(struct fat_bs *, struct fat_node *,
+extern int fat_chop_clusters(struct fat_bs *, struct fat_node *,
     fat_cluster_t);
 extern int fat_alloc_clusters(struct fat_bs *, dev_handle_t, unsigned,
     fat_cluster_t *, fat_cluster_t *);
-extern void fat_free_clusters(struct fat_bs *, dev_handle_t, fat_cluster_t);
-extern void fat_alloc_shadow_clusters(struct fat_bs *, dev_handle_t,
+extern int fat_free_clusters(struct fat_bs *, dev_handle_t, fat_cluster_t);
+extern int fat_alloc_shadow_clusters(struct fat_bs *, dev_handle_t,
     fat_cluster_t *, unsigned);
-extern fat_cluster_t fat_get_cluster(struct fat_bs *, dev_handle_t, fat_cluster_t);
-extern void fat_set_cluster(struct fat_bs *, dev_handle_t, unsigned,
+extern int fat_get_cluster(struct fat_bs *, dev_handle_t, fat_cluster_t,
+    fat_cluster_t *);
+extern int fat_set_cluster(struct fat_bs *, dev_handle_t, unsigned,
     fat_cluster_t, fat_cluster_t);
-extern void fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t,
+extern int fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t,
     off_t);
-extern void fat_zero_cluster(struct fat_bs *, dev_handle_t, fat_cluster_t);
+extern int fat_zero_cluster(struct fat_bs *, dev_handle_t, fat_cluster_t);
 
 #endif
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision 056fa4090104b8518b5d3a4540748ae2e465f0eb)
+++ uspace/srv/fs/fat/fat_ops.c	(revision 93d66ef89933bb5a9e0140b61d986e78b5d2dfae)
@@ -94,6 +94,7 @@
 	
 	/* Read the block that contains the dentry of interest. */
-	b = _fat_block_get(bs, node->idx->dev_handle, node->idx->pfc,
+	rc = _fat_block_get(&b, bs, node->idx->dev_handle, node->idx->pfc,
 	    (node->idx->pdi * sizeof(fat_dentry_t)) / bps, BLOCK_FLAGS_NONE);
+	assert(rc == EOK);
 
 	d = ((fat_dentry_t *)b->data) + (node->idx->pdi % dps);
@@ -202,7 +203,7 @@
 
 	/* Read the block that contains the dentry of interest. */
-	b = _fat_block_get(bs, idxp->dev_handle, idxp->pfc,
+	rc = _fat_block_get(&b, bs, idxp->dev_handle, idxp->pfc,
 	    (idxp->pdi * sizeof(fat_dentry_t)) / bps, BLOCK_FLAGS_NONE);
-	assert(b);
+	assert(rc == EOK);
 
 	d = ((fat_dentry_t *)b->data) + (idxp->pdi % dps);
@@ -219,6 +220,9 @@
 		 * size of the directory by walking the FAT.
 		 */
-		nodep->size = bps * spc * fat_clusters_get(bs, idxp->dev_handle,
+		uint16_t clusters;
+		rc = fat_clusters_get(&clusters, bs, idxp->dev_handle,
 		    uint16_t_le2host(d->firstc));
+		assert(rc == EOK);
+		nodep->size = bps * spc * clusters;
 	} else {
 		nodep->type = FAT_FILE;
@@ -325,10 +329,10 @@
 	nodep = fat_node_get_new();
 	if (!nodep) {
-		fat_free_clusters(bs, dev_handle, mcl);	
+		(void) fat_free_clusters(bs, dev_handle, mcl);
 		return NULL;
 	}
 	idxp = fat_idx_get_new(dev_handle);
 	if (!idxp) {
-		fat_free_clusters(bs, dev_handle, mcl);	
+		(void) fat_free_clusters(bs, dev_handle, mcl);	
 		fat_node_put(FS_NODE(nodep));
 		return NULL;
@@ -337,5 +341,6 @@
 	if (flags & L_DIRECTORY) {
 		/* Populate the new cluster with unused dentries. */
-		fat_zero_cluster(bs, dev_handle, mcl);
+		rc = fat_zero_cluster(bs, dev_handle, mcl);
+		assert(rc == EOK);
 		nodep->type = FAT_DIRECTORY;
 		nodep->firstc = mcl;
@@ -361,4 +366,5 @@
 	fat_node_t *nodep = FAT_NODE(fn);
 	fat_bs_t *bs;
+	int rc = EOK;
 
 	/*
@@ -379,5 +385,6 @@
 		assert(nodep->size);
 		/* Free all clusters allocated to the node. */
-		fat_free_clusters(bs, nodep->idx->dev_handle, nodep->firstc);
+		rc = fat_free_clusters(bs, nodep->idx->dev_handle,
+		    nodep->firstc);
 	}
 
@@ -385,5 +392,5 @@
 	free(nodep->bp);
 	free(nodep);
-	return EOK;
+	return rc;
 }
 
@@ -433,5 +440,6 @@
 
 	for (i = 0; i < blocks; i++) {
-		b = fat_block_get(bs, parentp, i, BLOCK_FLAGS_NONE);
+		rc = fat_block_get(&b, bs, parentp, i, BLOCK_FLAGS_NONE);
+		assert(rc == EOK);
 		for (j = 0; j < dps; j++) {
 			d = ((fat_dentry_t *)b->data) + j;
@@ -465,9 +473,12 @@
 		return rc;
 	}
-	fat_zero_cluster(bs, parentp->idx->dev_handle, mcl);
-	fat_append_clusters(bs, parentp, mcl);
+	rc = fat_zero_cluster(bs, parentp->idx->dev_handle, mcl);
+	assert(rc == EOK);
+	rc = fat_append_clusters(bs, parentp, mcl);
+	assert(rc == EOK);
 	parentp->size += bps * bs->spc;
 	parentp->dirty = true;		/* need to sync node */
-	b = fat_block_get(bs, parentp, i, BLOCK_FLAGS_NONE);
+	rc = fat_block_get(&b, bs, parentp, i, BLOCK_FLAGS_NONE);
+	assert(rc == EOK);
 	d = (fat_dentry_t *)b->data;
 
@@ -494,5 +505,6 @@
 	 * not use them anyway, so this is rather a sign of our good will.
 	 */
-	b = fat_block_get(bs, childp, 0, BLOCK_FLAGS_NONE);
+	rc = fat_block_get(&b, bs, childp, 0, BLOCK_FLAGS_NONE);
+	assert(rc == EOK);
 	d = (fat_dentry_t *)b->data;
 	if (fat_classify_dentry(d) == FAT_DENTRY_LAST ||
@@ -561,7 +573,8 @@
 	bps = uint16_t_le2host(bs->bps);
 
-	b = _fat_block_get(bs, childp->idx->dev_handle, childp->idx->pfc,
+	rc = _fat_block_get(&b, bs, childp->idx->dev_handle, childp->idx->pfc,
 	    (childp->idx->pdi * sizeof(fat_dentry_t)) / bps,
 	    BLOCK_FLAGS_NONE);
+	assert(rc == EOK);
 	d = (fat_dentry_t *)b->data +
 	    (childp->idx->pdi % (bps / sizeof(fat_dentry_t)));
@@ -605,5 +618,6 @@
 	blocks = parentp->size / bps;
 	for (i = 0; i < blocks; i++) {
-		b = fat_block_get(bs, parentp, i, BLOCK_FLAGS_NONE);
+		rc = fat_block_get(&b, bs, parentp, i, BLOCK_FLAGS_NONE);
+		assert(rc == EOK);
 		for (j = 0; j < dps; j++) { 
 			d = ((fat_dentry_t *)b->data) + j;
@@ -698,5 +712,6 @@
 		fat_dentry_t *d;
 	
-		b = fat_block_get(bs, nodep, i, BLOCK_FLAGS_NONE);
+		rc = fat_block_get(&b, bs, nodep, i, BLOCK_FLAGS_NONE);
+		assert(rc == EOK);
 		for (j = 0; j < dps; j++) {
 			d = ((fat_dentry_t *)b->data) + j;
@@ -953,6 +968,7 @@
 			bytes = min(len, bps - pos % bps);
 			bytes = min(bytes, nodep->size - pos);
-			b = fat_block_get(bs, nodep, pos / bps,
+			rc = fat_block_get(&b, bs, nodep, pos / bps,
 			    BLOCK_FLAGS_NONE);
+			assert(rc == EOK);
 			(void) ipc_data_read_finalize(callid, b->data + pos % bps,
 			    bytes);
@@ -980,5 +996,7 @@
 			off_t o;
 
-			b = fat_block_get(bs, nodep, bnum, BLOCK_FLAGS_NONE);
+			rc = fat_block_get(&b, bs, nodep, bnum,
+			    BLOCK_FLAGS_NONE);
+			assert(rc == EOK);
 			for (o = pos % (bps / sizeof(fat_dentry_t));
 			    o < bps / sizeof(fat_dentry_t);
@@ -1075,6 +1093,8 @@
 		 * next block size boundary.
 		 */
-		fat_fill_gap(bs, nodep, FAT_CLST_RES0, pos);
-		b = fat_block_get(bs, nodep, pos / bps, flags);
+		rc = fat_fill_gap(bs, nodep, FAT_CLST_RES0, pos);
+		assert(rc == EOK);
+		rc = fat_block_get(&b, bs, nodep, pos / bps, flags);
+		assert(rc == EOK);
 		(void) ipc_data_write_finalize(callid, b->data + pos % bps,
 		    bytes);
@@ -1109,7 +1129,9 @@
 		}
 		/* zero fill any gaps */
-		fat_fill_gap(bs, nodep, mcl, pos);
-		b = _fat_block_get(bs, dev_handle, lcl, (pos / bps) % spc,
+		rc = fat_fill_gap(bs, nodep, mcl, pos);
+		assert(rc == EOK);
+		rc = _fat_block_get(&b, bs, dev_handle, lcl, (pos / bps) % spc,
 		    flags);
+		assert(rc == EOK);
 		(void) ipc_data_write_finalize(callid, b->data + pos % bps,
 		    bytes);
@@ -1121,5 +1143,6 @@
 		 * node's cluster chain.
 		 */
-		fat_append_clusters(bs, nodep, mcl);
+		rc = fat_append_clusters(bs, nodep, mcl);
+		assert(rc == EOK);
 		nodep->size = pos + bytes;
 		nodep->dirty = true;		/* need to sync node */
@@ -1174,10 +1197,16 @@
 		 */
 		if (size == 0) {
-			fat_chop_clusters(bs, nodep, FAT_CLST_RES0);
+			rc = fat_chop_clusters(bs, nodep, FAT_CLST_RES0);
+			if (rc != EOK)
+				goto out;
 		} else {
 			fat_cluster_t lastc;
-			(void) fat_cluster_walk(bs, dev_handle, nodep->firstc,
-			    &lastc, (size - 1) / bpc);
-			fat_chop_clusters(bs, nodep, lastc);
+			rc = fat_cluster_walk(bs, dev_handle, nodep->firstc,
+			    &lastc, NULL, (size - 1) / bpc);
+			if (rc != EOK)
+				goto out;
+			rc = fat_chop_clusters(bs, nodep, lastc);
+			if (rc != EOK)
+				goto out;
 		}
 		nodep->size = size;
@@ -1185,4 +1214,5 @@
 		rc = EOK;	
 	}
+out:
 	fat_node_put(fn);
 	ipc_answer_0(rid, rc);
