From patchwork Sun Aug 27 13:28:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Xu X-Patchwork-Id: 13367215 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 17EC2C83F12 for ; Sun, 27 Aug 2023 13:35:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 988CA280008; Sun, 27 Aug 2023 09:35:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 911D88E0001; Sun, 27 Aug 2023 09:35:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DAA7280008; Sun, 27 Aug 2023 09:35:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6AFBD8E0001 for ; Sun, 27 Aug 2023 09:35:11 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 449B112020B for ; Sun, 27 Aug 2023 13:35:11 +0000 (UTC) X-FDA: 81169980822.17.302E99D Received: from out-248.mta1.migadu.com (out-248.mta1.migadu.com [95.215.58.248]) by imf17.hostedemail.com (Postfix) with ESMTP id 9621C4001B for ; Sun, 27 Aug 2023 13:35:09 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=S4P5Lis+; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf17.hostedemail.com: domain of hao.xu@linux.dev designates 95.215.58.248 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=1693143309; 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=y42FYySYNsis5G3mORomW/nSivl81IaFtk7YSUfz0Jg=; b=rda03bFQ6ivbRxCWd/AZE7X5OUvju85iH/cNPF9oSnY7kLAwYczwxi3qu8K3u12UR+r2m3 oqGDzF1f9mUJVHKFrPQLx3m3NhrZIpc8+T5AxO35JNopLgUOl0EbRM6qliBNLGUGY5CwKw GgTLGnw1ARoZzwSX6fFfclYPlsdtmcs= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=S4P5Lis+; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf17.hostedemail.com: domain of hao.xu@linux.dev designates 95.215.58.248 as permitted sender) smtp.mailfrom=hao.xu@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693143309; a=rsa-sha256; cv=none; b=JoW/bEp1J1zObTv7SkCeLd5rcpOjTEFA1i5ER7xvFWxEPLBlOtZFJWzQK/W28N2VXijpBz uB50rqxxrheMPHg967X6mz+q+Vqcbz2xYEQBd8qbgLolwOO7WMvv4DBablT8MmtPcYQAmN U2zNOEGMFztvQAB7/u0a1BV5CNENuuM= 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=1693143308; 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=y42FYySYNsis5G3mORomW/nSivl81IaFtk7YSUfz0Jg=; b=S4P5Lis+5UgxAXsbIFEQ0bJcfwW5bp3gD+5EV25w4Odl6XRzUJpaJGVaokRckJ9Hpyff0y QCMWQ876jzpmtvZlXQ4fdJDhdeygghENaAwk2aokCERTn3SKcsNlbNr+KPD/7nkWidZUEs LZ/LAlKjzWeA2HQHZTdX8ZHXdvIJ060= 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 09/11] vfs: error out -EAGAIN if atime needs to be updated Date: Sun, 27 Aug 2023 21:28:33 +0800 Message-Id: <20230827132835.1373581-10-hao.xu@linux.dev> In-Reply-To: <20230827132835.1373581-1-hao.xu@linux.dev> References: <20230827132835.1373581-1-hao.xu@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 9621C4001B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: dkkozftb6pceqoic9wtxaba8bfc4chpa X-HE-Tag: 1693143309-183887 X-HE-Meta: U2FsdGVkX1/WDR1KmOv5lzPn8lzpIYpahhc+NEAGQBK4UTT+1RHXG+O/WoBzTYVjSBnj9sN7rzjZiZFCTgF6eGgiB184l6n5WBeAAxEtNuHZAqzr8YoVRZEwouEkeKtv9+2kIaNRGO9ocnXz8CDaRp/Wv8/XDIPQwJLfPkvn/sNcHrQJ6XGehJWwRdZ2Srb50/Zw6jabnz8lsU1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owner-majordomo@kvack.org List-ID: From: Hao Xu To enforce nowait semantics, error out -EAGAIN if atime needs to be updated. Signed-off-by: Hao Xu --- fs/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/inode.c b/fs/inode.c index e83b836f2d09..32d81be65cf9 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1970,6 +1970,9 @@ int touch_atime(const struct path *path, bool nowait) if (!atime_needs_update(path, inode)) return 0; + if (nowait) + return -EAGAIN; + if (!sb_start_write_trylock(inode->i_sb)) return 0;