linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Hugh Dickins <hughd@google.com>,
	Theodore Tso <tytso@mit.edu>,
	Damien Le Moal <damien.lemoal@wdc.com>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/2] shmem: allow reporting fanotify events with file handles on tmpfs
Date: Thu, 25 Mar 2021 16:00:25 +0100	[thread overview]
Message-ID: <20210325150025.GF13673@quack2.suse.cz> (raw)
In-Reply-To: <20210322173944.449469-3-amir73il@gmail.com>

On Mon 22-03-21 19:39:44, Amir Goldstein wrote:
> Since kernel v5.1, fanotify_init(2) supports the flag FAN_REPORT_FID
> for identifying objects using file handle and fsid in events.
> 
> fanotify_mark(2) fails with -ENODEV when trying to set a mark on
> filesystems that report null f_fsid in stasfs(2).
> 
> Use the digest of uuid as f_fsid for tmpfs to uniquely identify tmpfs
> objects as best as possible and allow setting an fanotify mark that
> reports events with file handles on tmpfs.
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>

Hugh, any opinion on this patch?

								Honza

> ---
>  mm/shmem.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index b2db4ed0fbc7..162d8f8993bb 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -2846,6 +2846,9 @@ static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf)
>  		buf->f_ffree = sbinfo->free_inodes;
>  	}
>  	/* else leave those fields 0 like simple_statfs */
> +
> +	buf->f_fsid = uuid_to_fsid(dentry->d_sb->s_uuid.b);
> +
>  	return 0;
>  }
>  
> -- 
> 2.25.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2021-03-25 15:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 17:39 [PATCH 0/2] Better fanotify support for tmpfs Amir Goldstein
2021-03-22 17:39 ` [PATCH 1/2] fs: introduce a wrapper uuid_to_fsid() Amir Goldstein
2021-03-23  5:19   ` Damien Le Moal
2021-03-23 14:09   ` Christian Brauner
2021-03-22 17:39 ` [PATCH 2/2] shmem: allow reporting fanotify events with file handles on tmpfs Amir Goldstein
2021-03-25 15:00   ` Jan Kara [this message]
2021-04-16  9:59     ` Amir Goldstein
2021-04-17  3:54       ` Hugh Dickins
2021-04-19  8:34         ` Jan Kara
2021-03-23 13:25 ` [PATCH 0/2] Better fanotify support for tmpfs Jan Kara
2021-03-23 14:13 ` Christian Brauner

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=20210325150025.GF13673@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=amir73il@gmail.com \
    --cc=damien.lemoal@wdc.com \
    --cc=hughd@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).