All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jan Kara <jack@suse.cz>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Linux API <linux-api@vger.kernel.org>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	Dave Chinner <david@fromorbit.com>,
	linux-xfs@vger.kernel.org, Linux MM <linux-mm@kvack.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v9 2/6] fs, mm: pass fd to ->mmap_validate()
Date: Wed, 11 Oct 2017 20:44:01 -0700	[thread overview]
Message-ID: <CAPcyv4gKXgq5=MNMSk3idk0_jqfPR1Eh-NwQYCAfYWDjEqYNcA@mail.gmail.com> (raw)
In-Reply-To: <CAPcyv4ij9E9tXPLqp6cUAY3dJzh7OS+yPsVDME50xSvQPLpStA@mail.gmail.com>

On Wed, Oct 11, 2017 at 7:17 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Wed, Oct 11, 2017 at 6:28 PM, Dan Williams <dan.j.williams@intel.com> wrote:
>> On Wed, Oct 11, 2017 at 6:21 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
>>> On Wed, Oct 11, 2017 at 05:47:18PM -0700, Dan Williams wrote:
>>>> The MAP_DIRECT mechanism for mmap intends to use a file lease to prevent
>>>> block map changes while the file is mapped. It requires the fd to setup
>>>> an fasync_struct for signalling lease break events to the lease holder.
>>>
>>> *UGH*
>>>
>>> That looks like one hell of a bad API.  You are not even guaranteed that
>>> descriptor will remain be still open by the time you pass it down to your
>>> helper, nevermind the moment when event actually happens...
>>
>> What am I missing, fcntl(F_SETLEASE) seems to follow a similar pattern?
>
> Ugh, so I think the difference with F_SETLEASE is that the lease ends
> when the fd is closed. In the mmap case the lease follows the lifetime
> of the vma. I'll rethink this interface...

I'm not seeing a lot of good options outside of documenting that if
you close the fd that is registered with MAP_DIRECT you may still get
SIGIO notifications with si_fd set to the stale fd.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

WARNING: multiple messages have this Message-ID (diff)
From: Dan Williams <dan.j.williams@intel.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	Jan Kara <jack@suse.cz>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Linux API <linux-api@vger.kernel.org>,
	Dave Chinner <david@fromorbit.com>,
	Christoph Hellwig <hch@lst.de>,
	linux-xfs@vger.kernel.org, Linux MM <linux-mm@kvack.org>,
	Jeff Moyer <jmoyer@redhat.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ross Zwisler <ross.zwisler@linux.intel.com>
Subject: Re: [PATCH v9 2/6] fs, mm: pass fd to ->mmap_validate()
Date: Wed, 11 Oct 2017 20:44:01 -0700	[thread overview]
Message-ID: <CAPcyv4gKXgq5=MNMSk3idk0_jqfPR1Eh-NwQYCAfYWDjEqYNcA@mail.gmail.com> (raw)
In-Reply-To: <CAPcyv4ij9E9tXPLqp6cUAY3dJzh7OS+yPsVDME50xSvQPLpStA@mail.gmail.com>

On Wed, Oct 11, 2017 at 7:17 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Wed, Oct 11, 2017 at 6:28 PM, Dan Williams <dan.j.williams@intel.com> wrote:
>> On Wed, Oct 11, 2017 at 6:21 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
>>> On Wed, Oct 11, 2017 at 05:47:18PM -0700, Dan Williams wrote:
>>>> The MAP_DIRECT mechanism for mmap intends to use a file lease to prevent
>>>> block map changes while the file is mapped. It requires the fd to setup
>>>> an fasync_struct for signalling lease break events to the lease holder.
>>>
>>> *UGH*
>>>
>>> That looks like one hell of a bad API.  You are not even guaranteed that
>>> descriptor will remain be still open by the time you pass it down to your
>>> helper, nevermind the moment when event actually happens...
>>
>> What am I missing, fcntl(F_SETLEASE) seems to follow a similar pattern?
>
> Ugh, so I think the difference with F_SETLEASE is that the lease ends
> when the fd is closed. In the mmap case the lease follows the lifetime
> of the vma. I'll rethink this interface...

I'm not seeing a lot of good options outside of documenting that if
you close the fd that is registered with MAP_DIRECT you may still get
SIGIO notifications with si_fd set to the stale fd.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Dan Williams <dan.j.williams@intel.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	Jan Kara <jack@suse.cz>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Linux API <linux-api@vger.kernel.org>,
	Dave Chinner <david@fromorbit.com>,
	Christoph Hellwig <hch@lst.de>,
	linux-xfs@vger.kernel.org, Linux MM <linux-mm@kvack.org>,
	Jeff Moyer <jmoyer@redhat.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ross Zwisler <ross.zwisler@linux.intel.com>
