Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp848896ybi; Fri, 12 Jul 2019 05:40:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgczG9jeOCZoGMYLXctV+FGx0buqgEp5vxPsNFy/sU7WivsrizaE2o4tkI7zaCY6rvnevC X-Received: by 2002:a65:420c:: with SMTP id c12mr10662157pgq.125.1562935205498; Fri, 12 Jul 2019 05:40:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935205; cv=none; d=google.com; s=arc-20160816; b=HF89oZOW+tpSelbGYooRFFfejBLrWkznWT/1TA4u6bfCJwzarrGhy8OIxVsWc24Ipd cmCvJ0GHUsaRizXUqLfosjNlWBckmMC5Q5GcyMEA3TTHaTWqLHMEIE5QqCSvojtK/O5k /teuUPFyIWejWseoqqH82kbrjGhaBMYVuvv7+1j5RW8Wj7H4hB/DPcfaOThqsseNvf93 Xam6LBjtPyFhprqmQ/wzUwHjI0JNOtjY8dVUHn6NKQh6wBJ5uAjXDGsqO7dmqewX+8UE 5f0o1XiKEHmcyRwxvTdVP/rr8p2YkaaYMslUVuokUlL684aQxTTgojH72pxQh1OEQOt4 oRzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/730OKDF67reUmMR75j0ysz5EssUxp8DORQOfKSUXUE=; b=sGzR+Ls+WkwrlYGXAKA/cYBVNnQqck5hAqNEEQMuz1pryHaTJ9wqyqDT5X4KHAS2Dn PJ/QI/ogiZ9avymIPa+OtikubptHUiChmqRbEhcZsLYncD92GcWxrHGd/6oRJRhaI6Vn VtKSSMG2wL/nkUDwiucU6b5GfVe2O5JMUMq6joU1/xfIGeoDnabwXZVzQm/YSTB/YjLM GgAtm+9b8e5q+invEDab1HIXQW91iesUPzrh9oD91A4FqV+xLq+cxor479fgivo0gogD hESmodjWmofiQohxSacUesDmocbwskY0H8lzjTnVGpyPw8HlKoAuh2it13x6cpRvTAk4 ObuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mio2sbqW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a21si8437321pfo.249.2019.07.12.05.39.50; Fri, 12 Jul 2019 05:40:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mio2sbqW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729012AbfGLMip (ORCPT + 99 others); Fri, 12 Jul 2019 08:38:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:42970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728868AbfGLM2n (ORCPT ); Fri, 12 Jul 2019 08:28:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 16E1321721; Fri, 12 Jul 2019 12:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934522; bh=/Jar8IeLznHx4REKRYSjt26qWLrEXBuOcKDnIMhnuzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mio2sbqWBGMuSMYYtD0bQZ+8GonKNbF7pc9uXb5BjJUWphiEXEL58CMxu7MlwqKXA qf9yqgZJ006NfXIXg5mQfiI7PT/0Ismf91bLJK89l02duqpLZO5YFukqOn7z4Ov07R nFrlGmdr4//xrBdM1vU9FMTuZx3zN7dUsQZoenUw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, yangerkun , Jan Kara , Sasha Levin Subject: [PATCH 5.1 084/138] quota: fix a problem about transfer quota Date: Fri, 12 Jul 2019 14:19:08 +0200 Message-Id: <20190712121631.963580721@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit c6d9c35d16f1bafd3fec64b865e569e48cbcb514 ] Run below script as root, dquot_add_space will return -EDQUOT since __dquot_transfer call dquot_add_space with flags=0, and dquot_add_space think it's a preallocation. Fix it by set flags as DQUOT_SPACE_WARN. mkfs.ext4 -O quota,project /dev/vdb mount -o prjquota /dev/vdb /mnt setquota -P 23 1 1 0 0 /dev/vdb dd if=/dev/zero of=/mnt/test-file bs=4K count=1 chattr -p 23 test-file Fixes: 7b9ca4c61bc2 ("quota: Reduce contention on dq_data_lock") Signed-off-by: yangerkun Signed-off-by: Jan Kara Signed-off-by: Sasha Levin --- fs/quota/dquot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index fc20e06c56ba..dd1783ea7003 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1993,8 +1993,8 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) &warn_to[cnt]); if (ret) goto over_quota; - ret = dquot_add_space(transfer_to[cnt], cur_space, rsv_space, 0, - &warn_to[cnt]); + ret = dquot_add_space(transfer_to[cnt], cur_space, rsv_space, + DQUOT_SPACE_WARN, &warn_to[cnt]); if (ret) { spin_lock(&transfer_to[cnt]->dq_dqb_lock); dquot_decr_inodes(transfer_to[cnt], inode_usage); -- 2.20.1