lkml.org 
[lkml]   [2006]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: PROBLEM: pthread-safety bug in write(2) on Linux 2.6.x
    Linus Torvalds writes:
    >

    [...]

    > + * so it's ok to test it independently on the lock/unlock path
    > + * rather than explicitly remembering whether we locked it.
    > + */
    > +static inline loff_t file_pos_read_lock(struct file *file)
    > {
    > + if (file->f_mode & FMODE_LSEEK)
    > + mutex_lock(&file->f_pos_lock);
    > return file->f_pos;
    > }
    >
    > -static inline void file_pos_write(struct file *file, loff_t pos)
    > +static inline void file_pos_write_unlock(struct file *file, loff_t pos)
    > {
    > file->f_pos = pos;
    > + if (file->f_mode & FMODE_LSEEK)
    > + mutex_unlock(&file->f_pos_lock);
    > }

    Naming of two functions above is confusing: it looks like read/write
    lock is taken. Maybe file_pos_lock_and_get() and
    file_pos_set_and_unlock()?

    Nikita.
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-04-14 12:27    [W:0.021 / U:91.040 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site