linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Lennart Poettering <lennart@poettering.net>
Subject: Re: [PATCH 1/4] fs/notify: fdinfo can report unsupported file handles.
Date: Tue, 12 Dec 2017 08:52:59 +1100	[thread overview]
Message-ID: <87609dort0.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <CAOQ4uxj9VhiCtPSt+Lyv8qyUz2hJ=VQzSYCKZ_6yqvs2q7y6Qw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2054 bytes --]

On Mon, Dec 11 2017, Amir Goldstein wrote:

> On Mon, Dec 11, 2017 at 8:04 AM, NeilBrown <neilb@suse.com> wrote:
>> If a filesystem does not set sb->s_export_op, then it
>> does not support filehandles and export_fs_encode_fh()
>> and exportfs_encode_inode_fh() should not be called.
>> They will use export_encode_fh() is which is a default
>> that uses inode number generation number, but in general
>> they may not be stable.
>>
>> So change exportfs_encode_inode_fh() to return FILEID_INVALID
>> if called on an unsupported Filesystem.  Currently only
>> notify/fdinfo can do that.
>>
>
> I wish you would leave this check to the caller, maybe add a helper
> exportfs_can_decode_fh() for callers to use.
>
> Although there are no current uses for it in-tree, there is value in
> being able to encode a unique file handle even when it cannot be
> decoded back to an open file.
>
> I am using this property in my fanotify super block watch patches,
> where the object identifier on the event is an encoded file handle
> of the object, which delegates tracking filesystem objects to
> userspace and prevents fanotify from keeping elevated refcounts
> on inodes and dentries.
>
> There are quite a few userspace tools out there that are checking
> that st_ino hasn't changed on a file between non atomic operations.
> Those tools (or others) could benefit from a unique file handle if
> we ever decide to provide a relaxed version of name_to_handle_at().

If the filesystem doesn't define ->s_export_op, then you really cannot
trust anything beyond the inode number (and maybe not even that), and
the inode number is already easily available.
What actual value do you think you get from this pretend-file-handle
on filesystems that don't support file handles?

If there is a demonstrated need for some sort of identifier that is
stronger than an inode number, but not strong enough for
open_by_handle_at(), then you should explain that need and propose a
well defined interface.  You shouldn't use a back-door and hope no-one
notices.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  parent reply	other threads:[~2017-12-11 21:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11  6:04 [PATCH 0/4] VFS: fix assorted issues with name_to_handle conversions NeilBrown
2017-12-11  6:04 ` [PATCH 3/4] NFS: allow name_to_handle_at() to work for Amazon EFS NeilBrown
2017-12-11  6:04 ` [PATCH 2/4] fs/notify: don't put file handle buffer on stack NeilBrown
2017-12-11  6:47   ` Amir Goldstein
2017-12-11  6:04 ` [PATCH 1/4] fs/notify: fdinfo can report unsupported file handles NeilBrown
2017-12-11  6:29   ` Al Viro
2017-12-11 22:12     ` NeilBrown
2017-12-11  6:41   ` Amir Goldstein
2017-12-11  7:05     ` Amir Goldstein
2017-12-11 13:46       ` Pavel Emelyanov
2017-12-11 14:08         ` Amir Goldstein
2017-12-11 15:21           ` Pavel Emelyanov
2017-12-11 21:52     ` NeilBrown [this message]
2017-12-12  6:39       ` Amir Goldstein
2017-12-13  2:20         ` NeilBrown
2017-12-11  6:04 ` [PATCH 4/4] fhandle: Improve error responses in name_to_handle_at() NeilBrown
2017-12-11 16:08   ` J. Bruce Fields

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=87609dort0.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=amir73il@gmail.com \
    --cc=lennart@poettering.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).