diff --git a/dm-sflc/src/lite/flush.c b/dm-sflc/src/lite/flush.c index 2079a0d..c9612f2 100644 --- a/dm-sflc/src/lite/flush.c +++ b/dm-sflc/src/lite/flush.c @@ -193,6 +193,7 @@ static int issue_lowlevel_flush(struct sflite_volume *svol, struct bio *orig_bio { struct bio *clone; DECLARE_COMPLETION_ONSTACK(compl); + int err = 0; // Can either issue a brand-new request if (orig_bio == NULL) @@ -209,9 +210,10 @@ static int issue_lowlevel_flush(struct sflite_volume *svol, struct bio *orig_bio // Submit and wait dm_submit_bio_remap(orig_bio, clone); wait_for_completion_io(&compl); + err = blk_status_to_errno(orig_bio->bi_status); bio_put(clone); - return blk_status_to_errno(orig_bio->bi_status); + return err; } @@ -314,8 +316,8 @@ int sflite_flush_posmap(struct sflite_volume *svol, struct bio *orig_bio, gfp_t * of the posmap blocks: those whose CWB did not fail, and whose seqnum * did not change while we were not holding the locks. * If some CWBs failed, we return an error (then failing the upper-layer - * bio in the caller, if there is one), but that doesn't mean aborting - * entirely, because we can still mark some blocks as clean. + * bio in the caller), but that doesn't mean aborting entirely, because + * we can still mark some blocks as clean. * Here, we need to lock again. */ down_write(&svol->posmap.flush_lock); // Not killable, for simplicity err = mark_posmap_blocks_clean(svol); diff --git a/docs/locking.md b/docs/locking.md index 64ca714..5d16fd9 100644 --- a/docs/locking.md +++ b/docs/locking.md @@ -75,7 +75,7 @@ fn flush(): rwsem.down_write(); // Some blocks might be marked clean, some might not; the overall FLUSH - // operation is successful only if all previously-dirty blocks are marked clean + // operation is successful only if all CWBs were successful err = mark_blocks_clean(); rwsem.up_write();