From mboxrd@z Thu Jan 1 00:00:00 1970 From: gregkh@linuxfoundation.org (Greg Kroah-Hartman) Date: Mon, 25 Feb 2019 16:04:49 +0100 Subject: [PATCH for-4.19 06/12] staging: erofs: fix race when the managed cache is enabled In-Reply-To: <20190220091854.19242-7-gaoxiang25@huawei.com> References: <20190220091854.19242-1-gaoxiang25@huawei.com> <20190220091854.19242-7-gaoxiang25@huawei.com> Message-ID: <20190225150449.GD16015@kroah.com> 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 > Signed-off-by: Gao Xiang > Signed-off-by: Greg Kroah-Hartman > Signed-off-by: Gao Xiang > > 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. And even if we did, you do not slip it in as part of a different patch, it should come in as its own patch, with the same git commit id that it landed in 4.20 with. Please fix this up... greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93D71C43381 for ; Mon, 25 Feb 2019 15:04:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 57450213A2 for ; Mon, 25 Feb 2019 15:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551107094; bh=HOc7rEoJ/V85NYKdkgjszvr3ufw3Mhj4+FaFE4F9rug=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=JaSa5GuUHAMeeXGM9c2uEdoifyBVpdXV2EecsA5tMpXBJK0Up8IXpVd7CmNBemSTA FOGumQieCYy9Cv7P8XWa4yf/e9DPvqCEyZ6162SJMHGesj/Zj8K6L5ezO3luR66V11 BACOXYvrZrGEGnPEsiYnVy6P+2SiRNKrEKBDI15g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727490AbfBYPEx (ORCPT ); Mon, 25 Feb 2019 10:04:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:44478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727473AbfBYPEx (ORCPT ); Mon, 25 Feb 2019 10:04:53 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 58C912087C; Mon, 25 Feb 2019 15:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551107092; bh=HOc7rEoJ/V85NYKdkgjszvr3ufw3Mhj4+FaFE4F9rug=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fc1crl7MCw/W4/zlBuoEfPewGK+gW0U9sNMdOFkUzK7KcMIYDg+kZtGx1Ima8zOs3 MGWy+vN7dtFpLJlNUuOU5vbd6uBuGDG1du4pnCyd25jiIM++hxRq2AaS3E0AtBY8ch 7IP7RyDJskT1djpaNvjPHcokWKpavOPK8d+zyDhw= Date: Mon, 25 Feb 2019 16:04:49 +0100 From: Greg Kroah-Hartman To: Gao Xiang Cc: stable@vger.kernel.org, Chao Yu , linux-erofs@lists.ozlabs.org, miaoxie@huawei.com, Matthew Wilcox Subject: Re: [PATCH for-4.19 06/12] staging: erofs: fix race when the managed cache is enabled Message-ID: <20190225150449.GD16015@kroah.com> References: <20190220091854.19242-1-gaoxiang25@huawei.com> <20190220091854.19242-7-gaoxiang25@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190220091854.19242-7-gaoxiang25@huawei.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 > Signed-off-by: Gao Xiang > Signed-off-by: Greg Kroah-Hartman > Signed-off-by: Gao Xiang > > 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. And even if we did, you do not slip it in as part of a different patch, it should come in as its own patch, with the same git commit id that it landed in 4.20 with. Please fix this up... greg k-h