Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp357403imw; Fri, 15 Jul 2022 04:50:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vtYJ35JNLjtFqRw00+yvpIUUzCLzpIMNHTH+TQFHhE62hG8ZHiAaQ8ydVOyXnIG7kD1ZiJ X-Received: by 2002:a05:6402:50d2:b0:43a:8487:8a09 with SMTP id h18-20020a05640250d200b0043a84878a09mr18438682edb.232.1657885816566; Fri, 15 Jul 2022 04:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657885816; cv=none; d=google.com; s=arc-20160816; b=eMEaWYTyjsWWEQ03FKDNfGd84/bumVakaYpDZYXvDC3BY9jnsw4i/dgp5QSk3FPheL xs9/oXrXpD5hKmZs2xakPPIZisdaZDKWMMACszZNQTysGaaIspE97wrK4WrrZtVuuyBt fSeDIakb796JWD3oGogOiCBFBzKA0OGrEAKewI/YB+P/b3YXemlw2BEImE4u1ViCsW+j /ChVtuUUpRf9IOcLzdiNg8PE9/QO9FU2FXlhpeJTrxtA8nebixESDAuAFhQriCVoWEhS I6IxkVrwGour1ASG3F0Kq/ppAdBtiZSZmU+6TnmGnPY06UjnuD6pvQMRvWaUhQrMQQEg sxag== 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=t3GfqK3pUoxthXinheaph24n/I8XiqlaLJzOyOkqW+o=; b=OKxxAlRGOKwSjy6kqcyLuiSkJUKI9waNNgYp93HSEq47eXZZJ5SpOAFUHLrgeVYKk/ Xd7xdbT3TB4tBSAcfK+N18dMrfmSq5B80c6wpKbJatjLr671Z51T7yfDUeoApX0j2jm4 xPu4BJONbMiUqTcbSaTAj04lCZtpdnzTzcT1OjCjkAfzitvQplS9RsY/gBjW13WIVxAR dT3z0ZMyaw8Z6uo6dMZFtRVPKIFijpT3au2CdTcpv4weQEfAZEtzZjjLS4FJNl8mL3hQ LAjXn2zny7SsELy06hj4ga9Gbi5QUaI3oYnA8dMXh1Iy7Dw62KBp4x8NzP3FnpDam8+R NuCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b=UDi51M3c; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a056402355400b0043a85d7d1basi4987286edd.471.2022.07.15.04.49.42; Fri, 15 Jul 2022 04:50:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b=UDi51M3c; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230099AbiGOLsn (ORCPT + 99 others); Fri, 15 Jul 2022 07:48:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbiGOLsm (ORCPT ); Fri, 15 Jul 2022 07:48:42 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1349F2BFC for ; Fri, 15 Jul 2022 04:48:38 -0700 (PDT) Received: from cwcc.thunk.org (pool-173-48-118-63.bstnma.fios.verizon.net [173.48.118.63]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 26FBmSlq021062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Jul 2022 07:48:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1657885710; bh=t3GfqK3pUoxthXinheaph24n/I8XiqlaLJzOyOkqW+o=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=UDi51M3ctM1ffd3iWAqSLtcxTurjUvzS39ISPfpKUxFdKnMZq4/ITdUMiJ57ZESF3 GarM8E24ImWUxtGX7VlHjwyge/ZJeQXb2pxF/P9P2LcwBnU5DpWU44d4W4ONdmP4b5 Kuhban5c91pmOu/c3hbW2OZxYASD7bnd1iOApDtZ7GCNmXoRL4nHwP3E1IidPsi0xb qTb8Y2lzCkNZltXuFd5aJpGoJD6TUQjIfxUI25mqcA/Ei16v3Y7amU/hCcPO1IOk56 johzFI1heh6XARGnct+z0p0YIV/cBpC8df7uwFIzW0t4Lcei5eGOpOVOMlP8NWnkfG 7b4CCwfnM4sDg== Received: by cwcc.thunk.org (Postfix, from userid 15806) id CC10D15C003C; Fri, 15 Jul 2022 07:48:28 -0400 (EDT) Date: Fri, 15 Jul 2022 07:48:28 -0400 From: "Theodore Ts'o" To: Jan Kara Cc: "Kiselev, Oleg" , "linux-ext4@vger.kernel.org" Subject: Re: [PATCH 2/2] ext4: avoid resizing to a partial cluster size Message-ID: References: <9CDF7393-5645-4E8A-9D68-01CF7F4C4955@amazon.com> <20220714135231.aull3vo44yfa6azg@quack3> <0CC0FCE1-F8A2-4966-B848-AD2D9DF9A713@amazon.com> <20220715093518.tzl2upullc5pymo2@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220715093518.tzl2upullc5pymo2@quack3> X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Jul 15, 2022 at 11:35:18AM +0200, Jan Kara wrote: > > available for the filesystem having an “odd” size. Our preference is for > > the utilities to silently fix the fs size down to the nearest “safe” size > > rather than get sporadic errors. I had submitted a patch for resize2fs > > that rounds the fs target size down to the nearest cluster boundary. In > > principle it’s similar to the size-rounding that is done now for 4K > > blocks. Using updated e2fsprogs isn’t mandatory for using ext4 in the > > newer kernels, so making the kernel safe(r) for bigalloc resizes seems > > like a good idea. > > I see. Honestly, doing automatic "fixups" of passed arguments to syscalls / > ioctls has bitten us more than once in the past. That's why I'm cautious > about that. It seems convenient initially but then when contraints change > (e.g. you'd want to be rounding to a different number) you suddently find > you have no way to extend the API without breaking some userspace. That's > why I prefer to put these "rounding convenience" functions into userspace. > > That being said I don't feel too strongly about this particular case so I > guess I'll defer the final decision about the policy to Ted. In this particular case, a file system whose size is not a multiple of cluster size is never going to be valid, so having the resize ioctl round down the requested size to largest valid size seems to be a safe (and useful) thing to do. - Ted