lkml.org 
[lkml]   [2008]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [patch 3/5] fuse: fix race in llseek
    From
    Date
    > > +static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
    > > +{
    > > + long long retval;
    >
    > I switched this to have a type of loff_t.

    Ugh, right. I wonder where that long long came from. I probably
    copied the generic_file_llseek() from some earlier kernel...

    >
    > > + struct inode *inode = file->f_path.dentry->d_inode;
    > > +
    > > + mutex_lock(&inode->i_mutex);
    > > + switch (origin) {
    > > + case SEEK_END:
    > > + offset += i_size_read(inode);
    >
    > As we hold i_mutex we could directly read inode->i_size here, save a few
    > cycles.

    No, that's the whole point of the fuse specific function: fuse doesn't
    use i_mutex to protect writing i_size, instead it uses a per
    filesystem spinlock.

    This is probably worth a comment though, so I'll do that.

    Thanks,
    Miklos


    \
     
     \ /
      Last update: 2008-04-28 09:55    [W:0.029 / U:30.604 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site