[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200507065451.GA6185@lst.de>
Date: Thu, 7 May 2020 08:54:51 +0200
From: Christoph Hellwig <hch@....de>
To: Michael Ellerman <mpe@...erman.id.au>
Cc: Christoph Hellwig <hch@....de>, linuxppc-dev@...abs.org,
jk@...abs.org, viro@...iv.linux.org.uk,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] powerpc/spufs: Add rcu_read_lock() around fcheck()
On Wed, Apr 29, 2020 at 09:42:39PM +1000, Michael Ellerman wrote:
> Christoph Hellwig <hch@....de> writes:
> > On Tue, Apr 28, 2020 at 09:48:11PM +1000, Michael Ellerman wrote:
> >>
> >> This comes from fcheck_files() via fcheck().
> >>
> >> It's pretty clearly documented that fcheck() must be wrapped with
> >> rcu_read_lock(), so fix it.
> >
> > But for this to actually be useful you'd need the rcu read lock until
> > your are done with the file (or got a reference).
>
> Hmm OK. My reasoning was that we were done with the struct file, because
> we return the ctx that's hanging off the inode.
>
> + ctx = SPUFS_I(file_inode(file))->i_ctx;
>
> But I guess the lifetime of the ctx is not guaranteed if the file goes
> away.
>
> It looks like the only long lived reference on the ctx is the one
> taken in spufs_new_file() and dropped in spufs_evict_inode().
>
> So if we take a reference to the ctx with the RCU lock held we should be
> safe, I think. But I've definitely exhausted my spufs/vfs knowledge at
> this point.
>
> Something like below.
Looks reasonable.
Powered by blists - more mailing lists