Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1876086ybh; Tue, 14 Jul 2020 09:31:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSsQ0ts8rXk8AKMZESNxksdwzpvPvUqwkWWPjn23brgSU5iMQr7JQ1wTejYcgiUfcvhXIb X-Received: by 2002:a17:906:ce43:: with SMTP id se3mr5073427ejb.543.1594744281292; Tue, 14 Jul 2020 09:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594744281; cv=none; d=google.com; s=arc-20160816; b=dr9BS4ZN9vgOdRJR+b0WToU1NQAHEnBq5s14ccvBGCMthBdgyQ2kV0FJP2GNS4j0wH EBdGq7W3eae+oa7DMUUWnMZY3Xk1g5LBlbXEpYXv8bTH4H3rUwLFWsROz/h9sk66rFUE ligOou7MuJnkGEti+ec2YxxKtlV0qVny+OTZr3M4AH3Qbo/CJk+Y/kl7g8JsZhiaxlrl IWZoNVIlkw0N3eKb2KrgyKpUMO2yP8TgQH1MJ6WFY7IPVuBbCkm4/5Kj82Ut1rLjd+Zg TU/7Lc6oVHwkCUN9WcmugI8JD+qw0QXm+XEfZnVHNpzyCQpI0cydJ7vtlydI0IIG6prG +4DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=4zHQ+qbqhXQr0oeHM5WRqgkfmxqCrBYvMylcuFCv2s8=; b=m0B79SrPN21U6JMl5RUBwzSTw3QAVrTAJqi9FkIesfAhTCfQF7MwFPgiPNkkQLSb00 s4qqn2XObdFE2833Efy+XARIDJIv3dK526TPEVoQretkiwp0+DtBwAcd8Izzy/sAe/o0 39aT6lhDb0XeWKmsLosMmjE1M1miaWkEHKs76kzedoQTWaxjgpCVNHQUc0hiH1dZk3Ho bVfRUafIT9HZkW/PNvKyOpztEs478uZuO5PL3GUUHmj2LZi+V09NFygozYqctz40A9T4 Y5a5aSFn6WUpuKYurjK95knoYSaLvipj8aHtiKDEYAiVlwa5djg/ptk9dRnXf001sZey d2TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=eU49U8Qv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q20si11254564edw.521.2020.07.14.09.30.57; Tue, 14 Jul 2020 09:31:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=eU49U8Qv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728773AbgGNQaE (ORCPT + 99 others); Tue, 14 Jul 2020 12:30:04 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:55296 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbgGNQaE (ORCPT ); Tue, 14 Jul 2020 12:30:04 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06EGGwk0131212; Tue, 14 Jul 2020 16:30:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=4zHQ+qbqhXQr0oeHM5WRqgkfmxqCrBYvMylcuFCv2s8=; b=eU49U8Qv6hRHePqo9ugiHPg5XtBHsq1FFXXc/aWFAreRwSc7EHDfPKyqTpKNQG7Ns/Sg 1SsvyqdxJNc9CAuoDUFRxqhzXRDqfX4AUhy4gOSdfBeW4wiGB++0aETihp2FIA2jr5v2 /WNS4wr8tol3aWEt2syUVMT4dBGAcbPBrhRShlygxJHkdxc06SxaQfh3IalT2TZpqkOU gU6xUt1EVYdU6uj8Yv4p4aHCT2BHN/2OY3ewqFABDbLn1PCIwMRPDu0THAiZNXtuzoPW XVX+W/nTABjAj+2BKIJulHfRn/nHH2TiPmHn5psWrZyCWRuS+z6t/H+jk06sHzcWXQbX 6A== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 3275cm6ee6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 14 Jul 2020 16:30:01 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06EGHbOY095955; Tue, 14 Jul 2020 16:30:01 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 327q0pj5dt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Jul 2020 16:30:01 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 06EGU09I020069; Tue, 14 Jul 2020 16:30:00 GMT Received: from dhcp-10-159-135-64.vpn.oracle.com (/10.159.135.64) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 14 Jul 2020 09:30:00 -0700 Subject: Re: [PATCH] md: fix deadlock causing by sysfs_notify To: Song Liu Cc: linux-raid , open list References: <20200709233545.67954-1-junxiao.bi@oracle.com> From: Junxiao Bi Message-ID: <23a115e4-0d48-9186-c606-89d526649372@oracle.com> Date: Tue, 14 Jul 2020 09:29:41 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9681 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 phishscore=0 suspectscore=3 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007140120 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9681 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 priorityscore=1501 bulkscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007140120 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/14/20 9:18 AM, Song Liu wrote: > On Mon, Jul 13, 2020 at 11:41 PM Junxiao Bi wrote: >> On 7/13/20 11:17 PM, Song Liu wrote: >> >>> On Thu, Jul 9, 2020 at 4:36 PM Junxiao Bi wrote: >>>> The following deadlock was captured. The first process is holding 'kernfs_mutex' >>>> and hung by io. The io was staging in 'r1conf.pending_bio_list' of raid1 device, >>>> this pending bio list would be flushed by second process 'md127_raid1', but >>>> it was hung by 'kernfs_mutex'. Using sysfs_notify_dirent_safe() to replace >>>> sysfs_notify() can fix it. There were other sysfs_notify() invoked from io >>>> path, removed all of them. >>>> >>> [...] >>>> Cc: stable@vger.kernel.org >>>> Signed-off-by: Junxiao Bi >>> Thanks for the patch. It looks good in general. One question though, do we >>> need the same change the following line in md.c:level_store()? >>> >>> sysfs_notify(&mddev->kobj, NULL, "level"); >> Thanks for the review. This one is not in io path, looks it's safe. I >> can change it if you want to align it with others. > This one is the only leftover. Let's also change it. Sure, i will send a v2. Thanks, Junxiao. > > Thanks, > Song