Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4832626iob; Mon, 9 May 2022 02:42:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtpU7dHv/UU01R2GwMZBxDBpHx2Dp+YlOaMU1EqCp743CN48pz8+Hbsw7BEWSv5/8NGtZS X-Received: by 2002:a17:902:82c9:b0:15d:2e43:a0e5 with SMTP id u9-20020a17090282c900b0015d2e43a0e5mr15831951plz.64.1652089346985; Mon, 09 May 2022 02:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652089346; cv=none; d=google.com; s=arc-20160816; b=xJDFcUl2LPuwPp1ukg+5M4sDe1iXHnwZ4ASO4x65wKNfBuMkP79y9FvqwXHAXp95kk 15Pa1uXGw7CEHK3yPZYP2DJbD0bCaCM9Z4BfHTAngbbZxK5eimmboUZLd0h3pAUn2qQn GhiJztNRn/kIihjjMuobFva6OvvKd3eAonSxV8WaS3DqPNU0gp6NBVxAaNtZl/6f6u59 PleuZK6DYnWhOymgTi64MwYNSyPDpcGwWw93q2iry9JD7HXQgXpix6EC3dh7TkWSdVhF S8YCxiv1xT/zRK0wprQkFYAUMxY5GKWphW12GuB9+Sr30hzXSsJ33DzJFpVzPv9WSnu/ gvEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2GRWRPhcd0rt15ECuZFabRq69w9wuVQamAWN02KcSmc=; b=mwNARSYMt4f+fbnGEC+nmqBY4AsgouexI21HfxfKKptvwxGHMJCjKfyZANkwaMvuId +wz33V2mvY+eoVMeOb3BHBU07mTK6MXVqs4Awn3X7wXCDKLkgh7WdFX+gIE9TYvRY0la RNzqykevF0OR2uykPEHIoixhtb4DAU3Gu6bqt1GuRp7qmapoySh5IJ8ELzf+FJ1KHJpX gKemOvAnV3e/a4OZzhf8doPg1uSjrxAfhX92bs9GS5ua2iItWJ3tINQXJk8iqa2X6QrF 16dYGoKE0w7Q1wbEr4bbJ2EHgjVeNMcYFe/lw3//l/FSIDANzh/GmPI4zX+1bgdRAOnQ ndOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RC047+qj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b18-20020a170903229200b0015eb08a719esi12124768plh.238.2022.05.09.02.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 02:42:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RC047+qj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0400618B115; Mon, 9 May 2022 02:26:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238905AbiEDR0R (ORCPT + 99 others); Wed, 4 May 2022 13:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354721AbiEDRFU (ORCPT ); Wed, 4 May 2022 13:05:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3024847551; Wed, 4 May 2022 09:54:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B9E161899; Wed, 4 May 2022 16:54:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E997DC385A5; Wed, 4 May 2022 16:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683257; bh=x+zWKCJC/67mFShgCqaDcE2fmsKse7a2+RmC1lsdbpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RC047+qjJ+NHvBb4kmr+HG5ZKDL2ZpUnAXNVNsh+u1/naOKQ4NOtaelr3aPq1+LSo T22SvISgtz49C5iCRFlLvGUZMAUTfcAVqufnqdnDk//KAIkZ98cpxy2SjpSpL9bxRD +LnQS312C/MhMlghqoYZfmb4261KIwFmBUZCvHD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Gruenbacher , Sasha Levin Subject: [PATCH 5.15 122/177] gfs2: No short reads or writes upon glock contention Date: Wed, 4 May 2022 18:45:15 +0200 Message-Id: <20220504153104.053123041@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andreas Gruenbacher [ Upstream commit 296abc0d91d8b65d42224dd33452ace14491ad08 ] Commit 00bfe02f4796 ("gfs2: Fix mmap + page fault deadlocks for buffered I/O") changed gfs2_file_read_iter() and gfs2_file_buffered_write() to allow dropping the inode glock while faulting in user buffers. When the lock was dropped, a short result was returned to indicate that the operation was interrupted. As pointed out by Linus (see the link below), this behavior is broken and the operations should always re-acquire the inode glock and resume the operation instead. Link: https://lore.kernel.org/lkml/CAHk-=whaz-g_nOOoo8RRiWNjnv2R+h6_xk2F1J4TuSRxk1MtLw@mail.gmail.com/ Fixes: 00bfe02f4796 ("gfs2: Fix mmap + page fault deadlocks for buffered I/O") Signed-off-by: Andreas Gruenbacher Signed-off-by: Sasha Levin --- fs/gfs2/file.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 42fa4b5b81a0..eb5ea0262f3c 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -998,8 +998,6 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to) if (leftover != window_size) { if (gfs2_holder_queued(&gh)) goto retry_under_glock; - if (written) - goto out_uninit; goto retry; } } @@ -1076,8 +1074,6 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb, from->count = min(from->count, window_size - leftover); if (gfs2_holder_queued(gh)) goto retry_under_glock; - if (read && !(iocb->ki_flags & IOCB_DIRECT)) - goto out_uninit; goto retry; } } -- 2.35.1