From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D5D5C169C4 for ; Wed, 6 Feb 2019 14:31:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF415217F9 for ; Wed, 6 Feb 2019 14:31:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="AonU/yHK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729347AbfBFObz (ORCPT ); Wed, 6 Feb 2019 09:31:55 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55778 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726732AbfBFObz (ORCPT ); Wed, 6 Feb 2019 09:31:55 -0500 Received: by mail-wm1-f68.google.com with SMTP id y139so2673804wmc.5 for ; Wed, 06 Feb 2019 06:31:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xjXLoJcvMJbAaP+kWkA62YupsRzX+CPloKl6bSpGce8=; b=AonU/yHKK5I+YB6TIJDjVX5c+UcRHkGGvh/C6Y8ZK9DuEriV/+Eccfhi2NATzEElvP ZlCpf3sXX0IMTIU1iZf2Xwy3kDcZfAgD4xfOjn5cETjmMm5/wLXOW8Ih1yU/jKiBYejb rNxdV22KJjU6o3M6ND9RmyVXqK57yr5RYN5ZI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=xjXLoJcvMJbAaP+kWkA62YupsRzX+CPloKl6bSpGce8=; b=TzvFAcF6Urjq3W/vAwpwecw+VMAvmyU3bVk6/Z0NnBoWNWVc0o83P3JrnHeL6DizFh fIAvQcT97V6kR+96WWqwRKa0qpsei5QVccLxc3HcY6DGAS8/OcZRG83JGrh87T9m/rqz JMOE7GxyYMqDTHQYl3qgHnkS9wfVMbOccJiFd2hladWQPU3V0ld1cNoG4AJNvpyx/RgP CkpHKogfeLcYGCySBttmEfgQk9sODp8GvcGdTICWY5qZnPZgsndknSPSqasdyufz08QV U5inDY42jgEi1/hQ8VRhEjzItGFv4vuGPKKAwyvhg71M9OhbvQXYGSC4JAXrb6X3HhcU BKpg== X-Gm-Message-State: AHQUAuZGtIVj0rVkPJRGZKfT/lPWj6U50rF2V6dw/AY95w1F7I03GKIE 5vjc6tuuZ5k+u/FmayjGgUsP9Q== X-Google-Smtp-Source: AHgI3Ia/kmIrrXjoTUjWgKe6tsJR3mPttMxvERcl8PBx8qqwRhJ325BvRLBRBYAMnzyeo/K9NlBRUQ== X-Received: by 2002:a7b:cb8d:: with SMTP id m13mr3387601wmi.126.1549463513512; Wed, 06 Feb 2019 06:31:53 -0800 (PST) Received: from veci.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id s132sm14064955wmf.28.2019.02.06.06.31.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Feb 2019 06:31:52 -0800 (PST) Date: Wed, 6 Feb 2019 15:31:49 +0100 From: Miklos Szeredi To: Christoph Hellwig Cc: Bart Van Assche , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-aio , syzbot , Avi Kivity , Eric Dumazet , stable Subject: Re: [PATCH] aio: Fix locking in aio_poll() Message-ID: <20190206143149.GB19821@veci.piliscsaba.redhat.com> References: <20190204174555.83603-1-bvanassche@acm.org> <20190204174900.GA16229@lst.de> <1549414384.34241.77.camel@acm.org> <20190206083626.GA19821@veci.piliscsaba.redhat.com> <20190206134758.GB29185@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190206134758.GB29185@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Wed, Feb 06, 2019 at 02:47:58PM +0100, Christoph Hellwig wrote: > Just use the waitqueue API properly in fuse and we are done: No, the waitqueue implementation is not assuming disabled irqs, only AIO is. How about this? Thanks, Miklos --- diff --git a/fs/aio.c b/fs/aio.c index b906ff70c90f..18b1d3947592 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1679,6 +1679,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, struct poll_iocb *req = container_of(wait, struct poll_iocb, wait); struct aio_kiocb *iocb = container_of(req, struct aio_kiocb, poll); __poll_t mask = key_to_poll(key); + unsigned long flags; req->woken = true; @@ -1688,9 +1689,9 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, return 0; /* try to complete the iocb inline if we can: */ - if (spin_trylock(&iocb->ki_ctx->ctx_lock)) { + if (spin_trylock_irqsave(&iocb->ki_ctx->ctx_lock, flags)) { list_del(&iocb->ki_list); - spin_unlock(&iocb->ki_ctx->ctx_lock); + spin_unlock_irqrestore(&iocb->ki_ctx->ctx_lock, flags); list_del_init(&req->wait.entry); aio_poll_complete(iocb, mask);