Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4935191pxv; Tue, 29 Jun 2021 20:46:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2R9ADPMYONMtnG1tZDBEVyr9TIEHbg2ZVvpormc1aNC3mNsbcu89cHqWqkRykbo1wyTSi X-Received: by 2002:a17:906:3042:: with SMTP id d2mr33797932ejd.234.1625024792803; Tue, 29 Jun 2021 20:46:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625024792; cv=none; d=google.com; s=arc-20160816; b=HJTa4NyfWCoBZFuyJ9CSzDnwOK8lz7y7FdfeW3l+K0Q4cxRNUcRE+7V4bbISDCxT6i 3AyM99DkGGrx9I0whalPPe7ufo+SZ/rHu+OtKbf7uL7s82+eqNajaBdWpiZuc/oJrJw2 dS5BmdJBnBYnnGaen2u6PLa0ZOiRS+TjAgUACb++G32TzWV0z182/Ksi5JysKS+BMutH fomVbivhBkYYeiB4pmILzA/VrorvPqm7bdoIiFBOFoSyQhHtvipViQXEC3jIAL21HZCv 2Jw3hv6wY6/iTwCaVFm3PpAiF95OelykeVydgFzVbYgVGhG/PaJh1ZmbCMWmS1x120A6 +0DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Y4hZC+l4mVzqQUkq44/PxM6l5xfwdj0M7Czt5aw2uBk=; b=OJKP8+mJrj7qpn4quglQDeX1Vh8jcVkorDVSwA9scbtMzHWBQIzEYCcfBQ4dgtETfT PekmBksRD6CwOrnNC37baDkLkfdKlO1DmaFP61koPKDsERrsHdNuWF4Xem4ld2eWE/7Z z3WxXVdQ/BtnMMcFj167OnCMWNHa8I0y2DLVEYyTYVTRE4WXy8do9ofsVLrcnCUAdTZz D4J5jjOPHNoivQ86ulxiABLO61RG18YcbV92FEUbV39g2RzRw2nCWnIl8Uy0BucDRIfV mgAh+QmOBIVcaTNG7cv4lMKRn3Ac5oTdC33UH9Js2l44sSN2n4abf6oH8C5Xxc7W4vSu 2kVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ivAvz1U3; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv8si4663997ejc.710.2021.06.29.20.46.07; Tue, 29 Jun 2021 20:46:32 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ivAvz1U3; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232373AbhF3DsL (ORCPT + 99 others); Tue, 29 Jun 2021 23:48:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232902AbhF3DrW (ORCPT ); Tue, 29 Jun 2021 23:47:22 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CCFAC061760; Tue, 29 Jun 2021 20:44:29 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id y76so1474821iof.6; Tue, 29 Jun 2021 20:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Y4hZC+l4mVzqQUkq44/PxM6l5xfwdj0M7Czt5aw2uBk=; b=ivAvz1U3CBcX3xJV0Qe6aTcd52KvoLL1fairIRJqw797mWT6nu6WcRWN6Xt/6pp55q nv7OwBN6GnGt1BvRQm5IfFzyjwXoROcwcOVCVYJ4I9HEDcqk6CVLoBsb8KxuMQ50EspO bFaKIDAR7hHp32JDDtOsIhQKKBbG1wWIM4gh+WKRoComth8TI18NFI1USnD3Kv5cTWHs O7QQ48JOpN0BU5dTsMRnwZ80OWq4KksRmcugWwiMaez6k31nkZnd3vhrvg6rRmBl64q2 A0agoB5NIxIJjbAga++3jm09PoAXoAGDC/Cpc/JqkFdCmosyrzMPqxvuglw1Hfp/Uz8l N9bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Y4hZC+l4mVzqQUkq44/PxM6l5xfwdj0M7Czt5aw2uBk=; b=e61HlXZavfrmIVrLg+ZyInbLzcx+HBeWq4TFnXYIXi2sqwHrn+lRVy7xGBM7COR4Sw VmxrvsjePrzyDjmNsBrTvjBjyL8fIi0aZ1LOu6ZYZG2kCnapgx/8f4pi17fd0WSDjL/v cpDrePy4vKZvS/AaYPOW7cwA8S9GtvzIn3XcYgQe1GhlVxAyudmNgtUggeke/AWHocHz +EkFRUjT32B9SmngliJzDLRxU9WrX0LD9FSCulhWS51R0iZnlU8OxZy0Z4CqN8b1hutj AtDxQJGWFtZ1FAwMRHpmm55B88aAwIEqjli7uEyuNCsXkMCyx4i6WgGP+4oYn9ltovhL 5bxQ== X-Gm-Message-State: AOAM530Iy+wACxgmQZks/057HYDrJ6nHXsy7nSEezqChimEXCStndmRc yS/izdfR1mict3RFQyAB49zHKMB1UhhjquHDVpg= X-Received: by 2002:a02:3505:: with SMTP id k5mr7070426jaa.123.1625024668481; Tue, 29 Jun 2021 20:44:28 -0700 (PDT) MIME-Version: 1.0 References: <20210629191035.681913-1-krisman@collabora.com> <20210629191035.681913-12-krisman@collabora.com> In-Reply-To: <20210629191035.681913-12-krisman@collabora.com> From: Amir Goldstein Date: Wed, 30 Jun 2021 06:44:17 +0300 Message-ID: Subject: Re: [PATCH v3 11/15] fsnotify: Introduce helpers to send error_events To: Gabriel Krisman Bertazi Cc: "Darrick J. Wong" , Theodore Tso , Dave Chinner , Jan Kara , David Howells , Khazhismel Kumykov , linux-fsdevel , Ext4 , kernel@collabora.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Jun 29, 2021 at 10:12 PM Gabriel Krisman Bertazi wrote: > > Introduce helpers for filesystems interested in reporting FS_ERROR > events. When notifying errors, the file system might not have an inode > to report on the error. To support this, allow the caller to specify > the superblock to which the error applies. > > Signed-off-by: Gabriel Krisman Bertazi > Reviewed-by: Amir Goldstein > --- > Changes since v2: > - Drop reference to s_fnotify_marks and guards (Amir) > > Changes since v1: > - Use the inode argument (Amir) > - Protect s_fsnotify_marks with ifdef guard > --- > fs/notify/fsnotify.c | 2 +- > include/linux/fsnotify.h | 13 +++++++++++++ > include/linux/fsnotify_backend.h | 1 + > 3 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c > index 36205a769dde..ac05eb3fb368 100644 > --- a/fs/notify/fsnotify.c > +++ b/fs/notify/fsnotify.c > @@ -491,7 +491,7 @@ int __fsnotify(__u32 mask, const struct fsnotify_event_info *event_info) > */ > parent = event_info->dir; > } > - sb = inode->i_sb; > + sb = event_info->sb ?: inode->i_sb; > > /* > * Optimization: srcu_read_lock() has a memory barrier which can > diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h > index 8c2c681b4495..684c79ca01b2 100644 > --- a/include/linux/fsnotify.h > +++ b/include/linux/fsnotify.h > @@ -326,4 +326,17 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) > fsnotify_dentry(dentry, mask); > } > > +static inline int fsnotify_sb_error(struct super_block *sb, struct inode *inode, > + int error) > +{ > + struct fs_error_report report = { > + .error = error, > + .inode = inode, > + }; > + > + return __fsnotify(FS_ERROR, &(struct fsnotify_event_info) { > + .data = &report, .data_type = FSNOTIFY_EVENT_ERROR, > + .sb = sb}); > +} > + > #endif /* _LINUX_FS_NOTIFY_H */ > diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h > index ea5f5c7cc381..5a32c5010f45 100644 > --- a/include/linux/fsnotify_backend.h > +++ b/include/linux/fsnotify_backend.h > @@ -138,6 +138,7 @@ struct fsnotify_event_info { > struct inode *dir; > const struct qstr *name; > struct inode *inode; > + struct super_block *sb; > u32 cookie; > }; > > -- > 2.32.0 >