Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp929362pxj; Fri, 21 May 2021 02:26:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+O68zFtAw5eeuaOi4phNgR/FU02zqKxIeXAjoM4dYSjFiLq3GgSSlXUIkjmv9BIB4yV+9 X-Received: by 2002:a17:907:6288:: with SMTP id nd8mr9542440ejc.223.1621589177150; Fri, 21 May 2021 02:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621589177; cv=none; d=google.com; s=arc-20160816; b=LA1zkp9w7LeiPH/kuZfFofFVdjAnc2wZQakXRd8mdf9Zo7S4hBh+WNUkJ7v6QoIe+2 ObXnuES9IBuc8Wf+qQfwxytgoa84i9dvj1yKxnwvPp/kn+MJVKAKco5aGpcgVkhg0qtq ak0DIReLmUKRM+/yJmmDwgTixWDBEwXvYTP6TrSE1DiOWQbajsTJkg2lEgtk9iH9LyL6 ytOqCmp/yHGZYoLK0cdvqfEFsnaqeBjRIUJTRcwscsK6hXUVcUIjJS79aUknPpE3Gjb1 qwK2SbXO8lRkbDG9HsrOPpIp9QpqeEcxf55vHT/B6D1ooUO1t/DV2tKS202Y81YwjrKQ fXJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=SHyi1KBu6uRk3SyhGKBNqYVdCKLW+1xTlDVu4hZD4ZQ=; b=jsvii3U108ukp0LpjqpkW3Y6F028DcSC0QePEpMj7LJ2Oade3H4dDMVUSjg6rrVW/P V3/NIAXQC5ncywqUiaTwW8ya2JdTdQvkn4wBT+FtjzwP4DluV2YRAZsKGRY6I37rrHsm GXcSZcKTZWnym+PELDYKAcqDYBikL0Awy+FfjZ2ErZuNjgje4yo6tQDf5swcgGPNo5nE Z4s9QiU7wJeljZky1eAK1Z+SG4rWUJmxNUlwCadl+M6up0Gg2joljPXQcEXmXmlBQIQO YhQaXOwwHGkoLX808wxh3rZp/YNZMHCcCRW5MHo+uvN68i9LIGPow4PgMIg/GgLQRLmc 6MKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si5116851ejp.321.2021.05.21.02.25.53; Fri, 21 May 2021 02:26:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231836AbhEUCno (ORCPT + 99 others); Thu, 20 May 2021 22:43:44 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54916 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231681AbhEUCnn (ORCPT ); Thu, 20 May 2021 22:43:43 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 58FEB1F43D6A From: Gabriel Krisman Bertazi To: amir73il@gmail.com Cc: Gabriel Krisman Bertazi , kernel@collabora.com, "Darrick J . Wong" , Theodore Ts'o , Dave Chinner , jack@suse.com, dhowells@redhat.com, khazhy@google.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Subject: [PATCH 06/11] fsnotify: Support FS_ERROR event type Date: Thu, 20 May 2021 22:41:29 -0400 Message-Id: <20210521024134.1032503-7-krisman@collabora.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210521024134.1032503-1-krisman@collabora.com> References: <20210521024134.1032503-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Expose a new type of fsnotify event for filesystems to report errors for userspace monitoring tools. fanotify will send this type of notification for FAN_ERROR events. Signed-off-by: Gabriel Krisman Bertazi --- Changes since v1: - Overload FS_ERROR with FS_IN_IGNORED --- include/linux/fsnotify_backend.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 1ce66748a2d2..bbef2df3fbc7 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -42,6 +42,12 @@ #define FS_UNMOUNT 0x00002000 /* inode on umount fs */ #define FS_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ +#define FS_ERROR 0x00008000 /* Filesystem Error (fanotify) */ + +/* + * FS_IN_IGNORED overloads FS_ERROR. It is only used internally by inotify + * which does not support FS_ERROR. + */ #define FS_IN_IGNORED 0x00008000 /* last inotify event here */ #define FS_OPEN_PERM 0x00010000 /* open event in an permission hook */ @@ -95,7 +101,8 @@ #define ALL_FSNOTIFY_EVENTS (ALL_FSNOTIFY_DIRENT_EVENTS | \ FS_EVENTS_POSS_ON_CHILD | \ FS_DELETE_SELF | FS_MOVE_SELF | FS_DN_RENAME | \ - FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED) + FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \ + FS_ERROR) /* Extra flags that may be reported with event or control handling of events */ #define ALL_FSNOTIFY_FLAGS (FS_EXCL_UNLINK | FS_ISDIR | FS_IN_ONESHOT | \ @@ -248,6 +255,12 @@ enum fsnotify_data_type { FSNOTIFY_EVENT_NONE, FSNOTIFY_EVENT_PATH, FSNOTIFY_EVENT_INODE, + FSNOTIFY_EVENT_ERROR, +}; + +struct fs_error_report { + int error; + struct inode *inode; }; static inline struct inode *fsnotify_data_inode(const void *data, int data_type) -- 2.31.0