From patchwork Wed Oct 10 18:23:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ernesto_A=2E_Fern=C3=A1ndez?= X-Patchwork-Id: 10635073 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 E9A9914DB for ; Wed, 10 Oct 2018 18:23:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8450428A3F for ; Wed, 10 Oct 2018 18:23:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 742EF28AF3; Wed, 10 Oct 2018 18:23:39 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 18C9328A3F for ; Wed, 10 Oct 2018 18:23:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726718AbeJKBq5 (ORCPT ); Wed, 10 Oct 2018 21:46:57 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:38973 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726668AbeJKBq5 (ORCPT ); Wed, 10 Oct 2018 21:46:57 -0400 Received: by mail-qt1-f195.google.com with SMTP id e22-v6so6823830qto.6 for ; Wed, 10 Oct 2018 11:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding; bh=ayULT6hoXRJWw0IdvPiHseZ5Jcifw4Qgyw4En+IMn5I=; b=IruTRGUouVcENPC7jLKhoYy5T+j8eIvTkbad6qoObMsb+WVpMJpcaCbta+E4ukjVCu NqgiJBJO3D2dav6HYdSK1lU/lH0pAnnujgInDfuX5vHN6tMauPpgkXtXDf0NsQg5Lxmy 2CqT0xtTS+tLEZHbK9LwU1jmyECFlj5eAiu2r5o0czPDiXJsuPnWmZQEOMpkkgC4wHkC Np3j4RnfmDmEbMuFR++WwPSZdezpqwWusrzDppa2s0lXENU4QI4//NlRQz7c62iz2d8J ENHIvFjef2tHIrj8pT8Kuat8qDV6RRZmoi1FF43AvMqQXBIFx6L+m1s2FSOax9ngk7nj ri1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding; bh=ayULT6hoXRJWw0IdvPiHseZ5Jcifw4Qgyw4En+IMn5I=; b=MaD2MTZmCG000IYs3Lm61hZPmmQ2OP4YpY9knU5N9eMFGuN7LJ+fmLQqDWpop88Oa1 cfqLR+sQlrorp/S3GlMYzxw5+ObAUAubM7sqHkYw3FC4DLeoHbHhZCM2zWRSIQh+5FCF 6IjPcxa/t8f/08rfLTsehZ2KJI5yS7zi9hU/64zSWbFeMJM0unaU8E9gw3Ptcjl+BhMH ZnSRIfm7Vk6QVnBRyba2d2C9F+E5dHplDg82UmMonx5Sd2fSl70R/H7s2Q9nX5WZSFPs BFwm0MuBPTm0V+ubu7a/o7zCocMeQ8pZO3+3/Ml3BvtbUbVAAJyWr/PBS5MJEMR23x05 W8uA== X-Gm-Message-State: ABuFfojZ9ao0PObAPpt04wzICrhL6+H8VCjgTFwhyn82NqwC4fPOMMnz 1oro5j7OFiWWIUVaENJWA0xMiDoD X-Google-Smtp-Source: ACcGV636Vandy+82wlwCPM/elrPLBcVkPmmQ5TghbHNi3JLWB7Ou/FOncqlC5ZVX4Uy7QWlcPda5mA== X-Received: by 2002:aed:2601:: with SMTP id z1-v6mr28195504qtc.123.1539195817024; Wed, 10 Oct 2018 11:23:37 -0700 (PDT) Received: from eaf ([181.47.179.0]) by smtp.gmail.com with ESMTPSA id k71-v6sm14689400qkh.30.2018.10.10.11.23.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Oct 2018 11:23:36 -0700 (PDT) Date: Wed, 10 Oct 2018 15:23:31 -0300 From: Ernesto =?utf-8?q?A=2E_Fern=C3=A1ndez?= To: linux-fsdevel@vger.kernel.org Cc: Andrew Morton Subject: [PATCH 1/2] hfsplus: fix return value of hfsplus_get_block() Message-ID: <2cd1301404ec7cf1e39c8f11a01a4302f1460ad6.1539195310.git.ernesto.mnd.fernandez@gmail.com> MIME-Version: 1.0 Content-Disposition: inline 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 Direct writes to empty inodes fail with EIO. The generic direct-io code is in part to blame (a patch has been submitted as "direct-io: allow direct writes to empty inodes"), but hfsplus is worse affected than the other filesystems because the fallback to buffered I/O doesn't happen. The problem is the return value of hfsplus_get_block() when called with !create. Change it to be more consistent with the other modules. Signed-off-by: Ernesto A. Fernández Reviewed-by: Vyacheslav Dubeyko --- fs/hfsplus/extents.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index 8a8893d522ef..a930ddd15681 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c @@ -237,7 +237,9 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock, ablock = iblock >> sbi->fs_shift; if (iblock >= hip->fs_blocks) { - if (iblock > hip->fs_blocks || !create) + if (!create) + return 0; + if (iblock > hip->fs_blocks) return -EIO; if (ablock >= hip->alloc_blocks) { res = hfsplus_file_extend(inode, false);