Subject: Re: [PATCH v9 2/6] fs, mm: pass fd to ->mmap_validate()
Date: Wed, 11 Oct 2017 20:44:01 -0700	[thread overview]
Message-ID: <CAPcyv4gKXgq5=MNMSk3idk0_jqfPR1Eh-NwQYCAfYWDjEqYNcA@mail.gmail.com> (raw)
In-Reply-To: <CAPcyv4ij9E9tXPLqp6cUAY3dJzh7OS+yPsVDME50xSvQPLpStA@mail.gmail.com>

On Wed, Oct 11, 2017 at 7:17 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Wed, Oct 11, 2017 at 6:28 PM, Dan Williams <dan.j.williams@intel.com> wrote:
>> On Wed, Oct 11, 2017 at 6:21 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
>>> On Wed, Oct 11, 2017 at 05:47:18PM -0700, Dan Williams wrote:
>>>> The MAP_DIRECT mechanism for mmap intends to use a file lease to prevent
>>>> block map changes while the file is mapped. It requires the fd to setup
>>>> an fasync_struct for signalling lease break events to the lease holder.
>>>
>>> *UGH*
>>>
>>> That looks like one hell of a bad API.  You are not even guaranteed that
>>> descriptor will remain be still open by the time you pass it down to your
>>> helper, nevermind the moment when event actually happens...
>>
>> What am I missing, fcntl(F_SETLEASE) seems to follow a similar pattern?
>
> Ugh, so I think the difference with F_SETLEASE is that the lease ends
> when the fd is closed. In the mmap case the lease follows the lifetime
> of the vma. I'll rethink this interface...

I'm not seeing a lot of good options outside of documenting that if
you close the fd that is registered with MAP_DIRECT you may still get
SIGIO notifications with si_fd set to the stale fd.

WARNING: multiple messages have this Message-ID (diff)
From: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
Cc: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>,
	"Darrick J. Wong"
	<darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
	Linux API <linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org"
	<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>,
	Dave Chinner <david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org>,
	linux-xfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Linux MM <linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	linux-fsdevel
	<linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Subject: Re: [PATCH v9 2/6] fs, mm: pass fd to ->mmap_validate()
Date: Wed, 11 Oct 2017 20:44:01 -0700	[thread overview]
Message-ID: <CAPcyv4gKXgq5=MNMSk3idk0_jqfPR1Eh-NwQYCAfYWDjEqYNcA@mail.gmail.com> (raw)
In-Reply-To: <CAPcyv4ij9E9tXPLqp6cUAY3dJzh7OS+yPsVDME50xSvQPLpStA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Wed, Oct 11, 2017 at 7:17 PM, Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> On Wed, Oct 11, 2017 at 6:28 PM, Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
>> On Wed, Oct 11, 2017 at 6:21 PM, Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org> wrote:
>>> On Wed, Oct 11, 2017 at 05:47:18PM -0700, Dan Williams wrote:
>>>> The MAP_DIRECT mechanism for mmap intends to use a file lease to prevent
>>>> block map changes while the file is mapped. It requires the fd to setup
>>>> an fasync_struct for signalling lease break events to the lease holder.
>>>
>>> *UGH*
>>>
>>> That looks like one hell of a bad API.  You are not even guaranteed that
>>> descriptor will remain be still open by the time you pass it down to your
>>> helper, nevermind the moment when event actually happens...
>>
>> What am I missing, fcntl(F_SETLEASE) seems to follow a similar pattern?
>
> Ugh, so I think the difference with F_SETLEASE is that the lease ends
> when the fd is closed. In the mmap case the lease follows the lifetime
> of the vma. I'll rethink this interface...

