From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754288AbbBAXd2 (ORCPT ); Sun, 1 Feb 2015 18:33:28 -0500 Received: from mail-ig0-f177.google.com ([209.85.213.177]:38979 "EHLO mail-ig0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751698AbbBAXd0 (ORCPT ); Sun, 1 Feb 2015 18:33:26 -0500 MIME-Version: 1.0 In-Reply-To: <20150201221458.GN2974@kvack.org> References: <20150201144058.GM2974@kvack.org> <20150201221458.GN2974@kvack.org> Date: Sun, 1 Feb 2015 15:33:25 -0800 X-Google-Sender-Auth: ukNLDs7hev3fHpVsV-u2Ssui0pY Message-ID: Subject: Re: [GIT PULL] aio: fix sleeping while TASK_INTERRUPTIBLE From: Linus Torvalds To: Benjamin LaHaise Cc: linux-aio@kvack.org, Linux Kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 1, 2015 at 2:14 PM, Benjamin LaHaise wrote: > > It's ugly, but it actually is revealing a bug. Spurious wake ups caused > by the task already being added to ctx->wait when calling into mutex_lock() > could inadvertently cause things to go wrong. I can envision there being > code invoked that possibly expects a 1-1 relationship between sleeps and > wake ups, which being on the additional wait queue might break. So I'm looking at it, and I don't see it. One side uses wait_event_interruptible_hrtimeout(), which waits for the return value (or the timeout), and it doesn't matter how many times it gets woken up, regardless of what it's waiting for. If it gets extra wakeups, it will just go through the loop again. The other side is just a plain aio_read_events() -> aio_read_events_ring(), and that one just reads as many events as it can, unless some error happens. In other words, it really looks like the warning is spurious, and the comments about how the semaphore could cause it to loop around but it all works look entirely correct. So no, I don't see it revealing a bug at all. All I see is a spurious warning. What's the bug you think could happen? Linus