[lustre-devel] [PATCH 32/38] lustre: osc: restore cl_loi_list_lock

James Simmons jsimmons at infradead.org
Fri Aug 17 17:59:07 PDT 2018


> > Access to struct client_obd should be protected with the spinlock
> > cl_loi_list_lock. This was dropped during the port to sysfs so
> > restore the proper locking.
> >
> > Signed-off-by: James Simmons <jsimmons at infradead.org>
> > ---
> >  drivers/staging/lustre/lustre/osc/lproc_osc.c | 36 +++++++++++++++++++++++----
> >  1 file changed, 31 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c
> > index 3c31e98..5fb7a16 100644
> > --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c
> > +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c
> > @@ -80,8 +80,13 @@ static ssize_t max_rpcs_in_flight_show(struct kobject *kobj,
> >  	struct obd_device *dev = container_of(kobj, struct obd_device,
> >  					      obd_kset.kobj);
> >  	struct client_obd *cli = &dev->u.cli;
> > +	ssize_t len;
> >  
> > -	return sprintf(buf, "%u\n", cli->cl_max_rpcs_in_flight);
> > +	spin_lock(&cli->cl_loi_list_lock);
> > +	len = sprintf(buf, "%u\n", cli->cl_max_rpcs_in_flight);
> > +	spin_unlock(&cli->cl_loi_list_lock);
> 
> Why do you think a spinlock is needed here?
> How could you even end up with an incorrect value?

I see both mdc sysfs and the osc sysfs layer being able to
modify cl_max_rpcs_in_flight. Andreas is the struct client_obd
shared between both the osc and mdc layer or does each subsystem
contain a unique cli in struct obd_device?


More information about the lustre-devel mailing list