lkml.org 
[lkml]   [2013]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] futex: Remove requirement for lock_page in get_futex_key
On Tue, Oct 29, 2013 at 02:48:27PM -0400, Chris Mason wrote:
> > + /* Should be impossible but lets be paranoid for now */
> > + if (WARN_ON(inode->i_mapping != mapping)) {
> > + rcu_read_unlock();
> > + iput(inode);
> > + put_page(page_head);
> > + goto again;
> > + }
> > +
>
> Once you call iput, you add the potential to call the filesystem unlink
> operation if i_nlink had gone to zero. This shouldn't be a problem
> since you've dropped the rcu lock, but just for fun I'd move the
> put_page up a line.
>
> Or, change it to a BUG_ON instead, it really should be impossible.

So I still meant to have a look at the RCU freeing of inodes etc.. but
that comparison was to guard against inode reuse. I don't know if that
actually happens, the inode free path is a tad longer than is trivially
understood.

But if an inode would be put on a free list and reused the
atomic_inc_not_zero() could inc on a different inode than the one we
wanted and thus we need to validate we indeed got the object we set out
to acquire.

Now if its guaranteed that once an inode's refcount hits zero it will be
freed the above test is indeed superfluous and we can do the BUG_ON as
you suggest.


\
 
 \ /
  Last update: 2013-10-30 10:21    [W:0.061 / U:3.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site