All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <gaoxiang25@huawei.com>
To: Chao Yu <yuchao0@huawei.com>
Cc: Miao Xie <miaoxie@huawei.com>,
	linux-erofs@lists.ozlabs.org, LKML <linux-kernel@vger.kernel.org>,
	Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH v2] erofs: convert workstn to XArray
Date: Wed, 19 Feb 2020 16:04:57 +0800	[thread overview]
Message-ID: <20200219080456.GA126843@architecture4> (raw)
In-Reply-To: <58f1ff26-e1f8-96a4-fa7b-ee86f972b0aa@huawei.com>

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


WARNING: multiple messages have this Message-ID (diff)
From: Gao Xiang <gaoxiang25@huawei.com>
To: Chao Yu <yuchao0@huawei.com>
Cc: <linux-erofs@lists.ozlabs.org>,
	Matthew Wilcox <willy@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Miao Xie <miaoxie@huawei.com>
Subject: Re: [PATCH v2] erofs: convert workstn to XArray
Date: Wed, 19 Feb 2020 16:04:57 +0800	[thread overview]
Message-ID: <20200219080456.GA126843@architecture4> (raw)
In-Reply-To: <58f1ff26-e1f8-96a4-fa7b-ee86f972b0aa@huawei.com>

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


  reply	other threads:[~2020-02-19  8:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-17  3:30 [PATCH v2] erofs: convert workstn to XArray Gao Xiang
2020-02-17  3:30 ` Gao Xiang
2020-02-19  7:46 ` Chao Yu
2020-02-19  7:46   ` Chao Yu
2020-02-19  8:04   ` Gao Xiang [this message]
2020-02-19  8:04     ` Gao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200219080456.GA126843@architecture4 \
    --to=gaoxiang25@huawei.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=willy@infradead.org \
    --cc=yuchao0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.