Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp565771pxb; Fri, 13 Aug 2021 01:01:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+k+YFPvysExR25erUR7owf7J15K98W3OcwWEvVpd2rIT7hF0M8bRhBoeMMWD6z0RoK+mW X-Received: by 2002:a17:906:369a:: with SMTP id a26mr1210312ejc.539.1628841681427; Fri, 13 Aug 2021 01:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628841681; cv=none; d=google.com; s=arc-20160816; b=ky2ECgCk8R5NimUO3GXu+k3Ke56n4wvFgMSt9roqNndUOzpKAAx0xnae/SEng/Thg6 uF7ffnzqK9NDj7RhgER5bucHXbL/ueUCMuot9sC2fu1EyYsptFBepHmM0UMZIZcL5ztj l+hPFdfxfXSp29B4NCPpiauWWfMwOs1CMtFo6qXFZLAzx09It6fmsKQCzIgsxh9SKuIU FHYsed3ZubUtcU8EYVInjLMhY6gB8efGasFaMapEnjYoL1eBwj2hWbGQw4RM4onUk5dr I85nQcVZUxxyBGoOtPo7mfEdFt12aZtTVsZhmj60n2qlBmEF98vT823uvL2GcMtJv/64 Kj6w== 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=M81MoqGpPkvhEhozDSmYgBewMgKBobvD8HDiesRhbLk=; b=bW/p8J/i78TPLR4sH9LbcuXdz3swn+oITDIBnGZ5a1JyF4ttQTFroI8rHGev0Hgojg mPpVwTHYuI3F6Fsn+NDAzhY8fgHqLZx1FYkiduVLlAf8nzdgYJ8EhhvuVk5rPdGbnk5D eZRORQJ32GHPQ56j/YRbtWIA/+bTX2V78GUy7H713jhIHQrBxx/JC0NmK8u/4Y9j9J4C scscyRTKLds3qMwPs3r+/0rz+1ANThOgj5P2BBQPZ2TTOxncfojNo5hD5Ja/aqHtV4xp tuMjNil4M+G+/kKBz5A7T/+VoAvYeTP2TFAp+8EDn+XqH26Po3izdwPhkzr4Q0/ISx2e lOYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="qP7/MVR3"; 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 jz19si1143111ejb.599.2021.08.13.01.00.57; Fri, 13 Aug 2021 01:01:21 -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="qP7/MVR3"; 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 S235010AbhHMIAc (ORCPT + 99 others); Fri, 13 Aug 2021 04:00:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234844AbhHMIAb (ORCPT ); Fri, 13 Aug 2021 04:00:31 -0400 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A441C061756; Fri, 13 Aug 2021 01:00:05 -0700 (PDT) Received: by mail-il1-x131.google.com with SMTP id k3so9939616ilu.2; Fri, 13 Aug 2021 01:00:05 -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=M81MoqGpPkvhEhozDSmYgBewMgKBobvD8HDiesRhbLk=; b=qP7/MVR3O62sq72JuRyuJh+BKIss3XdUgxJhKGj2k08hR5tdtv+Uprjoo9vx7D/uin bemZXzpItxbVeathA2ZzkKgGn/1/v4yywnt+DxXMqGM2iqY1dijsJS3lfe9g1YNdZujk X+8cFps4Bgz1tZjgnSYhC3ysITJG3hGpdfzyuAnItgB0TcvrU0n8tpyUBM04Y4XKHmUz umr9erizDd+hQl7YFdSoIAEcDyqv0A/JKyaijRg6E1l8/oFBYFMqogIn1Yhbp14db/tH E6+Py2rGsDJViRQSmaZ/5KQU9/tQfYYG7ip7RY2F8VShvduIhpsm6Inc38OkDGrN3/Ht mopQ== 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=M81MoqGpPkvhEhozDSmYgBewMgKBobvD8HDiesRhbLk=; b=OyXqCjNGEG9aDbFiN5dwnVyhhbTZdQQclc+zsPxLzSlf+DiwYOdqdapQZjF4E7O0RS uCyPa/54Rd5VoEKFa8NhaJQR+XdLCYChK/JnLUXDRMNkbbSbe+oqlgWNpbndeD81WGu+ dbonThijocNXaA/RX2CFNdK8VK7fcjQQOreuj0/LNMVT5u8pUSJ2USVsHssW0u5TWRmx 4WY/w0Ug4xhO/MWuUy6hvAnVWHBvsA6ujnzPluirYZYXM/q2d0DM0cJ6GmAF6ywFmpMS j/O3x4spO0Sv6WrnGpMCa/NUUxhcJTxoWfAjAuyNZWilEmoZ+LJ5JfzXdTgEfjfXkZlv U0Dg== X-Gm-Message-State: AOAM530CgbIp8dDjwqlzZC2BkA3u479yBrcLJPCwydk3JTm9PhDnvHd7 AS7P/WA44DhwbrFIf3NmR9VrQR24Jmq+TzREt3U= X-Received: by 2002:a92:8702:: with SMTP id m2mr987312ild.250.1628841605007; Fri, 13 Aug 2021 01:00:05 -0700 (PDT) MIME-Version: 1.0 References: <20210812214010.3197279-1-krisman@collabora.com> <20210812214010.3197279-12-krisman@collabora.com> In-Reply-To: <20210812214010.3197279-12-krisman@collabora.com> From: Amir Goldstein Date: Fri, 13 Aug 2021 10:59:52 +0300 Message-ID: Subject: Re: [PATCH v6 11/21] fanotify: Allow file handle encoding for unhashed events To: Gabriel Krisman Bertazi Cc: Jan Kara , Linux API , Ext4 , linux-fsdevel , Khazhismel Kumykov , David Howells , Dave Chinner , Theodore Tso , "Darrick J. Wong" , Matthew Bobrowski , kernel@collabora.com, Jan Kara Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Aug 13, 2021 at 12:41 AM Gabriel Krisman Bertazi wrote: > > FAN_FS_ERROR will report a file handle, but it is an unhashed event. > Allow passing a NULL hash to fanotify_encode_fh and avoid calculating > the hash if not needed. > > Signed-off-by: Gabriel Krisman Bertazi > Reviewed-by: Jan Kara Reviewed-by: Amir Goldstein > --- > fs/notify/fanotify/fanotify.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c > index acf78c0ed219..50fce4fec0d6 100644 > --- a/fs/notify/fanotify/fanotify.c > +++ b/fs/notify/fanotify/fanotify.c > @@ -403,8 +403,12 @@ static int fanotify_encode_fh(struct fanotify_fh *fh, struct inode *inode, > fh->type = type; > fh->len = fh_len; > > - /* Mix fh into event merge key */ > - *hash ^= fanotify_hash_fh(fh); > + /* > + * Mix fh into event merge key. Hash might be NULL in case of > + * unhashed FID events (i.e. FAN_FS_ERROR). > + */ > + if (hash) > + *hash ^= fanotify_hash_fh(fh); > > return FANOTIFY_FH_HDR_LEN + fh_len; > > -- > 2.32.0 >