Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3136777ybc; Mon, 25 Nov 2019 09:31:51 -0800 (PST) X-Google-Smtp-Source: APXvYqwehcOmyAqeDNXGL6BTxwQqUlMLUF1o27nJDNZvPlPp0BODZrIRQ9pdZvACk8WzSCNgjGSW X-Received: by 2002:a5d:66cf:: with SMTP id k15mr32322214wrw.38.1574703111701; Mon, 25 Nov 2019 09:31:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574703111; cv=none; d=google.com; s=arc-20160816; b=RsuDe84Rp5lNgV0CXMbuvjblbiajCu9UWWFydfDhb2WM2l6AcZTtFyHVXIMwbzwdHe gpY7FT96EUVM7LcVTcpdXqmyZ/8WR2M1/xxFq6iFsIv9DhtQaZto9hjBLbC/qIwtPnP2 FlDxcMYkxFEAQUTIE+Oz/k5ipF2wh4xmhYgD9Nb/a+AxDxrVQ0aycLehh/yDypsvhsaf oZoden2967Akc7RgZiZTdZg5nrOWdcz/+Qu97y8+KTcGAEJzXcvvoK3b/Iftcq2hANjh 5ks3yMJs9AVqDqWoGFwyhg4CHtJNpIv5Y4nf5DjWUxHUxt51fa0dZe61U1VYRtXXxYLJ LlRQ== 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=C5f4xUL+V2+8/nQMkQs1b9op2wEG2TkCTmUU2i8ZzYk=; b=kDj7CNhFB4JUF+P0fVXXu4Wii+oYLqp3sXBTEKI5ZKmqiRh58IXN8evhN4ClrB+2sv h9ibS9jCl9/XOW514CgfkX3AYYYEehsAH21WDluGhPTQGpe25Klf1fS08o1/Qei+tEUx bGW84dTNrKRSalfnJ4ClMz4TcZp3PxWGKuCNs8OmVXcsoSzgGQzvxWNBwVBYLi0+dPv9 VezOh4Gj+3Q5NjiGsBs+KqfxwTIXr/9gryRBVdkPViwDWKv5IDR8NP8ZPKZukXw9jEOA 9FX1Xs/EZCHjLap4XNk/UapVISxhRPRvEDWfvTl37jIkn/3e+YnMXbttUV/S39tWmtvr 1DdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=AHgt+Qfs; 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 z9si6261214edd.86.2019.11.25.09.31.26; Mon, 25 Nov 2019 09:31:51 -0800 (PST) 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=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=AHgt+Qfs; 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 S1727332AbfKYMiv (ORCPT + 99 others); Mon, 25 Nov 2019 07:38:51 -0500 Received: from mail-io1-f66.google.com ([209.85.166.66]:33984 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbfKYMiu (ORCPT ); Mon, 25 Nov 2019 07:38:50 -0500 Received: by mail-io1-f66.google.com with SMTP id z193so16046209iof.1 for ; Mon, 25 Nov 2019 04:38:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=C5f4xUL+V2+8/nQMkQs1b9op2wEG2TkCTmUU2i8ZzYk=; b=AHgt+QfsItPF5DapufRvH6vvDvsst4aKQbSqxqP24tQdnEHkKoAlzB0ygK8TNXfyVh F+OVMDWjsnnNL/xUWvoZxYFLiUvdXPp3iz7blyK5pxMDVb6xcnh6GGRAGHeuUSfpzoUH BxGBA2oucqlYT6DqajybB3niI5Js8/u5FBjR8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C5f4xUL+V2+8/nQMkQs1b9op2wEG2TkCTmUU2i8ZzYk=; b=K/+t68UmMtV9PfWmdM6Ui6mLFhTTem2i+QQ/WTJeMg+zjSBH9KXGW02B30Bi54BamJ T2XQ3nqi29gUz6hlSv3R3ZScH4TaJe+HawvTAs7LmhWIgPK1VLD6diHVZv49Ek2npvF9 ZtbD4cjOec4e6CTGAjdgV5U+qbUmTNt9Jf2tBaieXHmnVvlWoJ9mkelCB1pEHDq5akR1 4u+yVEwg2ragS9fEySMHSqRXLQTTU61dBznCWCovODuaCnuEoJq8XaVsaPkRJs04ez2X diYcD1RIzqwV51taJP7s0ig1gQvhWRe7FORwAb7oLQoW+7ofpsoEQ4b4yXgXkgHWeYlQ qe0g== X-Gm-Message-State: APjAAAW+ZlXkbEa/w8hvhJnCoMxlnDY5bmdnrktNbhM/NGSplaZqLem0 D17TEThj/P8/00E6jg9O2RcSlfzyjVJJkLBleNjX3PEvuCo= X-Received: by 2002:a6b:b296:: with SMTP id b144mr23856761iof.63.1574685529947; Mon, 25 Nov 2019 04:38:49 -0800 (PST) MIME-Version: 1.0 References: <20191118022410.21023-1-msys.mizuma@gmail.com> In-Reply-To: <20191118022410.21023-1-msys.mizuma@gmail.com> From: Miklos Szeredi Date: Mon, 25 Nov 2019 13:38:38 +0100 Message-ID: Subject: Re: [PATCH] fuse: Fix the return code of fuse_direct_IO() to deal with the error for aio To: Masayoshi Mizuma Cc: linux-fsdevel@vger.kernel.org, Masayoshi Mizuma , linux-kernel@vger.kernel.org, virtio-fs@redhat.com Content-Type: multipart/mixed; boundary="000000000000a58caf05982b0b24" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000a58caf05982b0b24 Content-Type: text/plain; charset="UTF-8" On Mon, Nov 18, 2019 at 3:24 AM Masayoshi Mizuma wrote: > > From: Masayoshi Mizuma > > exit_aio() is sometimes stuck in wait_for_completion() after aio is issued > with direct IO and the task receives a signal. > > That is because kioctx in mm->ioctx_table is in use by aio_kiocb. > aio_kiocb->ki_refcnt is 1 at that time. That means iocb_put() isn't > called correctly. > > fuse_get_req() returns as -EINTR when it's blocked and receives a signal. > fuse_direct_IO() deals with the -EINTER as -EIOCBQUEUED and returns as > -EIOCBQUEUED even though the aio isn't queued. > As the result, aio_rw_done() doesn't handle the error, so iocb_put() isn't > called via aio_complete_rw(), which is the callback. Hi, Thanks for the report. Can you please test the attached patch (without your patch)? Thanks, Miklos --000000000000a58caf05982b0b24 Content-Type: text/x-patch; charset="US-ASCII"; name="fuse-fix-leak-of-fuse_io_priv.patch" Content-Disposition: attachment; filename="fuse-fix-leak-of-fuse_io_priv.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k3eesp440 LS0tCiBmcy9mdXNlL2ZpbGUuYyB8ICAgIDQgKysrLQogMSBmaWxlIGNoYW5nZWQsIDMgaW5zZXJ0 aW9ucygrKSwgMSBkZWxldGlvbigtKQoKLS0tIGEvZnMvZnVzZS9maWxlLmMKKysrIGIvZnMvZnVz ZS9maWxlLmMKQEAgLTcxMyw4ICs3MTMsMTAgQEAgc3RhdGljIHNzaXplX3QgZnVzZV9hc3luY19y ZXFfc2VuZChzdHJ1YwogCiAJaWEtPmFwLmFyZ3MuZW5kID0gZnVzZV9haW9fY29tcGxldGVfcmVx OwogCWVyciA9IGZ1c2Vfc2ltcGxlX2JhY2tncm91bmQoZmMsICZpYS0+YXAuYXJncywgR0ZQX0tF Uk5FTCk7CisJaWYgKGVycikKKwkJZnVzZV9haW9fY29tcGxldGVfcmVxKGZjLCAmaWEtPmFwLmFy Z3MsIGVycik7CiAKLQlyZXR1cm4gZXJyID86IG51bV9ieXRlczsKKwlyZXR1cm4gbnVtX2J5dGVz OwogfQogCiBzdGF0aWMgc3NpemVfdCBmdXNlX3NlbmRfcmVhZChzdHJ1Y3QgZnVzZV9pb19hcmdz ICppYSwgbG9mZl90IHBvcywgc2l6ZV90IGNvdW50LAo= --000000000000a58caf05982b0b24--