Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1143820imm; Wed, 1 Aug 2018 10:55:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdzqUtYooAxGkNdtUQ0BhY70fRhPPSq3oMps3N0lMVN/KCjdqryVCMScCjJFbPOPQiGW3D+ X-Received: by 2002:a62:9bc5:: with SMTP id e66-v6mr27623901pfk.84.1533146116190; Wed, 01 Aug 2018 10:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533146116; cv=none; d=google.com; s=arc-20160816; b=ci6RDW5ISBa128dbQYU7RSDEhSrzvs1/Tn1a/Z4fYrW7yIrlLjYNrL2/VqPDJylfTf zMn6jI6xL9jA7KZNvXNwBk753j8c4RidtwwkuZ4o8xhGvf7fhxn5+jByJ64zLF6b9oYu h0xIO93KKInp1fbK2fU9AGp2NTCPZKHuvImv5DRoGm2z8lAwwCavWVSpPAkoxlQvE8YZ rFF5iihPS9Rh9ICjjTTomdmyzMRC9EGBxuARBfaB2i2BhEBj0W/DMwC4M3z+voB1hs5R PfZfqWj/gG/77/cJSuCiLZyLrs/P5HQ+EYkn4RqFT7vLOjj45OBN4T0euEZFT3wIkiIx 6zKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=VkldpypcvYavr4SDDLPVSBUEwPywx8/Pxq6SLdDDXD8=; b=EKL13zOMld92y6zNCBfzsbY9VVvdpEqMAdz7ejuoZ8M19lkfVSaQsjPVXWQQQaK4OF gcx5RaBPTbyUavekDt7nJVgMtoqaMtKd2iKmW4+aMWejrtmP+QIb/gW8nPVXx5a8fGoh KEJrYojSvLbXE84JEzrmRYHuRulj1lCjKL7aQagN5AzVM1UjllYOSNLr2QoI2OjRzeUP 1wbvCRssUF+1rgKdyBrqNwbe3z/qhWTTUOCJ57wh2vjI0CxxN0SqRrvaiCYQSRRi3jeT HZeHMDYej+sCvqbKwNy8GImPUJ0x8YWIdu6F4SQ49spl4bobVRPJ8C9vgMmAL6dn6J5l 9K3Q== ARC-Authentication-Results: i=1; mx.google.com; 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 140-v6si16256371pgd.19.2018.08.01.10.55.01; Wed, 01 Aug 2018 10:55:16 -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; 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 S2405978AbeHATlF (ORCPT + 99 others); Wed, 1 Aug 2018 15:41:05 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50156 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405997AbeHATIk (ORCPT ); Wed, 1 Aug 2018 15:08:40 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4ED7513A4; Wed, 1 Aug 2018 17:14:53 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sahitya Tummala , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.14 059/246] f2fs: Fix deadlock in shutdown ioctl Date: Wed, 1 Aug 2018 18:49:29 +0200 Message-Id: <20180801165014.533785261@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sahitya Tummala [ Upstream commit 60b2b4ee2bc01dd052f99fa9d65da2232102ef8e ] f2fs_ioc_shutdown() ioctl gets stuck in the below path when issued with F2FS_GOING_DOWN_FULLSYNC option. __switch_to+0x90/0xc4 percpu_down_write+0x8c/0xc0 freeze_super+0xec/0x1e4 freeze_bdev+0xc4/0xcc f2fs_ioctl+0xc0c/0x1ce0 f2fs_compat_ioctl+0x98/0x1f0 Signed-off-by: Sahitya Tummala Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/file.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1808,9 +1808,11 @@ static int f2fs_ioc_shutdown(struct file if (get_user(in, (__u32 __user *)arg)) return -EFAULT; - ret = mnt_want_write_file(filp); - if (ret) - return ret; + if (in != F2FS_GOING_DOWN_FULLSYNC) { + ret = mnt_want_write_file(filp); + if (ret) + return ret; + } switch (in) { case F2FS_GOING_DOWN_FULLSYNC: @@ -1838,7 +1840,8 @@ static int f2fs_ioc_shutdown(struct file } f2fs_update_time(sbi, REQ_TIME); out: - mnt_drop_write_file(filp); + if (in != F2FS_GOING_DOWN_FULLSYNC) + mnt_drop_write_file(filp); return ret; }