Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1868727ybh; Tue, 14 Jul 2020 09:19:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXEV4nIO9wnkompVjGDAz05EvagmT7diPqaP18M4PaQavCIIFQvUQ2WD3lUM7wIAsqeC21 X-Received: by 2002:aa7:d792:: with SMTP id s18mr5418488edq.7.1594743566590; Tue, 14 Jul 2020 09:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594743566; cv=none; d=google.com; s=arc-20160816; b=nu+wGmJZBQGAxXwP7QyefbzOBrsNzvh4pY2ANj8lvkMd+KfHBRL1lfN/V75gXnl9G1 wjxzOXzCfhA1HB8wJUbx90XlPUlHgEqneygKxch9fYhEq2IlA3QXicvpCdMrziNIIwsU NMIYXpEWTKiRHDeogh5AmsKdO5fVv3yydX4CZnPVZLQEdNdUEIrQ3U1jqg/C8bcQUn7j TdtSoxd/wqD76E3CFy9wIWmQojaMq93hvS1QToA2eBU+4d1xrZK0po8TVWbB3t8bsAzi Q7NY20gXTJymP2KbGnrVy09h4C7SKJg2cWCAsrUBVEkcibXMjAzTU/2tx3urAW6BtmKs Te2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Vsnmabuja1Zf/isyEJa3dlARvMtvEudCgzsYKCmI3SU=; b=pYqnS8TIm3x+3PPEh1eJjnm4vgvKbDP4p6hE7z9uDTCqvqERZlmT0NkDM2WWCyuugo xTIBTUmRL5nuxsy9ppJQCu5izlAoj2QxL8SOJPP0Pi6OrCKkl20nEsQW/uApx18ZFQxQ ESrcznHbNzWBy3BjVF59RDKhB5Kwq6qDlYnfmOerVeOI4NDuaXzIUue1uRpyWGf534Gb Tf3BEZOY04Oa+RPlW0UGjy6Qm0rS7qQx5Ez942BpaVhOqprjnb5wBOgM/6GhLMgIoytn vFb8g0p0bsjPnsn6QHQBCqRhpjhDKeM/1/1+Q+z6RD0vZsMDMwGM61hfe3V21WXJSqot zaUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T+my6tgy; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y5si11251280ejc.674.2020.07.14.09.19.03; Tue, 14 Jul 2020 09:19:26 -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=@kernel.org header.s=default header.b=T+my6tgy; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728526AbgGNQSx (ORCPT + 99 others); Tue, 14 Jul 2020 12:18:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:47182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726478AbgGNQSx (ORCPT ); Tue, 14 Jul 2020 12:18:53 -0400 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 605622251F; Tue, 14 Jul 2020 16:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594743532; bh=Arizj3kFgzEcL3Koyf1IoHEpYlDKy+RYAsYt5BODwnc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=T+my6tgyXE9IQIVevvThSfjhdhNcDPwiHAF99JP8td1Zbp4KR5sqD9/YD2xWrm7NE 8CTBTmZU52RSRd4L/WoM9hOaWIQaquWQ7Xo9JjUzbLP0jQXfn4sKo5bl5eHw4Pz4OY D8r6aXgKdnsXBHBMV/bu2MrBr4sRiqkkzN/8IFQA= Received: by mail-lj1-f180.google.com with SMTP id e8so23595707ljb.0; Tue, 14 Jul 2020 09:18:52 -0700 (PDT) X-Gm-Message-State: AOAM530l7QIKT++9ZK2mt90lFDekE1KO0T7XPm9vHNO/9tyUHEKiorkM 6kIGlKwhxEy921haOFjTEiA4++KQDPoXbEcu8tQ= X-Received: by 2002:a2e:88c6:: with SMTP id a6mr2700501ljk.27.1594743530708; Tue, 14 Jul 2020 09:18:50 -0700 (PDT) MIME-Version: 1.0 References: <20200709233545.67954-1-junxiao.bi@oracle.com> In-Reply-To: From: Song Liu Date: Tue, 14 Jul 2020 09:18:39 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] md: fix deadlock causing by sysfs_notify To: Junxiao Bi Cc: linux-raid , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Song