All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH] fsnotify: fix false positive warning on inode delete
Date: Mon, 20 Aug 2018 16:48:17 +0300	[thread overview]
Message-ID: <CAOQ4uxjXe7EqS82O5ra37HgeM4ZqGJ0ZoT8+JrxmHc2vXmksCA@mail.gmail.com> (raw)
In-Reply-To: <20180820123203.29910-1-jack@suse.cz>

On Mon, Aug 20, 2018 at 3:32 PM Jan Kara <jack@suse.cz> wrote:
>
> When inode is getting deleted and someone else holds reference to a mark
> attached to the inode, we just detach the connector from the inode. In
> that case fsnotify_put_mark() called from fsnotify_destroy_marks() will
> decide to recalculate mask for the inode and __fsnotify_recalc_mask()
> will WARN about invalid connector type:
>
> WARNING: CPU: 1 PID: 12015 at fs/notify/mark.c:139
> __fsnotify_recalc_mask+0x2d7/0x350 fs/notify/mark.c:139
>
> Actually there's no reason to warn about detached connector in
> __fsnotify_recalc_mask() so just silently skip updating the mask in such
> case.
>
> Reported-by: syzbot+c34692a51b9a6ca93540@syzkaller.appspotmail.com
> Fixes: 3ac70bfcde81 ("fsnotify: add helper to get mask from connector")
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/notify/mark.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> I plan to merge this fix through my tree for 4.19-rc2.
>

looks good.
Thanks.

> diff --git a/fs/notify/mark.c b/fs/notify/mark.c
> index 05506d60131c..59cdb27826de 100644
> --- a/fs/notify/mark.c
> +++ b/fs/notify/mark.c
> @@ -132,13 +132,13 @@ static void __fsnotify_recalc_mask(struct fsnotify_mark_connector *conn)
>         struct fsnotify_mark *mark;
>
>         assert_spin_locked(&conn->lock);
> +       /* We can get detached connector here when inode is getting unlinked. */
> +       if (!fsnotify_valid_obj_type(conn->type))
> +               return;
>         hlist_for_each_entry(mark, &conn->list, obj_list) {
>                 if (mark->flags & FSNOTIFY_MARK_FLAG_ATTACHED)
>                         new_mask |= mark->mask;
>         }
> -       if (WARN_ON(!fsnotify_valid_obj_type(conn->type)))
> -               return;
> -
>         *fsnotify_conn_mask_p(conn) = new_mask;
>  }
>
> --
> 2.16.4
>

  reply	other threads:[~2018-08-20 17:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-20 12:32 [PATCH] fsnotify: fix false positive warning on inode delete Jan Kara
2018-08-20 13:48 ` Amir Goldstein [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-08-19 12:35 Amir Goldstein
2018-08-20 10:07 ` Jan Kara
2018-08-20 10:32   ` Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOQ4uxjXe7EqS82O5ra37HgeM4ZqGJ0ZoT8+JrxmHc2vXmksCA@mail.gmail.com \
    --to=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.