From patchwork Sun Jun 9 15:41:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Smelkov X-Patchwork-Id: 10983739 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D7C96C5 for ; Sun, 9 Jun 2019 16:11:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6979328802 for ; Sun, 9 Jun 2019 16:11:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B61B2880B; Sun, 9 Jun 2019 16:11:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,URIBL_GREY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBD5828802 for ; Sun, 9 Jun 2019 16:11:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729036AbfFIQLF (ORCPT ); Sun, 9 Jun 2019 12:11:05 -0400 Received: from mail180-16.suw31.mandrillapp.com ([198.2.180.16]:28481 "EHLO mail180-16.suw31.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728678AbfFIQLF (ORCPT ); Sun, 9 Jun 2019 12:11:05 -0400 X-Greylist: delayed 906 seconds by postgrey-1.27 at vger.kernel.org; Sun, 09 Jun 2019 12:11:04 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=mandrill; d=nexedi.com; h=From:Subject:To:Cc:Message-Id:Date:MIME-Version:Content-Type:Content-Transfer-Encoding; i=kirr@nexedi.com; bh=UBm1Ha65NyTbaemRU67DRfuweZgj6OScpzVWtCG9DoQ=; b=HIUhbas94J1r89ScLpqSfNkumwwvYd/GhI6QknLp5CFJe87WJ450/a3Pxq+SDjc99skw/mNKSKw/ Vp2NwY8Dq+PI/fZBJiRwaW8s0iUQEZ03OVqHzvBYQShp9i7g6P9yJudsDqV6pCmOzu+NcbcjvhU2 B/4934m3X5Wvnd+hEzE= Received: from pmta03.mandrill.prod.suw01.rsglab.com (127.0.0.1) by mail180-16.suw31.mandrillapp.com id hvknpg22sc0k for ; Sun, 9 Jun 2019 15:41:09 +0000 (envelope-from ) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; i=@mandrillapp.com; q=dns/txt; s=mandrill; t=1560094869; h=From : Subject : To : Cc : Message-Id : Date : MIME-Version : Content-Type : Content-Transfer-Encoding : From : Subject : Date : X-Mandrill-User : List-Unsubscribe; bh=UBm1Ha65NyTbaemRU67DRfuweZgj6OScpzVWtCG9DoQ=; b=a+VFLM2ExpaKCAQF0H8h0E/lE56cMA1n/XNSe73uouFiRvE4bb9HNLbyjYylbhDN4Iu82w IqK0SGzmM+PvIrKd+4LUMR+CEVX/TdU/HLjY7eqpRvE0h47BDz7II3YUSIFkKlLTNmr7qZrG qRBpKuOpQ6NtXpjjG/pSoqT4jLKko= From: Kirill Smelkov Subject: [PATCH 3.16 0/2] Fix FUSE read/write deadlock on stream-like files Received: from [87.98.221.171] by mandrillapp.com id bbaee20505ba421fb645c4f58d18926a; Sun, 09 Jun 2019 15:41:09 +0000 X-Mailer: git-send-email 2.20.1 To: , Ben Hutchings Cc: Sasha Levin , Greg Kroah-Hartman , Linus Torvalds , Miklos Szeredi , , , Kirill Smelkov Message-Id: <20190609135607.9840-1-kirr@nexedi.com> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=31050260.bbaee20505ba421fb645c4f58d18926a X-Mandrill-User: md_31050260 Date: Sun, 09 Jun 2019 15:41:09 +0000 MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello stable team, Please consider applying the following 2 patches to Linux-3.16 stable tree. The patches fix regression introduced in 3.14 where both read and write started to run under lock taken, which resulted in FUSE (and many other drivers) deadlocks for cases where stream-like files are used with read and write being run simultaneously. Please see complete problem description in upstream commit 10dce8af3422 ("fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock"). The actual FUSE fix (upstream commit bbd84f33652f "fuse: Add FOPEN_STREAM to use stream_open()") was merged into 5.2 with `Cc: stable@vger.kernel.org # v3.14+` mark and is already included into 5.1, 5.0 and 4.19 stable trees. However for some reason it is not (yet ?) included into 4.14, 4.9, 4.4, 3.18 and 3.16 trees. The patches fix a real problem into which my FUSE filesystem ran, and which also likely affects OSSPD (full details are in the patches description). Please consider including the fixes into 3.16 (as well as into other stable trees - I'm sending corresponding series separately - - one per tree). Thanks beforehand, Kirill P.S. the patches have been already a bit discussed in stable context some time ago: https://lore.kernel.org/linux-fsdevel/CAHk-=wgh234SyBG810=vB360PCzVkAhQRqGg8aFdATZd+daCFw@mail.gmail.com/ https://lore.kernel.org/linux-fsdevel/20190424183012.GB3798@deco.navytux.spb.ru/ https://lore.kernel.org/linux-fsdevel/20190424191652.GE3798@deco.navytux.spb.ru/ ... Kirill Smelkov (2): fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock fuse: Add FOPEN_STREAM to use stream_open() drivers/xen/xenbus/xenbus_dev_frontend.c | 2 +- fs/fuse/file.c | 4 +- fs/open.c | 18 ++ fs/read_write.c | 5 +- include/linux/fs.h | 4 + include/uapi/linux/fuse.h | 2 + scripts/coccinelle/api/stream_open.cocci | 363 +++++++++++++++++++++++ 7 files changed, 394 insertions(+), 4 deletions(-) create mode 100644 scripts/coccinelle/api/stream_open.cocci