Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1127180ybe; Wed, 11 Sep 2019 09:47:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiZBOzhg9tbzLtCcoen1JQoxZzK9buShT/9IU3foWtkV8uvI/8VK4TLSP94k+iLBAL+/eL X-Received: by 2002:aa7:df83:: with SMTP id b3mr39257189edy.238.1568220429257; Wed, 11 Sep 2019 09:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568220429; cv=none; d=google.com; s=arc-20160816; b=Nsr+IZ9/d40RP48vWnp0exT3ksB44hflz+U8g/gl6EUpbOrHeQwML37Orusf0mU7aQ XoOS+4HADvhrkJv8jsFcL6bAVfM3TyZR5TeZK6PaHWAFPjKFcA7Ig/P7N7/i7nq3M4j/ kDNsLsNPKojgyVz2jaLXLIm1f31SJJWuQoaYewfZmUEXgI19M01ezhaqRmW+Y/0qbPAC yYuTZOt+Qzkq9hTiv4axDs7HgYg8BLcKK+rDzPFX6+b4erSwi0lWQLH0RXquHIa76PYE 7cg3g7DqE+K+OKO+/bPq37W518+eMMhHh3qjiwJACB2Ek53gSYGsco5dAYoOMnU4rqZb yecg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=7QZ/BQaWKfAVJoFfDoB2ec0Eu/3bxYcPh8mK+ZnBEOc=; b=drxLneObdQlGfBbAuaEo1Y9uRBxjEPCfTYcJOTDNo6nX2nh727AUILvHBgdRHy0i+P IIWhmZM4UfaoTakBghZJ8WIMrap3t9ynGWjnSWGBMqPM+TR8wF/NOnd0Htqhubpqag1J jqw6XhZ9XjNXsu2RXL6Fj114sCSJZV69v4SJPG5QLlvA9CdYJgdfQnvqfH3tRqsfY1R8 NLIyuMxJiv8j45G0v0aG+E1LolkcE4KNS7YBhWYn9yIL8z8YVe1vaZQ+feE9R3j0T+0i Ul3xtbu87FCFeUHamp3W7pVbl91UawP03hUTck3e9h5UskUhtOXgnLPKAX8FsTPR0857 OD6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 l5si10822909ejc.23.2019.09.11.09.46.45; Wed, 11 Sep 2019 09:47:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729282AbfIKQpb (ORCPT + 99 others); Wed, 11 Sep 2019 12:45:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:34460 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728896AbfIKQpb (ORCPT ); Wed, 11 Sep 2019 12:45:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2F975AF89; Wed, 11 Sep 2019 16:45:30 +0000 (UTC) From: Goldwyn Rodrigues To: linux-fsdevel@vger.kernel.org Cc: linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, hch@infradead.org, andres@anarazel.de, david@fromorbit.com, riteshh@linux.ibm.com, linux-f2fs-devel@lists.sourceforge.net, Goldwyn Rodrigues Subject: [PATCH 3/3] f2fs: fix inode rwsem regression Date: Wed, 11 Sep 2019 11:45:17 -0500 Message-Id: <20190911164517.16130-4-rgoldwyn@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190911164517.16130-1-rgoldwyn@suse.de> References: <20190911093926.pfkkx25mffzeuo32@alap3.anarazel.de> <20190911164517.16130-1-rgoldwyn@suse.de> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Goldwyn Rodrigues This is similar to 942491c9e6d6 ("xfs: fix AIM7 regression") Apparently our current rwsem code doesn't like doing the trylock, then lock for real scheme. So change our read/write methods to just do the trylock for the RWF_NOWAIT case. We don't need a check for IOCB_NOWAIT and !direct-IO because it is checked in generic_write_checks(). Fixes: b91050a80cec ("f2fs: add nowait aio support") Signed-off-by: Goldwyn Rodrigues --- fs/f2fs/file.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 3e58a6f697dd..c6f3ef815c05 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -3134,16 +3134,12 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) goto out; } - if ((iocb->ki_flags & IOCB_NOWAIT) && !(iocb->ki_flags & IOCB_DIRECT)) { - ret = -EINVAL; - goto out; - } - - if (!inode_trylock(inode)) { - if (iocb->ki_flags & IOCB_NOWAIT) { + if (iocb->ki_flags & IOCB_NOWAIT) { + if (!inode_trylock(inode)) { ret = -EAGAIN; goto out; } + } else { inode_lock(inode); } -- 2.16.4