Loading Documentation/filesystems/Locking +5 −2 Original line number Diff line number Diff line Loading @@ -437,8 +437,11 @@ grab BKL for cases when we close a file that had been opened r/w, but that can and should be done using the internal locking with smaller critical areas). Current worst offender is ext2_get_block()... ->fasync() is a mess. This area needs a big cleanup and that will probably affect locking. ->fasync() is called without BKL protection, and is responsible for maintaining the FASYNC bit in filp->f_flags. Most instances call fasync_helper(), which does that maintenance, so it's not normally something one needs to worry about. Return values > 0 will be mapped to zero in the VFS layer. ->readdir() and ->ioctl() on directories must be changed. Ideally we would move ->readdir() to inode_operations and use a separate method for directory Loading drivers/char/sonypi.c +1 −6 Original line number Diff line number Diff line Loading @@ -888,12 +888,7 @@ static irqreturn_t sonypi_irq(int irq, void *dev_id) static int sonypi_misc_fasync(int fd, struct file *filp, int on) { int retval; retval = fasync_helper(fd, filp, on, &sonypi_device.fifo_async); if (retval < 0) return retval; return 0; return fasync_helper(fd, filp, on, &sonypi_device.fifo_async); } static int sonypi_misc_release(struct inode *inode, struct file *file) Loading drivers/char/tty_io.c +2 −3 Original line number Diff line number Diff line Loading @@ -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; } Loading drivers/gpu/drm/drm_fops.c +1 −5 Original line number Diff line number Diff line Loading @@ -337,14 +337,10 @@ int drm_fasync(int fd, struct file *filp, int on) { struct drm_file *priv = filp->private_data; struct drm_device *dev = priv->minor->dev; int retcode; DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)old_encode_dev(priv->minor->device)); retcode = fasync_helper(fd, filp, on, &dev->buf_async); if (retcode < 0) return retcode; return 0; return fasync_helper(fd, filp, on, &dev->buf_async); } EXPORT_SYMBOL(drm_fasync); Loading drivers/hid/usbhid/hiddev.c +1 −4 Original line number Diff line number Diff line Loading @@ -227,12 +227,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report) */ static int hiddev_fasync(int fd, struct file *file, int on) { int retval; struct hiddev_list *list = file->private_data; retval = fasync_helper(fd, file, on, &list->fasync); return retval < 0 ? retval : 0; return fasync_helper(fd, file, on, &list->fasync); } Loading Loading
Documentation/filesystems/Locking +5 −2 Original line number Diff line number Diff line Loading @@ -437,8 +437,11 @@ grab BKL for cases when we close a file that had been opened r/w, but that can and should be done using the internal locking with smaller critical areas). Current worst offender is ext2_get_block()... ->fasync() is a mess. This area needs a big cleanup and that will probably affect locking. ->fasync() is called without BKL protection, and is responsible for maintaining the FASYNC bit in filp->f_flags. Most instances call fasync_helper(), which does that maintenance, so it's not normally something one needs to worry about. Return values > 0 will be mapped to zero in the VFS layer. ->readdir() and ->ioctl() on directories must be changed. Ideally we would move ->readdir() to inode_operations and use a separate method for directory Loading
drivers/char/sonypi.c +1 −6 Original line number Diff line number Diff line Loading @@ -888,12 +888,7 @@ static irqreturn_t sonypi_irq(int irq, void *dev_id) static int sonypi_misc_fasync(int fd, struct file *filp, int on) { int retval; retval = fasync_helper(fd, filp, on, &sonypi_device.fifo_async); if (retval < 0) return retval; return 0; return fasync_helper(fd, filp, on, &sonypi_device.fifo_async); } static int sonypi_misc_release(struct inode *inode, struct file *file) Loading
drivers/char/tty_io.c +2 −3 Original line number Diff line number Diff line Loading @@ -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; } Loading
drivers/gpu/drm/drm_fops.c +1 −5 Original line number Diff line number Diff line Loading @@ -337,14 +337,10 @@ int drm_fasync(int fd, struct file *filp, int on) { struct drm_file *priv = filp->private_data; struct drm_device *dev = priv->minor->dev; int retcode; DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)old_encode_dev(priv->minor->device)); retcode = fasync_helper(fd, filp, on, &dev->buf_async); if (retcode < 0) return retcode; return 0; return fasync_helper(fd, filp, on, &dev->buf_async); } EXPORT_SYMBOL(drm_fasync); Loading
drivers/hid/usbhid/hiddev.c +1 −4 Original line number Diff line number Diff line Loading @@ -227,12 +227,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report) */ static int hiddev_fasync(int fd, struct file *file, int on) { int retval; struct hiddev_list *list = file->private_data; retval = fasync_helper(fd, file, on, &list->fasync); return retval < 0 ? retval : 0; return fasync_helper(fd, file, on, &list->fasync); } Loading