All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregkh@linuxfoundation.org (Greg Kroah-Hartman)
Subject: [PATCH for-4.19 06/12] staging: erofs: fix race when the managed cache is enabled
Date: Mon, 25 Feb 2019 16:51:20 +0100	[thread overview]
Message-ID: <20190225155120.GA12525@kroah.com> (raw)
In-Reply-To: <4efecbee-5e61-f8b4-a91a-3c14852bf574@huawei.com>

On Mon, Feb 25, 2019@11:07:19PM +0800, Gao Xiang wrote:
> 
> 
> On 2019/2/25 23:04, Greg Kroah-Hartman wrote:
> > On Wed, Feb 20, 2019@05:18:48PM +0800, Gao Xiang wrote:
> >> commit 51232df5e4b268936beccde5248f312a316800be upstream.
> >>
> >> When the managed cache is enabled, the last reference count
> >> of a workgroup must be used for its workstation.
> >>
> >> Otherwise, it could lead to incorrect (un)freezes in
> >> the reclaim path, and it would be harmful.
> >>
> >> A typical race as follows:
> >>
> >> Thread 1 (In the reclaim path)  Thread 2
> >> workgroup_freeze(grp, 1)                                refcnt = 1
> >> ...
> >> workgroup_unfreeze(grp, 1)                              refcnt = 1
> >>                                 workgroup_get(grp)      refcnt = 2 (x)
> >> workgroup_put(grp)                                      refcnt = 1 (x)
> >>                                 ...unexpected behaviors
> >>
> >> * grp is detached but still used, which violates cache-managed
> >>   freeze constraint.
> >>
> >> Reviewed-by: Chao Yu <yuchao0 at huawei.com>
> >> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
> >> Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> >> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
> >>
> >> Conflicts:
> >> 	drivers/staging/erofs/utils.c
> >> Updates:
> >> 	include/linux/xarray.h:
> >> 		add xa_untag_pointer,xa_tag_pointer,xa_pointer_tag
> >> 		from upstream 3159f943aafd in order to reduce
> >> 		conflicts.
> > 
> > No, sorry, I don't want to add xarray.h to 4.19.y, that's crazy.
> 
> Or can I define these xa_untag_pointer,xa_tag_pointer,xa_pointer_tag in
> a erofs header internally? it is acceptable?

No, that's not ok.

If you want to backport a subset of the api, and Matthew agrees with it
(I think he did), then let's backport a subset, as a single patch, that
matches the original patch comments and git id.

thanks,

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Gao Xiang <gaoxiang25@huawei.com>
Cc: stable@vger.kernel.org, Chao Yu <yuchao0@huawei.com>,
	linux-erofs@lists.ozlabs.org, miaoxie@huawei.com,
	Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH for-4.19 06/12] staging: erofs: fix race when the managed cache is enabled
Date: Mon, 25 Feb 2019 16:51:20 +0100	[thread overview]
Message-ID: <20190225155120.GA12525@kroah.com> (raw)
In-Reply-To: <4efecbee-5e61-f8b4-a91a-3c14852bf574@huawei.com>

On Mon, Feb 25, 2019 at 11:07:19PM +0800, Gao Xiang wrote:
> 
> 
> On 2019/2/25 23:04, Greg Kroah-Hartman wrote:
> > On Wed, Feb 20, 2019 at 05:18:48PM +0800, Gao Xiang wrote:
> >> commit 51232df5e4b268936beccde5248f312a316800be upstream.
> >>
> >> When the managed cache is enabled, the last reference count
> >> of a workgroup must be used for its workstation.
> >>
> >> Otherwise, it could lead to incorrect (un)freezes in
> >> the reclaim path, and it would be harmful.
> >>
> >> A typical race as follows:
> >>
> >> Thread 1 (In the reclaim path)  Thread 2
> >> workgroup_freeze(grp, 1)                                refcnt = 1
> >> ...
> >> workgroup_unfreeze(grp, 1)                              refcnt = 1
> >>                                 workgroup_get(grp)      refcnt = 2 (x)
> >> workgroup_put(grp)                                      refcnt = 1 (x)
> >>                                 ...unexpected behaviors
> >>
> >> * grp is detached but still used, which violates cache-managed
> >>   freeze constraint.
> >>
> >> Reviewed-by: Chao Yu <yuchao0@huawei.com>
> >> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
> >> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
> >>
> >> Conflicts:
> >> 	drivers/staging/erofs/utils.c
> >> Updates:
> >> 	include/linux/xarray.h:
> >> 		add xa_untag_pointer,xa_tag_pointer,xa_pointer_tag
> >> 		from upstream 3159f943aafd in order to reduce
> >> 		conflicts.
> > 
> > No, sorry, I don't want to add xarray.h to 4.19.y, that's crazy.
> 
> Or can I define these xa_untag_pointer,xa_tag_pointer,xa_pointer_tag in
> a erofs header internally? it is acceptable?

No, that's not ok.

If you want to backport a subset of the api, and Matthew agrees with it
(I think he did), then let's backport a subset, as a single patch, that
matches the original patch comments and git id.

thanks,

