Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3530564ybl; Mon, 3 Feb 2020 01:59:22 -0800 (PST) X-Google-Smtp-Source: APXvYqzJGJReNqVLX9U5LRuv2qCX8GQJIrVnbddfUoVjPfWudqnOELym9gbSVyA6BrODr/DQ56RS X-Received: by 2002:a05:6830:1f1c:: with SMTP id u28mr17859601otg.143.1580723962494; Mon, 03 Feb 2020 01:59:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580723962; cv=none; d=google.com; s=arc-20160816; b=p1ylNKD0uuBPryCLJSJ1Ja+ciHm8y4Hww3KUSgyJd9YAmzPJQSzh8DIRbFKgAz70km Y72nshZXeSVFb09ni8Da2T6u0BRfJwDbPVXPogva2jZnNbky9UJUq2fxk80ntH3bE2or PCXLmIsfO0caEHtNFmIjVr6Maa9U/ZRdYPC862JIDmm1Hsajk8uI0vkdl2vVeq5OWqn2 /QcsHNugRdAbfKr6KX2tWEIhQrFxFu8oMbRXJotjaaBYNdmtmrzVwR+fU4Uhj9sATomU X7CFKJcCsP2bSClvciDQNH8Q5ywTFHuXjbQujZ3+mNOaydjassVDgRl/VkqHtyk/cPRr DvtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=dZ0CkAKrvw9ctLYnwMQmMAA8WzxtbUuamTjQaOFEMDw=; b=0cRCllNT9YQB+9PHDH8jjPzP1WsHbVGcNjXs7jwUlmpVEwK772J9mkJKyJLFaeOtqu PpruA2ADknV+xVsLfQVXbIx95QXFnHVDMavSdP0ycRrR32c89Qc6KKzl57p7xnYQvpjH aY0WOAAtZFzHossE/2w4rHU9+1IN6bDlgzLlH45Kl9w5WqFD85u0vCwfmeQBhktLjYEU v/m9xc8IwatD9PJJ1TuBgYzXZOIJ2li5WwmGztzhVGGDb504MoRHqC85SaLVeJJ1fSbI fbW++28ZoIlnu5EeeNwrHmXv23abeTiX/oSPb85aO2LKuhZRp8n0MgAEq9yLM1dBYb7V orkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h21si8906627otr.235.2020.02.03.01.59.03; Mon, 03 Feb 2020 01:59:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727784AbgBCIQ2 (ORCPT + 99 others); Mon, 3 Feb 2020 03:16:28 -0500 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:49894 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727240AbgBCIQ2 (ORCPT ); Mon, 3 Feb 2020 03:16:28 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R701e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04446;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0Tp19xdv_1580717712; Received: from JosephdeMacBook-Pro.local(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0Tp19xdv_1580717712) by smtp.aliyun-inc.com(127.0.0.1); Mon, 03 Feb 2020 16:15:12 +0800 Subject: Re: [PATCH] ocfs2: fix the oops problem when write cloned file To: Gang He , "mark@fasheh.com" , "jlbec@evilplan.org" , "gechangwei@live.cn" , Shuning Zhang Cc: "linux-kernel@vger.kernel.org" , "ocfs2-devel@oss.oracle.com" , "akpm@linux-foundation.org" References: <20200121050153.13290-1-ghe@suse.com> From: Joseph Qi Message-ID: <9dfcde60-f8da-6458-4992-ae1d5dcc1ec1@linux.alibaba.com> Date: Mon, 3 Feb 2020 16:15:12 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/2/3 13:32, Gang He wrote: > Hi Joseph, > > before calling ocfs2_refcount_cow() in the function ocfs2_prepare_inode_for_write(), we do not use inode buffer_head. > So, we can let buffer_head is NULL. > But, when we invoke ocfs2_refcount_cow() function, we have to pass inode buffer_head without NULL pointer. > That is why writing clone file will cause oops and kill the user-space process. > Okay, so before commit e74540b28556, we will always get a valid buffer head in ocfs2_prepare_inode_for_refcount(). You can feel free to add: Reviewed-by: Joseph Qi BTW, you'd better resend the patch in a single thread, for the convenience of merging by akpm. > > ________________________________________ > From: Joseph Qi > Sent: Monday, February 3, 2020 1:15 PM > To: Gang He; mark@fasheh.com; jlbec@evilplan.org; gechangwei@live.cn; Shuning Zhang > Cc: linux-kernel@vger.kernel.org; ocfs2-devel@oss.oracle.com; akpm@linux-foundation.org > Subject: Re: [PATCH] ocfs2: fix the oops problem when write cloned file > > > > On 20/2/3 10:17, Gang He wrote: >> Hello Joseph, Changwei, Sunny and all, >> >> Could you help to review this patch? >> This patch will fix the oops problem caused by write ocfs2 clone files. >> The root cause is inode buffer head is NULL when calling ocfs2_refcount_cow. >> Secondly, we should use EX meta lock when calling ocfs2_refcount_cow. >> > Before commit e74540b28556, we may also use NULL buffer head in case of > overwrite, so why there is no such issue before? > > Thanks, > Joseph >