From patchwork Thu Nov 7 19:16:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joanne Koong X-Patchwork-Id: 13866970 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 0160CD5D683 for ; Thu, 7 Nov 2024 19:17:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0189B6B008C; Thu, 7 Nov 2024 14:17:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E8CBF6B0098; Thu, 7 Nov 2024 14:17:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE4B96B0092; Thu, 7 Nov 2024 14:17:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 7CD496B008C for ; Thu, 7 Nov 2024 14:17:30 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 15C5FAC33E for ; Thu, 7 Nov 2024 19:17:30 +0000 (UTC) X-FDA: 82760256768.30.51FC89C Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by imf05.hostedemail.com (Postfix) with ESMTP id 733F110002C for ; Thu, 7 Nov 2024 19:16:20 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aApxmt5F; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731006988; a=rsa-sha256; cv=none; b=mI/rXuLknSfCRnRBRsfFpdxClsUWtf9pHCyLPd0RKvfgPc2wNFtJEXpPmBrO5aaxOhRvdI iUNO7Lqx9ueFWoUu/8PzuwV/3S1/rNKm6et/sBwmcFyGz3RdA0zUtQ9MDeXkVW5sISHNso +aqG8oENONAckuMHj+QKNRs/NTav/3Q= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aApxmt5F; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731006988; 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=ZnCvLTbTmq6xS6wpFSTKmY1gePcY6efLtCHlkRWy6SY=; b=wMQBNrMFU+gnDAgt2L9LnWK0ofPOF28/qSr3DGki4frrjNi8azDRt22JTJ5dc+0TgRqmCd QhUDrDn437HmtUWq/ygRXoE6m1sOk9Bo/onnYZHkYj+lUVjDW+Sw+66jzMLXXVoW4jCvIQ 0rt/k7N5IMv/kCff1a77CnWXThJQI3E= Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-6e330b7752cso17759677b3.1 for ; Thu, 07 Nov 2024 11:17:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731007047; x=1731611847; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZnCvLTbTmq6xS6wpFSTKmY1gePcY6efLtCHlkRWy6SY=; b=aApxmt5FXtn4v5HlccMRGP1nS9eV803kvP2SS25GaPWUKPl2Z3nuOnMCaAMD2uTOQ8 3bBf60FNAehlFof/PrvQ8JOJakzg/+nwpT5NN3A/qUi/02VMilCxkFMw/LbkIRGRoaoi 1WyjRxQTmHyBXDaxZhCDrX8vCgYGWnV/5ZTMkLp9fGMvRju/PT85xh0qhhjvjxegHkTL MNcFqjE2nbVs1rj8CbxzTdBl3OzpH19it4U031EWvcyiwpp3EK0ipVPpEi7koWXkgsZH KrfaN6+OiRa2VpaeNw5N083JvmOygQ2alA4m010qnMZHcYsW28ZYtsB3ILSU1JLpcdZF SnWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731007047; x=1731611847; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZnCvLTbTmq6xS6wpFSTKmY1gePcY6efLtCHlkRWy6SY=; b=u2ffFtBYuRsM/42wIOHkSdaLLCeCJEfmM2jwVF7AKpfB2AZf4JYVU5fSV2cfIN8c8H nIDVS6smDKdjBuLTXJ63J7ygw5dLPGppucmu2jxhlmlTdtBdSG6aDWVVTqHZnqk9ro2I 3YbG+SVRyxW1qDtMEPsASg+3W96UY9GcAOwtUSmX+Qh+PdjwJyh4me2d60qfoz4mMnFo JNoGWsbXMkVa4g1twnjurwN1ASfMRA7sIyQZO5ZIegwrA2lgZD2tQK77FthH9VNUHYUd +U+pdqBNqWwnmkV1TAIjLKt7tjj1yAS5KiyRUeZz48S9fvSNOGCkhNhd/05fraHagsgD GUnw== X-Forwarded-Encrypted: i=1; AJvYcCXctKKauNaccIHz6h8TSfikQZx/7NmBTaVipAy950k5Zn+oDvizH73BIOZlz18vtgAZrvPHx9SRSQ==@kvack.org X-Gm-Message-State: AOJu0YxwmJH4ikkb3+E92pI84cwFTqolLI67qX8VDnkdXghG+5B+2jHk i5rq0pWzcgmBnAEUPoU0dK0xshPhWhWPnL94bc/OK0MuYt5VHJ4w X-Google-Smtp-Source: AGHT+IFHLm1F5SVScEjFhzgLOTEvXi9gcszMcWHxca2UHg5tDjnu1mcg7x+SjCqmp89fKz//T9WiJA== X-Received: by 2002:a05:690c:4804:b0:6e9:e097:e9d2 with SMTP id 00721157ae682-6eadc0daba4mr7442157b3.6.1731007045976; Thu, 07 Nov 2024 11:17:25 -0800 (PST) Received: from localhost (fwdproxy-nha-008.fbsv.net. [2a03:2880:25ff:8::face:b00c]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6eaceb65f80sm3999417b3.91.2024.11.07.11.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 11:17:25 -0800 (PST) From: Joanne Koong To: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org Cc: shakeel.butt@linux.dev, jefflexu@linux.alibaba.com, josef@toxicpanda.com, linux-mm@kvack.org, bernd.schubert@fastmail.fm, kernel-team@meta.com Subject: [PATCH v3 3/6] fs/writeback: in wait_sb_inodes(), skip wait for AS_WRITEBACK_MAY_BLOCK mappings Date: Thu, 7 Nov 2024 11:16:14 -0800 Message-ID: <20241107191618.2011146-4-joannelkoong@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107191618.2011146-1-joannelkoong@gmail.com> References: <20241107191618.2011146-1-joannelkoong@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 733F110002C X-Rspamd-Server: rspam11 X-Stat-Signature: ohz57c7b3pyyyzn44uwf83a59s11aqrh X-HE-Tag: 1731006980-471792 X-HE-Meta: U2FsdGVkX18HlTCTC9PcgMBDn0h/rp5JrNtMRAf0uYTtxWwC13YyVO/cVohSMpsTDIaot10BL4rG4YdGqkNt9lGBZI4cvgM157WbAPQN8HYIeG3FjwY7mDPLedMas+yNAGdxRfPWVHbFDC1M63ZGKbFz1bfpZSgrFnvwj6/UosYFoHM+IkLD8Wk66ALbYLAVc9dCCR/ISnl+C5BpsErusUy77LXGLwXSgcd2rrRBwoQFpE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GArTniWlAckx6zmmQ1TnzogjRTdaEh/N+3fmciMQZsvWQCNf8dgNIB0zUEgoRaijA== 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: List-Subscribe: List-Unsubscribe: For filesystems with the AS_WRITEBACK_MAY_BLOCK flag set, writeback operations may block or take an indeterminate time to complete. For example, writing data back to disk in FUSE filesystems depends on the userspace server successfully completing writeback. In this commit, wait_sb_inodes() skips waiting on writeback if the inode's mapping has AS_WRITEBACK_MAY_BLOCK set, else sync(2) may take an indeterminate amount of time to complete. If the caller wishes to ensure the data for a mapping with the AS_WRITEBACK_MAY_BLOCK flag set has actually been written back to disk, they should use fsync(2)/fdatasync(2) instead. Signed-off-by: Joanne Koong --- fs/fs-writeback.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index d8bec3c1bb1f..c80c45972162 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2659,6 +2659,9 @@ static void wait_sb_inodes(struct super_block *sb) if (!mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK)) continue; + if (mapping_writeback_may_block(mapping)) + continue; + spin_unlock_irq(&sb->s_inode_wblist_lock); spin_lock(&inode->i_lock);