greg k-h

  reply	other threads:[~2019-02-25 15:51 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20  9:18 [PATCH for-4.19 00/12] erofs fixes for linux-4.19.y Gao Xiang
2019-02-20  9:18 ` Gao Xiang
2019-02-20  9:18 ` [PATCH for-4.19 01/12] staging: erofs: fix a bug when appling cache strategy Gao Xiang
2019-02-20  9:18   ` Gao Xiang
2019-02-20  9:18 ` [PATCH for-4.19 02/12] staging: erofs: complete error handing of z_erofs_do_read_page Gao Xiang
2019-02-20  9:18   ` Gao Xiang
2019-02-25 14:59   ` Greg Kroah-Hartman
2019-02-25 14:59     ` Greg Kroah-Hartman
2019-02-25 15:04     ` Gao Xiang
2019-02-25 15:04       ` Gao Xiang
2019-02-20  9:18 ` [PATCH for-4.19 03/12] staging: erofs: replace BUG_ON with DBG_BUGON in data.c Gao Xiang
2019-02-20  9:18   ` Gao Xiang
2019-02-20  9:18 ` [PATCH for-4.19 04/12] staging: erofs: drop multiref support temporarily Gao Xiang
2019-02-20  9:18   ` Gao Xiang
2019-02-20  9:18 ` [PATCH for-4.19 05/12] staging: erofs: remove the redundant d_rehash() for the root dentry Gao Xiang
2019-02-20  9:18   ` Gao Xiang
2019-02-20  9:18 ` [PATCH for-4.19 06/12] staging: erofs: fix race when the managed cache is enabled Gao Xiang
2019-02-20  9:18   ` Gao Xiang
2019-02-25 15:04   ` Greg Kroah-Hartman
2019-02-25 15:04     ` Greg Kroah-Hartman
2019-02-25 15:07     ` Gao Xiang
2019-02-25 15:07       ` Gao Xiang
2019-02-25 15:51       ` Greg Kroah-Hartman [this message]
2019-02-25 15:51         ` Greg Kroah-Hartman
2019-02-25 15:57         ` Gao Xiang
2019-02-25 15:57           ` Gao Xiang
2019-02-25 17:58         ` [PATCH for-4.19 1/2] xarray: Replace exceptional entries Gao Xiang
2019-02-25 17:58           ` Gao Xiang
2019-02-25 17:58           ` [PATCH for-4.19 2/2] staging: erofs: fix race when the managed cache is enabled Gao Xiang
2019-02-25 17:58             ` Gao Xiang
2019-02-25 18:27           ` [PATCH for-4.19 1/2] xarray: Replace exceptional entries Matthew Wilcox
2019-02-25 18:27             ` Matthew Wilcox
2019-02-26  1:21             ` Gao Xiang
2019-02-26  1:21               ` Gao Xiang
2019-02-26  5:14             ` [PATCH v2 " Gao Xiang
2019-02-26  5:14               ` Gao Xiang
2019-02-26  5:14               ` [PATCH v2 for-4.19 2/2] staging: erofs: fix race when the managed cache is enabled Gao Xiang
2019-02-26  5:14                 ` Gao Xiang
2019-02-26 12:43               ` [PATCH v2 for-4.19 1/2] xarray: Replace exceptional entries Gao Xiang
2019-02-26 12:43                 ` Gao Xiang
2019-03-04  5:13                 ` Gao Xiang
2019-03-04  5:13                   ` Gao Xiang
2019-03-13  9:18                   ` Gao Xiang
2019-03-13  9:18                     ` Gao Xiang
2019-02-25 15:25     ` [PATCH for-4.19 06/12] staging: erofs: fix race when the managed cache is enabled Matthew Wilcox
2019-02-25 15:25       ` Matthew Wilcox
2019-02-25 15:52       ` Greg Kroah-Hartman
2019-02-25 15:52         ` Greg Kroah-Hartman
2019-02-25 16:04         ` Matthew Wilcox
2019-02-25 16:04           ` Matthew Wilcox
2019-02-20  9:18 ` [PATCH for-4.19 07/12] staging: erofs: atomic_cond_read_relaxed on ref-locked workgroup Gao Xiang
2019-02-20  9:18   ` Gao Xiang
2019-02-20  9:18 ` [PATCH for-4.19 08/12] staging: erofs: fix `erofs_workgroup_{try_to_freeze, unfreeze}' Gao Xiang
2019-02-20  9:18   ` Gao Xiang
2019-02-20  9:18 ` [PATCH for-4.19 09/12] staging: erofs: add a full barrier in erofs_workgroup_unfreeze Gao Xiang
2019-02-20  9:18   ` Gao Xiang
2019-02-20  9:18 ` [PATCH for-4.19 10/12] staging: erofs: {dir, inode, super}.c: rectify BUG_ONs Gao Xiang
2019-02-20  9:18   ` [PATCH for-4.19 10/12] staging: erofs: {dir,inode,super}.c: " Gao Xiang
2019-02-20  9:18 ` [PATCH for-4.19 11/12] staging: erofs: unzip_{pagevec.h, vle.c}: " Gao Xiang
2019-02-20  9:18   ` [PATCH for-4.19 11/12] staging: erofs: unzip_{pagevec.h,vle.c}: " Gao Xiang
2019-02-20  9:18 ` [PATCH for-4.19 12/12] staging: erofs: unzip_vle_lz4.c, utils.c: " Gao Xiang
2019-02-20  9:18   ` [PATCH for-4.19 12/12] staging: erofs: unzip_vle_lz4.c,utils.c: " Gao Xiang
2019-02-22  8:35 ` [PATCH for-4.19 00/12] erofs fixes for linux-4.19.y Greg Kroah-Hartman
2019-02-22  8:35   ` Greg Kroah-Hartman
2019-02-22  9:03   ` Gao Xiang
2019-02-22  9:03     ` Gao Xiang
2019-02-25 15:28 ` Greg Kroah-Hartman
2019-02-25 15:28   ` Greg Kroah-Hartman

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=20190225155120.GA12525@kroah.com \
    --to=gregkh@linuxfoundation.org \
    /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.