From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7402BC0015E for ; Fri, 28 Jul 2023 05:05:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbjG1FFn (ORCPT ); Fri, 28 Jul 2023 01:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230512AbjG1FFk (ORCPT ); Fri, 28 Jul 2023 01:05:40 -0400 Received: from bagheera.iewc.co.za (bagheera.iewc.co.za [IPv6:2c0f:f720:0:3::9a49:2249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EB282D67; Thu, 27 Jul 2023 22:05:38 -0700 (PDT) Received: from [154.73.32.4] (helo=tauri.local.uls.co.za) by bagheera.iewc.co.za with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qPFf1-0005PS-Vn; Fri, 28 Jul 2023 07:05:08 +0200 Received: from [192.168.1.145] by tauri.local.uls.co.za with esmtp (Exim 4.94.2) (envelope-from ) id 1qPFf0-0005t6-R4; Fri, 28 Jul 2023 07:05:06 +0200 Message-ID: Date: Fri, 28 Jul 2023 07:05:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] fuse: enable larger read buffers for readdir [v2]. Content-Language: en-GB To: Bernd Schubert , Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Randy Dunlap , Antonio SJ Musumeci References: <20230726105953.843-1-jaco@uls.co.za> <20230727081237.18217-1-jaco@uls.co.za> From: Jaco Kroon Organization: Ultimate Linux Solutions (Pty) Ltd In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, >>>          plus = fuse_use_readdirplus(inode, ctx); >>>          ap->args.out_pages = true; >>> -       ap->num_pages = 1; >>> +       ap->num_pages = READDIR_PAGES; >> >> No.  This is the array lenght, which is 1.  This is the hack I guess, >> which makes the above trick work. > > Hmm, ap->num_pages / ap->pages[] is used in fuse_copy_pages, but so is > ap->descs[] - shouldn't the patch caused an out-of-bound access? > Out of interest, would you mind to explain how the hack worked? Apparently it shouldn't ... my understanding of how pages* worked was all wrong. I'm guessing since all the data fits in the first page (ap->pages[0] in other words, of length/size desc.length) that the other pages are never accessed.  Looking at fuse_copy_pages this does indeed seem to be the case.  So I ended up just being really, really lucky here. Kind regards, Jaco