Use f_lock to protect f_flags
[linux-2.6-block.git] / drivers / char / tty_io.c
index bc84e125c6bc428ca1d51cbcb29909466ea96b87..224f271d8cbe06868d69ce415339efa30f110d55 100644 (file)
@@ -2162,13 +2162,12 @@ static int fionbio(struct file *file, int __user *p)
        if (get_user(nonblock, p))
                return -EFAULT;
 
-       /* file->f_flags is still BKL protected in the fs layer - vomit */
-       lock_kernel();
+       spin_lock(&file->f_lock);
        if (nonblock)
                file->f_flags |= O_NONBLOCK;
        else
                file->f_flags &= ~O_NONBLOCK;
-       unlock_kernel();
+       spin_unlock(&file->f_lock);
        return 0;
 }