lkml.org 
[lkml]   [2010]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1.1 2/5] IMA: define readcount functions
From
Date
On Tue, 2010-11-02 at 11:45 +1100, Dave Chinner wrote:
> On Mon, Nov 01, 2010 at 03:45:36PM -0400, Mimi Zohar wrote:
> > Define iget/iput_readcount() functions to be called from the VFS layer.
>
> Can't say I like the function names. i_readcount_{inc,dec} seem more
> appropriate, especially so they don't get confused with inode
> reference counting...
>
> Cheers,
>
> Dave.

Definitely better naming. thanks!

> > +void iput_readcount(struct inode *inode)
> > +{
> > + spin_lock(&inode->i_lock);
> > + if (unlikely((atomic_read(&inode->i_readcount) == 0)))
> > + printk(KERN_INFO "i_readcount: imbalance ino %ld\n",
> > + inode->i_ino);
> > + else
> > + atomic_dec(&inode->i_readcount);
> > + spin_unlock(&inode->i_lock);
> > +}
>
> No need for the lock just to indicate an imbalance. You could just
> use:
>
> if (atomic_dec_return(&inode->i_readcount) < 0) {
> .....
> }
>
> Given this is an integrity subsystem, I suspect the correct thing to
> do here is BUG(), not just issue an informational message that
> something is wrong with the integrity tracking....
>
> Cheers,
>
> Dave.

Yes, as Eric explained, the testing is a remnant from IMA, when it
wasn't fully integrated in the kernel.

thanks,

Mimi



\
 
 \ /
  Last update: 2010-11-02 13:25    [W:0.034 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site