From patchwork Thu Nov 7 23:56:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joanne Koong X-Patchwork-Id: 13867335 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 A6DEDD5D695 for ; Thu, 7 Nov 2024 23:56:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B956F6B00A9; Thu, 7 Nov 2024 18:56:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ACFE48D0001; Thu, 7 Nov 2024 18:56:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9491A6B00AB; Thu, 7 Nov 2024 18:56:35 -0500 (EST) 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 6D75C6B00A9 for ; Thu, 7 Nov 2024 18:56:35 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 25886120369 for ; Thu, 7 Nov 2024 23:56:35 +0000 (UTC) X-FDA: 82760959512.19.34D5EE1 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) by imf12.hostedemail.com (Postfix) with ESMTP id DC06D4001B for ; Thu, 7 Nov 2024 23:56:16 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UQFFhQEi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.128.173 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731023733; a=rsa-sha256; cv=none; b=I3iW8INN1fBqiY0LBkR9THQI4JCZRDHJZOqcJ47H4CZaHPU56I+ME6cMEGkS+G6rZco0A3 uFh7FjispY28doqFuPhS4i5T5tGjSn1oj29Qa82jWVXU6N5Q5PAVB13rmt1/QEKR7f0pTK ekCHh0FFs8tnAd0aVqrw2XOSyQeGAf0= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UQFFhQEi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.128.173 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=1731023733; 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=J+pWt891pklLQsIbGotEtXl+DQA0xZyf33pBISCVbza6Vstx2DSU6V9QmdZfIRlAh7k5S8 YRXoTT/aZ40Ak9mZbMy+oVj5MMuEVReyInL+QQpgIzacZ2szrD5c21RkkIa/NqZLAl/7/t nnrK0aSH0fGBMe4ffLupe9Zlx3FT8Ws= Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-6e38fc62b9fso13756777b3.2 for ; Thu, 07 Nov 2024 15:56:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731023792; x=1731628592; 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=UQFFhQEisMiAQYyrwkEOwQl8XA4S5pBoB2TAzva/d9XiJ2aAw2tIEKXE3Q5Zqy3TAc +ZF2yYMr2w/jgAzUsN3zUL89pf6erldGWxk2q3nvNpABURx9Xh+nDPf7/xQo4A/NIgdY BUOhZKkJayv0GbO1JDZz5+E3acPZJ7prDSWU9rbZ7T/wrMfof807ogxWUfNvMcdagMDV TceX2xCmqSuHfZEsQx4dt0VCJm6kDV3f+I/pzSt39aKuHvTzpBzufPelqS6rjbp59/OY rsDIb+zLi5N2V+Y/aiwxWwUYY7kRn96wPxWDKx8W0bkea0c6xj94fy5mnRorp5FYPmfU LwAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731023792; x=1731628592; 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=liUwIL9frwGCv5uEZg64Zz7PcJluxkNVOyyTe8XrXBDCvP3ca6DUA+5vKWGiDJsNoJ Y++pDHx1s5YH6RWPBcAS0oDRoHgxQcFVsy1KJ9TqbpcHep5GlxBL5Ig7LTh0fA+jWR0l VGyJ9SBCirDz1/lfZxRSYDpeNqqC0rg9MGhihCKhuu78Tr7HIuK4Ez/LJOXUfW+Jk7sK EKk0rPz6jAMtK4tr4BFgWJcBcjyLOxkiL6ozEiRXE8nNU4Nw+3UH5CNQGWc59RbRuB3e lR5DSO3QsdgvDLYNvcjr7AepL61Oz95XD6HbsNGT3y2zZo+AvcBjYNHlP1XPi6/sffiX mg3g== X-Forwarded-Encrypted: i=1; AJvYcCUJ4ihLnXfsagqhRKYchdRc0PpsDG1sTsV9DJqaMdlz9UNYlSoQH1WskRS/wWzs9P6MGS67zeDuGQ==@kvack.org X-Gm-Message-State: AOJu0Yxag3u9xwgY/f0D2IGBwngZoKa45pJlrKtrI1YA5nwQTLm04YOp SqqMceJ6havEoaif1Phdo4mSZ6wpme/7R2gaeBlm+YkszEtx6P47 X-Google-Smtp-Source: AGHT+IGJ7XIGDH3gjwhwJwxg42yQL0oNlE1U9fJsXrX1XmblFbwOlYN4FwmU8RXv5pchaNWEiPA4dQ== X-Received: by 2002:a05:690c:6e03:b0:6e6:248:3496 with SMTP id 00721157ae682-6eaddd91bf5mr13056217b3.11.1731023792342; Thu, 07 Nov 2024 15:56:32 -0800 (PST) Received: from localhost (fwdproxy-nha-011.fbsv.net. [2a03:2880:25ff:b::face:b00c]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6eace8ee1cbsm4999917b3.29.2024.11.07.15.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 15:56:32 -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 v4 3/6] fs/writeback: in wait_sb_inodes(), skip wait for AS_WRITEBACK_MAY_BLOCK mappings Date: Thu, 7 Nov 2024 15:56:11 -0800 Message-ID: <20241107235614.3637221-4-joannelkoong@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107235614.3637221-1-joannelkoong@gmail.com> References: <20241107235614.3637221-1-joannelkoong@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: DC06D4001B X-Rspamd-Server: rspam11 X-Stat-Signature: u4uq6qwbup4pkqjsrgxjmez4pbnfaaik X-HE-Tag: 1731023776-603691 X-HE-Meta: U2FsdGVkX18VVaw7F87wPped+zu2yDQ8CDcInIKubCv3pm7/S8k31EVJKo+/lVqYAYam4wZZfRBGKR5Y7/yNIhWWSXoeNm8aukx4MlAPcYZixNBcJrmFt/CRCSiuoIf0CksP8hNcBZtg8RlUgncnzds2A2DnoUntJ7EHigUH5SimemrU0gpUCh8Hp6K8mvCEa/LlrGSgedgs4XH3F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d/nwxadMHBJnuCV8ZQanVVbk1SWaFOmmV7VBWdUqE2AsTUnMwAgKtsWpl2O+YwpfGZ20iGtD65OefqUW2f+oTiF78Z6EFzG5Hptfgfc6dNB6Uckw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.002608, 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);