I'm not seeing a lot of good options outside of documenting that if
you close the fd that is registered with MAP_DIRECT you may still get
SIGIO notifications with si_fd set to the stale fd.

  reply	other threads:[~2017-10-12  3:40 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12  0:47 [PATCH v9 0/6] MAP_DIRECT for DAX userspace flush Dan Williams
2017-10-12  0:47 ` Dan Williams
2017-10-12  0:47 ` Dan Williams
2017-10-12  0:47 ` [PATCH v9 1/6] mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12 13:51   ` Jan Kara
2017-10-12 13:51     ` Jan Kara
2017-10-12 13:51     ` Jan Kara
2017-10-12 13:51     ` Jan Kara
2017-10-12 16:32     ` Linus Torvalds
2017-10-12 16:32       ` Linus Torvalds
2017-10-12 16:32       ` Linus Torvalds
2017-10-16  7:38       ` Christoph Hellwig
2017-10-16  7:38         ` Christoph Hellwig
2017-10-16  7:38         ` Christoph Hellwig
2017-10-16  7:56       ` Jan Kara
2017-10-16  7:56         ` Jan Kara
2017-10-16  7:56         ` Jan Kara
2017-10-12  0:47 ` [PATCH v9 2/6] fs, mm: pass fd to ->mmap_validate() Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  1:21   ` Al Viro
2017-10-12  1:21     ` Al Viro
2017-10-12  1:21     ` Al Viro
2017-10-12  1:21     ` Al Viro
2017-10-12  1:28     ` Dan Williams
2017-10-12  1:28       ` Dan Williams
2017-10-12  1:28       ` Dan Williams
2017-10-12  1:28       ` Dan Williams
2017-10-12  2:17       ` Dan Williams
2017-10-12  2:17         ` Dan Williams
2017-10-12  2:17         ` Dan Williams
2017-10-12  2:17         ` Dan Williams
2017-10-12  3:44         ` Dan Williams [this message]
2017-10-12  3:44           ` Dan Williams
2017-10-12  3:44           ` Dan Williams
2017-10-12  3:44           ` Dan Williams
2017-10-12  0:47 ` [PATCH v9 3/6] fs: MAP_DIRECT core Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47 ` [PATCH v9 4/6] xfs: prepare xfs_break_layouts() for reuse with MAP_DIRECT Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47 ` [PATCH v9 5/6] fs, xfs, iomap: introduce break_layout_nowait() Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47 ` [PATCH v9 6/6] xfs: wire up MAP_DIRECT Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12  0:47   ` Dan Williams
2017-10-12 14:23 ` [PATCH v9 0/6] MAP_DIRECT for DAX userspace flush Christoph Hellwig
2017-10-12 14:23   ` Christoph Hellwig
2017-10-12 14:23   ` Christoph Hellwig
2017-10-12 17:41   ` Dan Williams
2017-10-12 17:41     ` Dan Williams
2017-10-12 17:41     ` Dan Williams
2017-10-13  6:57     ` Christoph Hellwig
2017-10-13  6:57       ` Christoph Hellwig
2017-10-13  6:57       ` Christoph Hellwig
2017-10-13 15:14       ` Dan Williams
2017-10-13 15:14         ` Dan Williams
2017-10-13 15:14         ` Dan Williams
2017-10-13 16:38         ` Jason Gunthorpe
2017-10-13 16:38           ` Jason Gunthorpe
2017-10-13 16:38           ` Jason Gunthorpe
2017-10-13 16:38           ` Jason Gunthorpe
2017-10-13 17:01           ` Dan Williams
2017-10-13 17:01             ` Dan Williams
2017-10-13 17:01             ` Dan Williams
2017-10-13 17:01             ` Dan Williams
2017-10-13 17:31             ` Jason Gunthorpe
2017-10-13 17:31               ` Jason Gunthorpe
2017-10-13 17:31               ` Jason Gunthorpe
2017-10-13 17:31               ` Jason Gunthorpe
2017-10-13 18:22               ` Dan Williams
2017-10-13 18:22                 ` Dan Williams
2017-10-13 18:22                 ` Dan Williams
2017-10-13 18:22                 ` Dan Williams
2017-10-14  1:57                 ` Jason Gunthorpe
2017-10-14  1:57                   ` Jason Gunthorpe
2017-10-14  1:57                   ` Jason Gunthorpe
2017-10-14  1:57                   ` Jason Gunthorpe
2017-10-16 12:02                   ` Sagi Grimberg
2017-10-16 12:02                     ` Sagi Grimberg
2017-10-19  6:02                     ` Jason Gunthorpe
2017-10-19  6:02                       ` Jason Gunthorpe
2017-10-19  6:02                       ` Jason Gunthorpe
2017-10-19  6:02                       ` Jason Gunthorpe
2017-10-16  7:30                 ` Christoph Hellwig
2017-10-16  7:30                   ` Christoph Hellwig
2017-10-16  7:30                   ` Christoph Hellwig
2017-10-16  7:26               ` Christoph Hellwig
2017-10-16  7:26                 ` Christoph Hellwig
2017-10-16  7:26                 ` Christoph Hellwig
2017-10-16 12:07                 ` Sagi Grimberg
2017-10-16 12:07                   ` Sagi Grimberg
2017-10-16 12:07                   ` Sagi Grimberg
2017-10-16 17:43                 ` Dan Williams
2017-10-16 17:43                   ` Dan Williams
2017-10-16 17:43                   ` Dan Williams
2017-10-16 19:44                   ` Dan Williams
2017-10-16 19:44                     ` Dan Williams
2017-10-16 19:44                     ` Dan Williams
2017-10-17  6:46                     ` Christoph Hellwig
2017-10-17  6:46                       ` Christoph Hellwig
2017-10-17  6:46                       ` Christoph Hellwig
2017-10-17  6:46                       ` Christoph Hellwig
2017-10-16  7:22           ` Christoph Hellwig
2017-10-16  7:22             ` Christoph Hellwig
2017-10-16  7:22             ` Christoph Hellwig
2017-10-16  7:22             ` Christoph Hellwig

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='CAPcyv4gKXgq5=MNMSk3idk0_jqfPR1Eh-NwQYCAfYWDjEqYNcA@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=linux-xfs@vger.kernel.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 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.