Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5271423imm; Tue, 26 Jun 2018 08:32:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpetZmT6hqFLYQN4SyEROat6lFfZZ2BtdvriC55g/RCiSM+jcXc+tXRv5iV/EgKo9BAxhiwX X-Received: by 2002:a62:4d01:: with SMTP id a1-v6mr2072874pfb.144.1530027149447; Tue, 26 Jun 2018 08:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530027149; cv=none; d=google.com; s=arc-20160816; b=dLPgupedUac8zuQMOMuKEtIxmv9KD8knV4Ab/H+wZNxh/AbfVip51lDUUg5ixrxX2y AFKC0Y88eT33PB3u4SdiY7w0ZC/cU2HSjwQTiOhuziQI+1cw45ofxOyxeWC2mDS+tI+S 2osQnvy8+orUju3nSJmi/sjD0VUcppfmRKoEnh5HhoEjcP+H2Up476C9XWTingpLR1pq KpbDe7Z0DrbnskIO1sZMU2riCXY9RboIlfBGHWOqUtQ9us9dBFtRFjvJj7Jvu5Cb7tiQ SLI5dLC0oX930kQS5iEtVjFV0mM2MsUtc/ownZLv7lQ4QUI+LlzXKabL0zuXyHz4K3iR SjVQ== 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:dkim-signature :arc-authentication-results; bh=gVBWdSF+YIlv4innns3u3ds5/mD6Tylbfj0OLrXoiHw=; b=ryED6FehGSsPS3qpmmTM01gi/SG9vo9ZOa1cagO2g+ZOy3VgAmOMfcBG37e64XUSbA CAiL0gPRcSTaRrmQ4FgZiVuf+VQ/4IBe3MMlk6gxnbK1YxU9Pko4c9bqgnntcbmit+U7 KGJbn3olGOVR2N8KVOCQ8e8bFneHhyshD04Ix3pitfC6ghi0KsNlYHBjSzddQGP+7Nu4 9iDiwzRL7T++TTT1BuH6FEgQAbPDF90m7hTSVdqh1pVfBQ1xHC2Tq3a5DzCk3V8kh6VX ZYtaEZbpSOFwQ4sEDfmdOSYAvfhDua8AdHWrdoXxdG+a7oyVx9NqYvaWmBL+PpjScU71 xlSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=XInUn69E; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a4-v6si1715568pfi.353.2018.06.26.08.32.14; Tue, 26 Jun 2018 08:32:29 -0700 (PDT) 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; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=XInUn69E; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752074AbeFZP3f (ORCPT + 99 others); Tue, 26 Jun 2018 11:29:35 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:10596 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751614AbeFZP3e (ORCPT ); Tue, 26 Jun 2018 11:29:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1530026974; x=1561562974; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=lOKmCM77Hd/NqRG7yjJZ4zCFpC+Q1NnnCZ/45CTdueI=; b=XInUn69EZdMZZ8j7Ic4xnnoBCoBLEbUxNi6Wm11Ib8FK72OSUsUrq2IC G1HTRxuef4th1DWOfTy3Jb6HgN1IO19lWNiNhnLU/BbvvU5vkVvsHCPDv ihmJMx1G63ClDAMMzQw5NnB8GZtv/DV6NUdFd8WOJU97ezFDBh9lAC/iL fgLEkgIvty8Fb8a30ITjI2XnHLR4KCvaojjKkPLHqCya/UAUzgrC0zAuH WiHaqi4efWJ/nUf2akdo3oXrQT6KlEY4oztoeYxGJVi9Ucsi6k/WQduPx 9FOcop1gcRPwXCejwcwwtzAaMq9ih5ey19K6v8AxUbkSNwhAHDW3dAz05 g==; X-IronPort-AV: E=Sophos;i="5.51,274,1526313600"; d="scan'208";a="81935108" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 26 Jun 2018 23:29:34 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 26 Jun 2018 08:18:53 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO [10.111.67.248]) ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 26 Jun 2018 08:29:34 -0700 Subject: Re: [PATCH] blk-mq-fs: invoke queue_for_each_hw_ctx under sysfs_lock To: Jianchao Wang , "axboe@kernel.dk" Cc: "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <1529907699-2054-1-git-send-email-jianchao.w.wang@oracle.com> From: Bart Van Assche Message-ID: Date: Tue, 26 Jun 2018 08:29:33 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1529907699-2054-1-git-send-email-jianchao.w.wang@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed 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 06/24/18 23:20, Jianchao Wang wrote: > blk_mq_run_hw_queues and blk_mq_start_stopped_hw_queues in > queue_state_write will invoke queue_for_each_hw_ctx. It will race > with blk_mq_realloc_hw_ctxs and incur NULL pointer reference. Put > them under sysfs_lock to serialize the accessing to queue_hw_ctx > and nr_hw_queues. The above looks wrong to me. blk_mq_realloc_hw_ctxs() starts with calling blk_mq_unregister_hctx(). That last function uses kobject_del() and kobject_del() waits until all pending sysfs callback functions for the deleted objects have finished. Bart.