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 7E3A5C433F5 for ; Tue, 12 Apr 2022 17:30:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350475AbiDLRc6 (ORCPT ); Tue, 12 Apr 2022 13:32:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358136AbiDLRcH (ORCPT ); Tue, 12 Apr 2022 13:32:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D4FD937A01 for ; Tue, 12 Apr 2022 10:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649784579; h=from:from:reply-to:subject:subject: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=pzQ3vKJD2mKLljBbGpPHheDPClTnkzH7l3aPjzIXIB0=; b=BzqEKT5iiNZq12Q2eeWQUkvVBH8AUKQBCjU8+RvAlelkHIl4lNhjqAjYQRrhJFzCiRVXsj ijQPxQzf7VeyJWnoy5vc6dGPUqaiVPxduEKziD37rGQWQbo9rJaC7uXBFodC6UdJQ32tS0 kXDc01z+1vsA25qPfUQKyfsu3qg6Wvo= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-dsUdRNMkNEa0xUXpziHipg-1; Tue, 12 Apr 2022 13:29:38 -0400 X-MC-Unique: dsUdRNMkNEa0xUXpziHipg-1 Received: by mail-qt1-f200.google.com with SMTP id h16-20020ac85850000000b002ebdd31dca9so10003559qth.13 for ; Tue, 12 Apr 2022 10:29:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=pzQ3vKJD2mKLljBbGpPHheDPClTnkzH7l3aPjzIXIB0=; b=SQHJ1xe0sqHuqz7FYQyNXeFfNFOXLnrkad8tPIKWjm2pP4vGV+qHxhcG9EkStPUhQS ltUbhkb/gd67s4GU5Rz63Nz1WbXpcy9YI5J04tHIjjLT+msAgjUpXPIgtuCgSOAGGROb QnM6Nul/U4yNuzk8ohg9+WE1AOlaGE+0u6KvSaBfdXAuNZiOd7a5ujeGu2peFlcvTCD1 ZIX0uy8WMd80WmbFm43Ng6b5+VV23eEmsCy0hqGuZQlXh70cLGQ1HKulbZvUekgGUN5v 88T/qc+cB9Z7FvHB9jvm2Q8H6/eLB6r6s5LKswB2v8zAWkhLdcb0+ams069L9Ajstu20 q8mA== X-Gm-Message-State: AOAM532pFT5lf7YNPMQjWz3VFnzXpfJZn/91hr2BtMwElvWVoyZmS+/Q pWYimHH/2YtaNsdgfaX7PzB7z8DP14t0ec8BZUbUnOtOdSxet5bTKxRkOcA72Kw+2qglwY6QTTa 2W1kqzh4kNKE/dwmf1g== X-Received: by 2002:a37:af86:0:b0:69c:1fae:2d89 with SMTP id y128-20020a37af86000000b0069c1fae2d89mr4041303qke.506.1649784577563; Tue, 12 Apr 2022 10:29:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBj/ExPDhdmBkAQ9K448c3IBILjg+DYiz+5qgNSlkcNYQOlBb1QjV9lFgSjumsaXHAqs6grQ== X-Received: by 2002:a37:af86:0:b0:69c:1fae:2d89 with SMTP id y128-20020a37af86000000b0069c1fae2d89mr4041290qke.506.1649784577305; Tue, 12 Apr 2022 10:29:37 -0700 (PDT) Received: from zlang-mailbox ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id o9-20020ac87c49000000b002f13658d1b3sm737879qtv.19.2022.04.12.10.29.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 10:29:36 -0700 (PDT) Date: Wed, 13 Apr 2022 01:29:30 +0800 From: Zorro Lang To: "Darrick J. Wong" Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Subject: Re: [PATCH 4/4] generic: test that renaming into a directory fails with EDQUOT Message-ID: <20220412172930.fv2uofjqxgeo5tft@zlang-mailbox> Mail-Followup-To: "Darrick J. Wong" , linux-xfs@vger.kernel.org, fstests@vger.kernel.org References: <164971767143.169983.12905331894414458027.stgit@magnolia> <164971769398.169983.1284630275364529313.stgit@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <164971769398.169983.1284630275364529313.stgit@magnolia> Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org On Mon, Apr 11, 2022 at 03:54:54PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong > > Add a regression test to make sure that unprivileged userspace renaming > within a directory fails with EDQUOT when the directory quota limits have > been exceeded. > > Signed-off-by: Darrick J. Wong > --- > tests/generic/833 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ > tests/generic/833.out | 3 ++ > 2 files changed, 74 insertions(+) > create mode 100755 tests/generic/833 > create mode 100644 tests/generic/833.out > > > diff --git a/tests/generic/833 b/tests/generic/833 > new file mode 100755 > index 00000000..a1b3cbc0 > --- /dev/null > +++ b/tests/generic/833 > @@ -0,0 +1,71 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (c) 2022 Oracle. All Rights Reserved. > +# > +# FS QA Test No. 833 > +# > +# Ensure that unprivileged userspace hits EDQUOT while moving files into a > +# directory when the directory's quota limits have been exceeded. > +# > +# Regression test for commit: > +# > +# 41667260bc84 ("xfs: reserve quota for target dir expansion when renaming files") > +# > +. ./common/preamble > +_begin_fstest auto quick quota > + > +# Import common functions. > +. ./common/filter > +. ./common/quota > + > +# real QA test starts here > + > +# Modify as appropriate. > +_supported_fs generic > +_require_quota > +_require_user > +_require_scratch > + > +_scratch_mkfs > "$seqres.full" 2>&1 > +_qmount_option usrquota > +_qmount > + > +blocksize=$(_get_block_size $SCRATCH_MNT) > +scratchdir=$SCRATCH_MNT/dir > +scratchfile=$SCRATCH_MNT/file > +stagedir=$SCRATCH_MNT/staging > +mkdir $scratchdir $stagedir > +touch $scratchfile > + > +# Create a 2-block directory for our 1-block quota limit > +total_size=$((blocksize * 2)) > +dirents=$((total_size / 255)) > + > +for ((i = 0; i < dirents; i++)); do > + name=$(printf "x%0254d" $i) > + ln $scratchfile $scratchdir/$name > +done > + > +# Set a low quota hardlimit for an unprivileged uid and chown the files to it > +echo "set up quota" >> $seqres.full > +setquota -u $qa_user 0 "$((blocksize / 1024))" 0 0 $SCRATCH_MNT > +chown $qa_user $scratchdir $scratchfile > +repquota -upn $SCRATCH_MNT >> $seqres.full > + > +# Fail at renaming into the directory as qa_user to ensure quota enforcement > +# works > +chmod a+rwx $stagedir > +echo "fail quota" >> $seqres.full > +for ((i = 0; i < dirents; i++)); do > + name=$(printf "y%0254d" $i) > + ln $scratchfile $stagedir/$name > + su - "$qa_user" -c "mv $stagedir/$name $scratchdir/$name" 2>&1 | \ Same as [PATCH 3/4], do we need "--login"? Oh, I just found there's only one case generic/128 use this option too. Anyway I have no reason to object it, just speak out for review:) Thanks, Zorro > + _filter_scratch | sed -e 's/y[0-9]*/yXXX/g' > + test "${PIPESTATUS[0]}" -ne 0 && break > +done > +repquota -upn $SCRATCH_MNT >> $seqres.full > + > +# success, all done > +echo Silence is golden > +status=0 > +exit > diff --git a/tests/generic/833.out b/tests/generic/833.out > new file mode 100644 > index 00000000..d100fa07 > --- /dev/null > +++ b/tests/generic/833.out > @@ -0,0 +1,3 @@ > +QA output created by 833 > +mv: cannot move 'SCRATCH_MNT/staging/yXXX' to 'SCRATCH_MNT/dir/yXXX': Disk quota exceeded > +Silence is golden >