[lkml]   [2007]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [RESEND] file operations: release can race with read/write?
    On Wed, Oct 17, 2007 at 11:30:44AM -0700, Roland Dreier wrote:
    > static unsigned long flag;
    > static int cw_open(struct inode *inode, struct file *filp)
    > {
    > return 0;
    > }
    > static int cw_close(struct inode *inode, struct file *filp)
    > {
    > clear_bit(1, &flag);
    > msleep(1);
    > if (test_and_set_bit(1, &flag))
    > printk(KERN_ERR "Write raced with close?\n");

    Of _course_ you can trigger that - just open two files and have write
    on one of them while another gets closed.

    That is certainly possible, but it has nothing whatsoever with the
    race you've described - you have two different objects and method
    call on one of them might happen when destructor is called on another.

    You have protection against ->release() for a struct file called
    while you are in ->write() for _same_ struct file.
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2007-10-17 21:37    [W:0.020 / U:3.952 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site