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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EC0AC3A5A3 for ; Tue, 27 Aug 2019 08:07:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E56AC206BA for ; Tue, 27 Aug 2019 08:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566893259; bh=9139bLgvZNJhVU+/KuehRZ88uo1vuy8PX04vIiAa+M4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=eke8qxhW7p0gR3Qd+kf0SSj0V67FTr1Gf5oFMiHBwIxD682aQRP0uqbgedGaGkZit 7QXeVgKP0QTECvYLkYhYYSjQly/WEgT4bQF1+3xw2wLlZhliWe4KC27CSVcOIT9wMM YViMDq2/bg789nEb4koQYnOwhJOeifvF7kDkxMho= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727939AbfH0IHS (ORCPT ); Tue, 27 Aug 2019 04:07:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:37276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732098AbfH0IHM (ORCPT ); Tue, 27 Aug 2019 04:07:12 -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 79BD4206BF; Tue, 27 Aug 2019 08:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566893232; bh=9139bLgvZNJhVU+/KuehRZ88uo1vuy8PX04vIiAa+M4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GwNt4t+AxC6pADstDaDUqkHysKJ6oQK/m/dfyQUUOqPxPmlZdeD5RsiJKaupN1s3l f36IgqZKGCLyeCExEVSg8chW2ygYO0vcJ6k18qsfCFfLODLuWdFAMTmN10/U9i6i5l QyH8SxLlmUvhkQ7KZkT5Vhw9NDVWUtueOqZ0vnc8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, benjamin.moody@gmail.com, "Darrick J. Wong" , Dave Chinner , Salvatore Bonaccorso Subject: [PATCH 5.2 154/162] xfs: fix missing ILOCK unlock when xfs_setattr_nonsize fails due to EDQUOT Date: Tue, 27 Aug 2019 09:51:22 +0200 Message-Id: <20190827072744.154956000@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072738.093683223@linuxfoundation.org> References: <20190827072738.093683223@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Darrick J. Wong commit 1fb254aa983bf190cfd685d40c64a480a9bafaee upstream. Benjamin Moody reported to Debian that XFS partially wedges when a chgrp fails on account of being out of disk quota. I ran his reproducer script: # adduser dummy # adduser dummy plugdev # dd if=/dev/zero bs=1M count=100 of=test.img # mkfs.xfs test.img # mount -t xfs -o gquota test.img /mnt # mkdir -p /mnt/dummy # chown -c dummy /mnt/dummy # xfs_quota -xc 'limit -g bsoft=100k bhard=100k plugdev' /mnt (and then as user dummy) $ dd if=/dev/urandom bs=1M count=50 of=/mnt/dummy/foo $ chgrp plugdev /mnt/dummy/foo and saw: ================================================ WARNING: lock held when returning to user space! 5.3.0-rc5 #rc5 Tainted: G W ------------------------------------------------ chgrp/47006 is leaving the kernel with locks still held! 1 lock held by chgrp/47006: #0: 000000006664ea2d (&xfs_nondir_ilock_class){++++}, at: xfs_ilock+0xd2/0x290 [xfs] ...which is clearly caused by xfs_setattr_nonsize failing to unlock the ILOCK after the xfs_qm_vop_chown_reserve call fails. Add the missing unlock. Reported-by: benjamin.moody@gmail.com Fixes: 253f4911f297 ("xfs: better xfs_trans_alloc interface") Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Tested-by: Salvatore Bonaccorso Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_iops.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -803,6 +803,7 @@ xfs_setattr_nonsize( out_cancel: xfs_trans_cancel(tp); + xfs_iunlock(ip, XFS_ILOCK_EXCL); out_dqrele: xfs_qm_dqrele(udqp); xfs_qm_dqrele(gdqp);