Re: [PATCH v5 1/7] scsi: ufs: Add "wb_on" sysfs node to control WB on/off

From: Bean Huo
Date: Tue Dec 22 2020 - 15:58:12 EST


On Tue, 2020-12-22 at 14:12 +0800, Can Guo wrote:
> > > + return -EOPNOTSUPP;
> > > +
> > > + if (kstrtouint(buf, 0, &wb_enable))
> > > + return -EINVAL;
> > > +
> > > + if (wb_enable != 0 && wb_enable != 1)
> > > + return -EINVAL;
> > > +
> > > + pm_runtime_get_sync(hba->dev);
> > > + res = ufshcd_wb_ctrl(hba, wb_enable);
> >
> > May this operation race with UFS shutdown flow?
> >
> > To be more clear, ufshcd_wb_ctrl() here may be executed after host
> > clock
> > is disabled by shutdown flow?
> >
> > If yes, we need to avoid it.
>
> I have the same doubt - can user still access sysfs nodes after
> system
> starts to run shutdown routines? If yes, then we need to remove all
> UFS
> sysfs nodes in ufshcd_shutdown().
>

No, we shouldn't do in this way, user space complains this. I think
the nodes in the sysfs can be shileded write, but the nodes shouldn't
be flash of its presence frequently.

Thanks,
Bean


> Thanks,
>
> Can Guo.