Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp288909pxb; Wed, 22 Sep 2021 23:11:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeBiJVglG+rKYLA/MjDeIREJswE/mYZyTd1oSk6scNFaB/ZCdQwDquJYQFUUoQs2xzq+xs X-Received: by 2002:a05:6e02:1a0e:: with SMTP id s14mr1356433ild.197.1632377503444; Wed, 22 Sep 2021 23:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632377503; cv=none; d=google.com; s=arc-20160816; b=ELablc82NThRwtBxyTefAJzGaNJt9LwN1W7OpTVlkp0TCSsR+/YwM3U46H3pSqxE+s LiHgkq5D9dsApwpTb59thLkNiq/CXY+73kosPgHdoo0HWxowQwRwVqgQch7JCJEie9pl lNGYmxj62WGfm+OWdtzk9xhWJdm3ghKHVydLJhosRL/L9UfhNGA0dfGinngcm4iclXK8 PIthycy9ZFDN0i3FiNlYsHjBCPTeUFRwHEdgNyhduG19YtPLGL8UL8UZFmkaZbBC3Wdz 02DCSwIbHGpcLQOp9mNrN0h0FcCw1L7Ms4cfO2rhFyrgRkyiHkk4wstWheKyvFP41+eg YWww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=l+VbCKJ/GJIiEMTT85+UXeNVdQHqrXxRk3phlmp/kes=; b=fTcvI3XmA9BPngzR+IBupd9eLmBUVsrQdQv9CSg47tKSaxgvWD1RwVPqnudzvm4StE UtTnGnkT/GxhD+pb4eTMc34AgdpoS1Hn1vVGg4hum68GnLYZr+KqaxUbHe5yKSBXDDPM uxRd4jlQ5np5PVPsxDH4rTo8pmaN4pIzxgigf1iNQPX3zqPCT64NBv5sQUXm4ogSD1Lt VUoY9tcAuS5ZenWpwH6UF3rdcelkwzYD3V01QcRVusvO1rw/mABHKvTDIphMAaSbhbZb Q7pBIZltN8IvMXd3qQzmBMXPtAZrxEgQVXlCvIG+LC+Wr+S9qwuCV2a9vW9NYXCuutIS FVZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xwh+uEAT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k126si4865345iof.103.2021.09.22.23.11.31; Wed, 22 Sep 2021 23:11:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xwh+uEAT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239297AbhIWGLA (ORCPT + 99 others); Thu, 23 Sep 2021 02:11:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:38010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239226AbhIWGKz (ORCPT ); Thu, 23 Sep 2021 02:10:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 36D686115A; Thu, 23 Sep 2021 06:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632377364; bh=AtQTlBMq8A/bwaK7+ylBueGzhso1tQLgQ9j89A9siLc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Xwh+uEATwHdqF7NmcBcEwAddya1IyFP+R7sOYr0qkdwRpXqEYNk2n8/6crf/qYPRG 9S3d4YTjpQNOSd/EsUQ+f0msDjM2Ak/mFCYS5r/Uxwhtz4YdeWGl3bOJ0C+eh27CB+ R2JcmU8tVdILFYXJEi5TAI/8yscs9h95G5+TIQn0= Date: Thu, 23 Sep 2021 08:08:55 +0200 From: Greg Kroah-Hartman To: Coly Li Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-raid@vger.kernel.org, nvdimm@lists.linux.dev, antlists@youngman.org.uk, Dan Williams , Hannes Reinecke , Jens Axboe , NeilBrown , Richard Fan , Vishal L Verma , rafael@kernel.org Subject: Re: Too large badblocks sysfs file (was: [PATCH v3 0/7] badblocks improvement for multiple bad block ranges) Message-ID: References: <20210913163643.10233-1-colyli@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 23, 2021 at 01:59:28PM +0800, Coly Li wrote: > Hi all the kernel gurus, and folks in mailing lists, > > This is a question about exporting 4KB+ text information via sysfs > interface. I need advice on how to handle the problem. Please do not do that. Seriously, that is not what sysfs is for, and is an abuse of it. sysfs is for "one value per file" and should never even get close to a 4kb limit. If it does, you are doing something really really wrong and should just remove that sysfs file from the system and redesign your api. > Recently I work on the bad blocks API (block/badblocks.c) improvement, there > is a sysfs file to export the bad block ranges for me raid. E.g for a md > raid1 device, file > ??? /sys/block/md0/md/rd0/bad_blocks > may contain the following text content, > ??? 64 32 > ?? 128 8 Ick, again, that's not ok at all. sysfs files should never have to be parsed like this. thanks, greg k-h