[PATCH v2] erofs: convert workstn to XArray

Gao Xiang gaoxiang25 at huawei.com
Wed Feb 19 19:04:57 AEDT 2020


Hi Chao,

On Wed, Feb 19, 2020 at 03:46:16PM +0800, Chao Yu wrote:
> On 2020/2/17 11:30, Gao Xiang wrote:

[]

> > -	return err;
> > +	sbi = EROFS_SB(sb);
> > +repeat:
> > +	xa_lock(&sbi->managed_pslots);
> > +	pre = __xa_cmpxchg(&sbi->managed_pslots, grp->index,
> > +			   NULL, grp, GFP_NOFS);
> > +	if (pre) {
> 
> It looks __xa_cmpxchg() could return negative value in case of failure, e.g.
> no memory case. We'd better handle that case and old valid workgroup separately?

Thanks, that is a quite good catch!

To be honest, I'm not quite sure whether __xa_cmpxchg
could fail due to no memory here (as a quick scan, it
will do __xas_nomem loop interally.)

But anyway, it needs bailing out all potential errors
by using xa_is_err(). Will do some research and send
v3 then.

Thanks,
Gao Xiang



More information about the Linux-erofs mailing list