Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp685245rwb; Thu, 22 Sep 2022 05:17:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7F95I2jovUT39eu/8HBCFkeDSS5ulO/z2W1fs5ZlJbjU2RNn9ums3L89KC25pTEWCEJz43 X-Received: by 2002:a65:58cd:0:b0:433:fc80:bb88 with SMTP id e13-20020a6558cd000000b00433fc80bb88mr2730756pgu.521.1663849065144; Thu, 22 Sep 2022 05:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663849065; cv=none; d=google.com; s=arc-20160816; b=ZG2Fbxc8397K64so9Mea8u6za+VvlB4oPEHh7uHvU/QpJqWacOpjRE383I3s4uXYrP +T9tzOY1+4I1hWs/Y/eInmvXfFfdQsfvWKIda9q1K0lxD1FMAlXiarJIW86S89QrRpaE rYrjXVdvlyguCgmYi2Vs2aLZcgrjnl6Zx6ZYGpQvoO40J4jguubGzTEjMRQaT+QF+hSE P2RUozyUTuIHVHqa1C703pCTRfTgR+JlDrgMcNh3fdsYTuK5binzIhMIcnjwvAVKmkgM JHRCMwk5OIPpUiPNYGOdSiMHSJRY+/z8UbBNhuwzihnp068U88qOUUman9vIuyX1KOi0 xrCw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=mzraJ08XbFjKvF3H8c6KILYdRR2eaJrzAO7H5AN4OPE=; b=JG/VYHrXnKb3zTI2RqBSvebDqcIPuOmUTMU5bF3LLlqiGe5yMXdab4pjqzzfJH9xRo q30jZl4wa9wGxdZON3l+cmaDsiTmyW99nunZf0rg8HwBCalRGeQxhtRLM8M+ZQExN57n 0zmoi7yw79okwEossm4VZqRofdsWUs1OFUL82qfMnnO/3ZfKZ9bGZxKgzMDWH5ZphTgx 3gIxGKmQYRb3kvGIowz4VTcjFt/wA+PjMmwC08Z/8JH/Z41+4mPDzCPp0C3DHOOocQfO 0QyIPidVBcDifzgNQSwU+/LxFQ1W5q0RLAVu8DAhIk0VqGJACChH40oPsK1U4kxxhE5p akBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=nBWcPFYu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a056a0016c700b00535ed30d44esi6917178pfc.78.2022.09.22.05.17.31; Thu, 22 Sep 2022 05:17:45 -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=pass header.i=@suse.cz header.s=susede2_rsa header.b=nBWcPFYu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229921AbiIVMCM (ORCPT + 99 others); Thu, 22 Sep 2022 08:02:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbiIVMCL (ORCPT ); Thu, 22 Sep 2022 08:02:11 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BD89B774C; Thu, 22 Sep 2022 05:02:09 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 459D81F90A; Thu, 22 Sep 2022 12:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1663848128; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mzraJ08XbFjKvF3H8c6KILYdRR2eaJrzAO7H5AN4OPE=; b=nBWcPFYu+B37fjNNGJyCYovOcI5HXTBNjnyousgO5QBihaaIegJF34HHO/otCHi2IWF6pr TvqyU8N+84nPEqgytFBAdNm1xSOgd2JueqLiveKWanjTpU9NhfhKjY1q9GMI3kfMwPwosc IfYXNqL0u+kQ8ynXPkInhg+2nroRrQk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1663848128; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mzraJ08XbFjKvF3H8c6KILYdRR2eaJrzAO7H5AN4OPE=; b=Otyf8rmsFxydujS408TICq0B91m7wiegCNqTMhb4wroUcweQpfoSM0RfgYznpAhLdMa9KA gidmZTAnaWiVgCAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 36BA813AA5; Thu, 22 Sep 2022 12:02:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CIdWDcBOLGPISwAAMHmgww (envelope-from ); Thu, 22 Sep 2022 12:02:08 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id B0496A0684; Thu, 22 Sep 2022 14:02:07 +0200 (CEST) Date: Thu, 22 Sep 2022 14:02:07 +0200 From: Jan Kara To: Boyang Xue Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, Lukas Czerner Subject: Re: [bug report] disk quota exceed after multiple write/delete loops Message-ID: <20220922120207.3jeasu24dmx5khlz@quack3> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no 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 Hello! On Tue 23-08-22 12:16:46, Boyang Xue wrote: > On the latest kernel 6.0.0-0.rc2, I find the user quota limit in an > ext4 mount is unstable, that after several successful "write file then > delete" loops, it will finally fail with "Disk quota exceeded". This > bug can be reproduced on at least kernel-6.0.0-0.rc2 and > kernel-5.14.0-*, but can't be reproduced on kernel-4.18.0 based RHEL8 > kernel. > Run log on kernel-6.0.0-0.rc2 > ``` > (...skip successful Run#[1-2]...) > *** Run#3 *** > --- Quota before writing file --- > Disk quotas for user quota_test_user1 (uid 1003): > Filesystem blocks quota limit grace files quota limit grace > /dev/loop0 0 200000 300000 0 2000 3000 > --- --- > dd: error writing '/mntpt/test_300m': Disk quota exceeded > 299997+0 records in > 299996+0 records out > 307195904 bytes (307 MB, 293 MiB) copied, 1.44836 s, 212 MB/s So this shows that we have failed allocating the last filesystem block. I suspect this happens because the file gets allocted from several free space extens and so one extra indirect tree block needs to be allocated (or something like that). To verify that you can check the created file with "filefrag -v". Anyway I don't think it is quite correct to assume the filesystem can fit 300000 data blocks within 300000 block quota because the metadata overhead gets accounted into quota as well and the user has no direct control over that. So you should probably give filesystem some slack space in your tests for metadata overhead. > --- Quota after writing file --- > Disk quotas for user quota_test_user1 (uid 1003): > Filesystem blocks quota limit grace files quota limit grace > /dev/loop0 300000* 200000 300000 7days 1 2000 3000 > --- --- > --- Quota after deleting file --- > Disk quotas for user quota_test_user1 (uid 1003): > Filesystem blocks quota limit grace files quota limit grace > /dev/loop0 0 200000 300000 0 2000 3000 > --- --- > ``` Honza -- Jan Kara SUSE Labs, CR