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

Heiko Carstens <[email protected]>
Newsgroups org.kernel.vger.linux-s390,org.kernel.vger.linux-block
Message-ID <[email protected]>
On Thu, Aug 06, 2026 at 09:34:06AM -0700, Bart Van Assche wrote:
> 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.

Sure, I did that for other code, but this one is up to Stefan.

> 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!

Yes, I did not realize that when adding those attributes, however that
was also reported by Sashiko.

> - 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.

Agreed, all for Stefan's todo list :)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.