Re: [PATCH 1/2] s390/dasd: Add __context_unsafe() attribute to various functions

Bart Van Assche <[email protected]> Thu, 6 Aug 2026 09:34:06 -0700
Newsgroups org.kernel.vger.linux-block,org.kernel.vger.linux-s390
Message-ID <[email protected]>
On 8/6/26 6:00 AM, Heiko Carstens wrote:
> diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
> index bacf770c0e1f..b4dcef06edaa 100644
> --- a/drivers/s390/block/dasd_eckd.c
> +++ b/drivers/s390/block/dasd_eckd.c
> @@ -1468,6 +1468,7 @@ static void dasd_eckd_path_available_action(struct dasd_device *device,
>   }
>   
>   static void do_pe_handler_work(struct work_struct *work)
> +__context_unsafe(/* Conditional locking */)
>   {
>   	struct pe_handler_work_data *data;
>   	struct dasd_device *device;

__context_unsafe() should be avoided if there is a better solution. For
this driver I propose to make the following changes:
- Change dasd_pe_handler_mutex into a semaphore. This driver locks this
   mutex from one kernel thread and unlocks it from another kernel
   thread. That's not allowed!
- Split the dasd_eckd_read_vol_info(), dasd_eckd_release(), ...
   functions. Move the code between the mutex_lock() and mutex_unlock()
   calls into a new function. Rework both functions such that the
   mutex_lock() and mutex_unlock() calls end up in the same branch of an
   if-statement.

Thanks,

Bart.