Re: [PATCH v3 04/11] md/raid5-cache: Take mddev_lock in r5c_journal_mode_show()

From: Christoph Hellwig
Date: Fri Jun 03 2022 - 02:40:18 EST


On Thu, Jun 02, 2022 at 12:18:10PM -0600, Logan Gunthorpe wrote:
> conf = mddev->private;
> if (!conf || !conf->log) {
> - spin_unlock(&mddev->lock);
> + mddev_unlock(mddev);
> return 0;
> }
>
> @@ -2557,7 +2560,7 @@ static ssize_t r5c_journal_mode_show(struct mddev *mddev, char *page)
> default:
> ret = 0;
> }
> - spin_unlock(&mddev->lock);
> + mddev_unlock(mddev);
> return ret;

Using a goto out_unlock would be nice here to keep the critical
sections simple. But even as-is this looks good:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>

> + lockdep_assert_held(&conf->mddev->reconfig_mutex);
> +

.. but this looks unrelated and misplaced in this patch.