Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4811353iob; Mon, 9 May 2022 02:06:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiWflYh9zbnjnyxPXq0aAmV6PBhSc7170BXtsxzNAxVcCsI8+21tCD9DNe3ZedhD5hwRLz X-Received: by 2002:a63:cc4f:0:b0:3c5:fc22:f6a with SMTP id q15-20020a63cc4f000000b003c5fc220f6amr12449687pgi.67.1652087218095; Mon, 09 May 2022 02:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652087218; cv=none; d=google.com; s=arc-20160816; b=cTvHuOZnvp35bLPO1pjp7nOEvbLUW5vyE0INjU0bi7/l9lBrpTXk1fcvUz6K/cfdId 6dNoPg6p9aeQbleZX18Z/PM2rFpnm+8sGT3clWLKh4RWRUv5BVEf0o820u958UysFUOr scQM6YTYET8ZeFcaXMIA3bX6OhyXFddkpK9y9TwvPf2gznrlOtxheZLmwmqy6VElQwRy KP8heplMxdQ1yC45mAJGv32CAVr/mHgOgkqCNyJYrA/mQ73qHoU1nVPScqxf9I8KIu3k q+ummBzVaMFCzOdfT7I279Y/Dkv0W7s93c03ZWVHvRNuqc8pv9bjBqiSv/TA5RC9YCHL O1Jg== 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=Vrue+3wRmdN8DLCpqkXpYMKNEH6g6T3bpzWxyUoE8Gk=; b=ri2NGo5ZlatiU6gEFIWMZeXXXKRmgDzqrwLSz34gNhfjBW+6flYqjPHqAMOhU0SkfZ QB6rbm+iuAcW3+qDOvuwvuqMHQP2EZtUWNoKJniuquIubUU4XB0C9TdWkctU5c3CuiJc Nb0q1V0aBhf4V1yJEhCeBl6eEV4Oi/YN8vYooq4wy2xy6q1jOqYvZCoBlVeNBI4X258k aTST9oZqzfRfEMBcW5Dzv7+BpM7Ck9Rdljh+/xK4+Uo023LedYUHQHBxC/HXMy6XW5W6 zp6yDeIdOgEAn/cjbnW9r+2KOgqEXCIan/oFhYSy/ELK5JeWOgkR10hwxRJJJKruDJly 6Y0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WvSRJ4Md; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id o21-20020a637315000000b003c60f6c2f55si12924181pgc.675.2022.05.09.02.06.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 02:06:58 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WvSRJ4Md; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 9339316A5FF; Mon, 9 May 2022 01:52:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355412AbiEDR0o (ORCPT + 99 others); Wed, 4 May 2022 13:26:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355091AbiEDRFi (ORCPT ); Wed, 4 May 2022 13:05:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFF1149CA8; Wed, 4 May 2022 09:54:18 -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 ams.source.kernel.org (Postfix) with ESMTPS id 7728AB827A3; Wed, 4 May 2022 16:54:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF395C385AF; Wed, 4 May 2022 16:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683256; bh=hNs9+GG7P/OSBBSbROM5/66FARCO1Gc+QL6VOtw+Q+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WvSRJ4MdrRTPXgoEtu5+1SJHqAyQxcvXii8llc6ux+pqPFMHR96EmL0n/NsZUbeUY qFTpcp88Rd+l8p6DuP0FC0DYObl2gzgkfUerZqvMfKh/sIYrtltD0JTseNuV7H2/On Gd5T0sZGN4FQ2FLfo9RZoZzQaK/PhNVpvT9x1OKM= 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 121/177] gfs2: Make sure not to return short direct writes Date: Wed, 4 May 2022 18:45:14 +0200 Message-Id: <20220504153103.971992183@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 3bde4c48586074202044456285a97ccdf9048988 ] When direct writes fail with -ENOTBLK because we're writing into a hole (gfs2_iomap_begin()) or because of a page invalidation failure (iomap_dio_rw()), we're falling back to buffered writes. In that case, when we lose the inode glock in gfs2_file_buffered_write(), we want to re-acquire it instead of returning a short write. Signed-off-by: Andreas Gruenbacher Signed-off-by: Sasha Levin --- fs/gfs2/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 964c19e27ce2..42fa4b5b81a0 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -1076,7 +1076,7 @@ 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) + if (read && !(iocb->ki_flags & IOCB_DIRECT)) goto out_uninit; goto retry; } -- 2.35.1