On 22/08/2019 18:55, Song Liu wrote: > [...] >> + if (unlikely(!(tmp_dev->rdev->bdev->bd_disk->flags & GENHD_FL_UP))) { >> + if (!test_bit(MD_BROKEN, &mddev->flags)) >> + pr_warn("md: %s: linear array has a missing/failed member\n", >> + mdname(mddev)); >> + set_bit(MD_BROKEN, &mddev->flags); >> + bio_io_error(bio); >> + return true; >> + } >> + > > Maybe we can somehow put this block in a helper and use it in both raid0 > and linear code? > > Otherwise, looks good to me. > > Thanks, > Song > OK, so something as a function with a prototype like "void md_is_broken(struct md_rdev *rd, const char *md_type)" is good for you? Then we can use that as the check if a member failed and in positive case, we can print the message (if not printed before) and return to the raid0/linear driver in order it fails the bio and returns. I'd prefer keeping the bio out of the helper, agreed? If you have suggestion for a better name, let me know. Thanks, Guilherme