From nobody Mon May 6 03:17:04 2024 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1641562640850969.8114867358703; Fri, 7 Jan 2022 05:37:20 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238856AbiAGNhT (ORCPT ); Fri, 7 Jan 2022 08:37:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238475AbiAGNhS (ORCPT ); Fri, 7 Jan 2022 08:37:18 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70CCEC061574 for ; Fri, 7 Jan 2022 05:37:18 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id c9-20020a17090a1d0900b001b2b54bd6c5so12014040pjd.1 for ; Fri, 07 Jan 2022 05:37:18 -0800 (PST) Received: from localhost.localdomain ([94.177.118.38]) by smtp.googlemail.com with ESMTPSA id h4sm8282441pjk.2.2022.01.07.05.37.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 05:37:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vtkNWuyheWVSf68PWKxrLpobqQHGirx2hOFiSE7ChDM=; b=J/a1oXzpAVBVL83H3AIMREpjgTXahGdH1QDPZMRPhS2QZo/e9FhuDDTMued19ICsv8 zLp8hRUAWjQ3CtHw5A9c85SEeLxKIuQv9QcPThoMeRKRF30GaFuPoYDoW5Xw6AFiz5rF I6PX+5WQkwm0syfIqQLTCFvBZUjV68yPzyshVYCXfE7zgDBM4HE3JPGCqHeguXd9vRUX V/FcmHzVx+zUE71h5b4qN1Xq9ooWRK9UObBPcplSNTMcnRhg3hUWpLdTgQuEX1ffRsC5 CiQ+abEK7KHTdrKORBTj6WVJNHHyghgH6lzO86KhJ70o1MBYNX/z7j7zvRSutegNmgfQ vxIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vtkNWuyheWVSf68PWKxrLpobqQHGirx2hOFiSE7ChDM=; b=ArfDrcnJONOd0HABBNsQIh7em+QfpY7H9McdS6meGJyKo9gzB4AHa1KF/hNAEl41hl oK/o8OJR3oFl69QDimGu9h997AL+dgHimTPdlvybn3fQOnMKJQRIAk5LzycAChB50taN 0rncd5XEaX0qpK3UZzqXJegeheIQf4wwfBJSvR7UAMSj26nNk6ykRyvAyvZ+2cMB+k7O pTOh5jKiJIS7z82zKFfbcCKTyuNLk8IruarmmBh+f5V9o+lXvqe6goDL2axV/EgupukD trPLiu97qYiKjUY1w1AOtPnvsHosrFqipxxlLPrJlrIMjSN5LyFfvhJnxr1QVoEZqaTN 0wlw== X-Gm-Message-State: AOAM533k5C/dSDR2bRQqt/knikTAFbQKrX3raZUPnvqcAzq5SY1i2f0b Ne7W8ir0xW2ncuKtnrpPbYA= X-Google-Smtp-Source: ABdhPJxaJvviRqH2N90C3l0TfERl3azSjtGZzzymuRYYOhuM/LECebZRtdBjeOoeGZnERSZl7HJa7Q== X-Received: by 2002:a17:902:bd4b:b0:149:460a:9901 with SMTP id b11-20020a170902bd4b00b00149460a9901mr63289863plx.44.1641562637852; Fri, 07 Jan 2022 05:37:17 -0800 (PST) From: Qinghua Jin Cc: Qinghua Jin , Colin Ian King , Jan Kara , Christian Brauner , Andrew Morton , Greg Kroah-Hartman , James Morris , linux-kernel@vger.kernel.org Subject: [PATCH v2] minix: fix bug when opening a file with O_DIRECT Date: Fri, 7 Jan 2022 21:36:25 +0800 Message-Id: <20220107133626.413379-1-qhjin.dev@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220107113254.bkfpud453zivotov@wittgenstein> References: <20220107113254.bkfpud453zivotov@wittgenstein> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641562643212100001 Content-Type: text/plain; charset="utf-8" Testcase: 1. create a minix file system and mount it 2. open a file on the file system with O_RDWR|O_CREAT|O_TRUNC|O_DIRECT 3. open fails with -EINVAL but leaves an empty file behind. All other open() failures don't leave the failed open files behind. It is hard to check the direct_IO op before creating the inode. Just as ext4 and btrfs do, this patch will resolve the issue by allowing to create the file with O_DIRECT but returning error when writing the file. Reported-by: Colin Ian King Reviewed-by: Jan Kara Acked-by: Christian Brauner Signed-off-by: Qinghua Jin --- fs/minix/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/minix/inode.c b/fs/minix/inode.c index a71f1cf894b9..d4bd94234ef7 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -447,7 +447,8 @@ static const struct address_space_operations minix_aops= =3D { .writepage =3D minix_writepage, .write_begin =3D minix_write_begin, .write_end =3D generic_write_end, - .bmap =3D minix_bmap + .bmap =3D minix_bmap, + .direct_IO =3D noop_direct_IO }; =20 static const struct inode_operations minix_symlink_inode_operations =3D { --=20 2.30.2