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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CADDEC11F6B for ; Wed, 30 Jun 2021 05:42:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9261861CD6 for ; Wed, 30 Jun 2021 05:42:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231952AbhF3Fid (ORCPT ); Wed, 30 Jun 2021 01:38:33 -0400 Received: from verein.lst.de ([213.95.11.211]:42826 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbhF3Fib (ORCPT ); Wed, 30 Jun 2021 01:38:31 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 8E3C267373; Wed, 30 Jun 2021 07:36:01 +0200 (CEST) Date: Wed, 30 Jun 2021 07:36:01 +0200 From: Christoph Hellwig To: Vivek Goyal Cc: Stefan Hajnoczi , Christoph Hellwig , viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, virtio-fs@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [Virtio-fs] [PATCH 3/2] fs: simplify get_filesystem_list / get_all_fs_names Message-ID: <20210630053601.GA29241@lst.de> References: <20210621062657.3641879-1-hch@lst.de> <20210622081217.GA2975@lst.de> <20210629205048.GE5231@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210629205048.GE5231@redhat.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 29, 2021 at 04:50:48PM -0400, Vivek Goyal wrote: > May be we should modify mount_block_root() code so that it does not > require that extra "\0". Possibly zero initialize page and that should > make sure list_bdev_fs_names() does not have to worry about it. > > It is possible that a page gets full from the list of filesystems, and > last byte on page is terminating null. In that case just zeroing page > will not help. We can keep track of some sort of end pointer and make > sure we are not searching beyond that for valid filesystem types. > > end = page + PAGE_SIZE - 1; > > mount_block_root() > { > for (p = fs_names; p < end && *p; p += strlen(p)+1) { > } > } Maybe. To honest I'd prefer to not even touch this unrelated code given how full of landmines it is :) From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 30 Jun 2021 07:36:01 +0200 From: Christoph Hellwig Message-ID: <20210630053601.GA29241@lst.de> References: <20210621062657.3641879-1-hch@lst.de> <20210622081217.GA2975@lst.de> <20210629205048.GE5231@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210629205048.GE5231@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: Re: [Virtio-fs] [PATCH 3/2] fs: simplify get_filesystem_list / get_all_fs_names List-Id: Development discussions about virtio-fs List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vivek Goyal Cc: linux-kernel@vger.kernel.org, virtio-fs@redhat.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, Christoph Hellwig On Tue, Jun 29, 2021 at 04:50:48PM -0400, Vivek Goyal wrote: > May be we should modify mount_block_root() code so that it does not > require that extra "\0". Possibly zero initialize page and that should > make sure list_bdev_fs_names() does not have to worry about it. > > It is possible that a page gets full from the list of filesystems, and > last byte on page is terminating null. In that case just zeroing page > will not help. We can keep track of some sort of end pointer and make > sure we are not searching beyond that for valid filesystem types. > > end = page + PAGE_SIZE - 1; > > mount_block_root() > { > for (p = fs_names; p < end && *p; p += strlen(p)+1) { > } > } Maybe. To honest I'd prefer to not even touch this unrelated code given how full of landmines it is :)