[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190829161627.GB18249@iweiny-DESK2.sc.intel.com>
Date: Thu, 29 Aug 2019 09:16:28 -0700
From: Ira Weiny <ira.weiny@...el.com>
To: John Hubbard <jhubbard@...dia.com>
Cc: Dave Chinner <david@...morbit.com>, Jason Gunthorpe <jgg@...pe.ca>,
Jan Kara <jack@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>,
Dan Williams <dan.j.williams@...el.com>,
Matthew Wilcox <willy@...radead.org>,
Theodore Ts'o <tytso@....edu>, Michal Hocko <mhocko@...e.com>,
linux-xfs@...r.kernel.org, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-nvdimm@...ts.01.org, linux-ext4@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [RFC PATCH v2 00/19] RDMA/FS DAX truncate proposal V1,000,002 ;-)
On Wed, Aug 28, 2019 at 08:27:23PM -0700, John Hubbard wrote:
> On 8/28/19 7:02 PM, Ira Weiny wrote:
> > On Mon, Aug 26, 2019 at 03:55:10PM +1000, Dave Chinner wrote:
> > > On Fri, Aug 23, 2019 at 10:08:36PM -0700, Ira Weiny wrote:
> > > > On Sat, Aug 24, 2019 at 10:11:24AM +1000, Dave Chinner wrote:
> > > > > On Fri, Aug 23, 2019 at 09:04:29AM -0300, Jason Gunthorpe wrote:
> ...
> > >
> > > Sure, that part works because the struct file is passed. It doesn't
> > > end up with the same fd number in the other process, though.
> > >
> > > The issue is that layout leases need to notify userspace when they
> > > are broken by the kernel, so a lease stores the owner pid/tid in the
> > > file->f_owner field via __f_setown(). It also keeps a struct fasync
> > > attached to the file_lock that records the fd that the lease was
> > > created on. When a signal needs to be sent to userspace for that
> > > lease, we call kill_fasync() and that walks the list of fasync
> > > structures on the lease and calls:
> > >
> > > send_sigio(fown, fa->fa_fd, band);
> > >
> > > And it does for every fasync struct attached to a lease. Yes, a
> > > lease can track multiple fds, but it can only track them in a single
> > > process context. The moment the struct file is shared with another
> > > process, the lease is no longer capable of sending notifications to
> > > all the lease holders.
> > >
> > > Yes, you can change the owning process via F_SETOWNER, but that's
> > > still only a single process context, and you can't change the fd in
> > > the fasync list. You can add new fd to an existing lease by calling
> > > F_SETLEASE on the new fd, but you still only have a single process
> > > owner context for signal delivery.
> > >
> > > As such, leases that require callbacks to userspace are currently
> > > only valid within the process context the lease was taken in.
> >
> > But for long term pins we are not requiring callbacks.
> >
>
> Hi Ira,
>
> If "require callbacks to userspace" means sending SIGIO, then actually
> FOLL_LONGTERM *does* require those callbacks. Because we've been, so
> far, equating FOLL_LONGTERM with the vaddr_pin struct and with a lease.
>
> What am I missing here?
We agreed back in June that the layout lease would have 2 "levels". The
"normal" layout lease would cause SIGIO and could be broken and another
"exclusive" level which could _not_ be broken.
Because we _can't_ _trust_ user space to react to the SIGIO properly the
"exclusive" lease is required to take the longterm pins. Also this is the
lease which causes the truncate to fail (return ETXTBSY) because the kernel
can't break the lease.
The vaddr_pin struct in the current RFC is there for a couple of reasons.
1) To ensure that we have a way to correlate the long term pin user with the
file if the data file FD's are closed. (ie the application has zombie'd the
lease).
2) And more importantly as a token the vaddr_pin*() callers use to be able to
properly ref count the file itself while in use.
Ira
Powered by blists - more mailing lists