From patchwork Fri Aug 25 13:54:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Xu X-Patchwork-Id: 13365925 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 987AFC3DA6F for ; Fri, 25 Aug 2023 14:03:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 35FB12800D6; Fri, 25 Aug 2023 10:03:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 336312800D0; Fri, 25 Aug 2023 10:03:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FEE02800D6; Fri, 25 Aug 2023 10:03:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 11BCC2800D0 for ; Fri, 25 Aug 2023 10:03:53 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id DCAD81406A3 for ; Fri, 25 Aug 2023 14:03:52 +0000 (UTC) X-FDA: 81162795504.22.399B94B Received: from out-249.mta1.migadu.com (out-249.mta1.migadu.com [95.215.58.249]) by imf13.hostedemail.com (Postfix) with ESMTP id CEC1E20018 for ; Fri, 25 Aug 2023 14:03:50 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=XN4VKQ0v; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf13.hostedemail.com: domain of hao.xu@linux.dev designates 95.215.58.249 as permitted sender) smtp.mailfrom=hao.xu@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692972231; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=k/4ZXSLCSyhuRHiUlNViF+vdvrXezEQu+Nm95mQGfD4=; b=WrNB0r9DJobxlMrO6PpgNKBrFxjR2us+qS/tvS20sz6Q/TSfCy2fLcbwXxVg8RxQgdAmtb mhMFkJ50s7KUq1v1sm+M0kBI+IpjMxdknKs8f7Y056ma30W/L/hvUALecMlm6wdEltVhQN F2mC/vVGNgttzYaooD68hg4kE1vgWoI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=XN4VKQ0v; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf13.hostedemail.com: domain of hao.xu@linux.dev designates 95.215.58.249 as permitted sender) smtp.mailfrom=hao.xu@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692972231; a=rsa-sha256; cv=none; b=equiaJAeUzN87+8WqvymhbOWS3pUP27qnUu6/VMhU1fei0PDnz4l6zcQCOPCUOhNasvZMU yNTTdLxSdO1nzN0fiKXjwDTw+1mozKKwKBnZuAygfXyQar76uQ1PkwgaYb+s7YFiUclijt K6t5/goDsurG3xGT+jMbwFhpNTVjv44= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692972229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k/4ZXSLCSyhuRHiUlNViF+vdvrXezEQu+Nm95mQGfD4=; b=XN4VKQ0vJWdKOqygAoO6O9s0mfT9sbRl6WKC6PlM4YizrHDbuoZWPHymJ4boioTyhTPsXz mzB7w7XoqaVp3khAiC/KVcJAYhLbwQjG/YZ+xeSDe8Sd8K9S+AePqNUb6KBAAuKlTSuaCl kFQBsj5S1c42QHrr1w1CZcr0QQo5mJc= From: Hao Xu To: io-uring@vger.kernel.org, Jens Axboe Cc: Dominique Martinet , Pavel Begunkov , Christian Brauner , Alexander Viro , Stefan Roesch , Clay Harris , Dave Chinner , "Darrick J . Wong" , linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-cachefs@redhat.com, ecryptfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-mm@kvack.org, linux-nilfs@vger.kernel.org, devel@lists.orangefs.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-mtd@lists.infradead.org, Wanpeng Li Subject: [PATCH 21/29] xfs: return -EAGAIN when bulk memory allocation fails in nowait case Date: Fri, 25 Aug 2023 21:54:23 +0800 Message-Id: <20230825135431.1317785-22-hao.xu@linux.dev> In-Reply-To: <20230825135431.1317785-1-hao.xu@linux.dev> References: <20230825135431.1317785-1-hao.xu@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: CEC1E20018 X-Stat-Signature: yenyn1dcbk7xbjb35k64uqfp7e5fjxa3 X-Rspam-User: X-HE-Tag: 1692972230-685593 X-HE-Meta: U2FsdGVkX19rY8bq7XLMEb56It7ZAlLJaWxm672CZ8KiRm/5F3N84Uvy7hL9ds6kXPsHrQ16DunADnCa0eZMjfcQuEQOs8tP4v/gNSf7Hi95D80blbWGdjHJb1Dq8eYgDlGFArPTQc3naOyzHqb9dOuug3XGiLhxkNfhMZZ7o0ugSHeEtcQSUfwJw9ALymE2cVaQdw5N3eXggVuIJroPPCRToMTJ66o6XcKbYrDQynve6OhqGt4LYa1pc50/pso9nPm49IV+76eK3VSQBVePzjqV+ez9lANqq9m/RucfokB5wVCbIAnphkOq7VJjvrYwRNaJCO4ORAlyuAp0FSPKRi/eRFztk/YMZQA2AHQf4cvbUl/ggcsERQZc0mz5pxmOvZNTKyX7RStdpRyLOeTl6X3OcM/UGxrCbemUB+Cpesr6TFIQ0I8pr38kd0kFLv738t5SV6NyXBJKptAFkWdZCMTqDM/DBMT9oXPotqac4gUy0J8YI8eU4QbOm8B3gR+HjmP8s9DTiuaszHaCq1Z+4zYSWrlf7l356nTJoxVDvxpSy17MDc4vMkMr4TMvLrJtr3O34Zc+twY8IDQ6B6Lx6F8QUiAwWe5n2uqRqY+3gb2KS5dD5/iD2UGKePM2L5moXbOQv8t4M90Fc6jajlWhPL8fT3Ykf5isYQHH4Hhr0oEWODYtH8yzJ4bZ7Mq3l9eKmWY21L+7MW8Noxv0FTDqbEp355ilkcjbv/Ylee9EgjynOBprRfFf01oTHAKlk2VF4BsZWn0KZitXZ7WT5zrnUiX/jzpkS05zsBK3jy7Aqjy58ZLxLF3AoL0MMYRQimGHFcFYl6kQFa2ADFh6lBO4DBrW/nvGjN7j1TB0VOqMfBq7Co7+8G/ujMcbFuUapL/5Q7ts1PNTEeldOHRXyz+mbLdSWuSE7YYnpZSMoc8/y+2enRSz/T8wGRczGn0OQ66HliExLXt5M1y0xiyR83Z fMakMd0h vWuuxh2qaG7a09664GZUfAjWCN1swtOTxzAq4kpF5WgXhxQHTpQCIUk4uVeqdGWj4lPnnv3Wqm7AHvqK3l9gPVO9YNPidziZbAfMzsrbvx0wubvViib9iuupqV+BUHV/3EJ6k07nB6JbbnyxgoBPPOLUw49GE4xGaSdg+LUDiYEE9E7D8FA7OABqdDIRzHcMj4Uzt X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Hao Xu Rather than wait for a moment and retry, we return -EAGAIN when we fail to allocate bulk memory in xfs_buf_alloc_pages() in nowait case. Signed-off-by: Hao Xu --- fs/xfs/xfs_buf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index a6e6e64ff940..eb3cd7702545 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -404,6 +404,11 @@ xfs_buf_alloc_pages( if (filled != last) continue; + if (nowait) { + xfs_buf_free_pages(bp); + return -EAGAIN; + } + if (flags & XBF_READ_AHEAD) { xfs_buf_free_pages(bp); return -ENOMEM;