From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752677AbdHPSRz (ORCPT ); Wed, 16 Aug 2017 14:17:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:38704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752130AbdHPSRx (ORCPT ); Wed, 16 Aug 2017 14:17:53 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9903D219A8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Wed, 16 Aug 2017 14:17:49 -0400 From: Steven Rostedt To: Waiman Long Cc: Jens Axboe , Jeff Layton , "J. Bruce Fields" , Ingo Molnar , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] blktrace: Fix potentail deadlock between delete & sysfs ops Message-ID: <20170816141749.6c11d14c@gandalf.local.home> In-Reply-To: <6fa9f560-e1c2-f164-779f-aeefc5aa7017@redhat.com> References: <1502384553-14442-1-git-send-email-longman@redhat.com> <20170815191145.3c95680e@gandalf.local.home> <6fa9f560-e1c2-f164-779f-aeefc5aa7017@redhat.com> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 16 Aug 2017 14:14:36 -0400 Waiman Long wrote: > > You also just turned the mutex into a spinlock. What happens if we just > > preempted the owner of bdev->bd_mutex and are an RT task with higher > > priority? This will turn into a live lock. > > > >> + schedule(); > >> + } > >> > > That is OK because I used schedule() instead of cpu_relax() for > inserting delay. Please explain to me how that is OK? schedule is a nop if the current task is the highest priority task running, and it preempted the owner of the lock. Nothing will actually schedule. -- Steve