X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzpl_file.c;h=c6d97db50246e7c4824623db4b81165ffdb74bd9;hb=c12936b141e7479a1402561e9e528731d763747e;hp=2e9f72ad12d99f3452b2dbe47c5983f374dd885f;hpb=62c4165a1bbfb7d68f8ebf93d32a6fc8ea4d4e33;p=zfs.git diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c index 2e9f72a..c6d97db 100644 --- a/module/zfs/zpl_file.c +++ b/module/zfs/zpl_file.c @@ -357,8 +357,16 @@ zpl_putpage(struct page *pp, struct writeback_control *wbc, void *data) ASSERT(PageLocked(pp)); ASSERT(!PageWriteback(pp)); - + ASSERT(!(current->flags & PF_NOFS)); + + /* + * Annotate this call path with a flag that indicates that it is + * unsafe to use KM_SLEEP during memory allocations due to the + * potential for a deadlock. KM_PUSHPAGE should be used instead. + */ + current->flags |= PF_NOFS; (void) zfs_putpage(mapping->host, pp, wbc); + current->flags &= ~PF_NOFS; return (0); } @@ -425,6 +433,27 @@ zpl_fallocate(struct file *filp, int mode, loff_t offset, loff_t len) } #endif /* HAVE_FILE_FALLOCATE */ +static long +zpl_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + case ZFS_IOC_GETFLAGS: + case ZFS_IOC_SETFLAGS: + return (-EOPNOTSUPP); + default: + return (-ENOTTY); + } +} + +#ifdef CONFIG_COMPAT +static long +zpl_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + return zpl_ioctl(filp, cmd, arg); +} +#endif /* CONFIG_COMPAT */ + + const struct address_space_operations zpl_address_space_operations = { .readpages = zpl_readpages, .readpage = zpl_readpage, @@ -438,12 +467,15 @@ const struct file_operations zpl_file_operations = { .llseek = generic_file_llseek, .read = zpl_read, .write = zpl_write, - .readdir = zpl_readdir, .mmap = zpl_mmap, .fsync = zpl_fsync, #ifdef HAVE_FILE_FALLOCATE .fallocate = zpl_fallocate, #endif /* HAVE_FILE_FALLOCATE */ + .unlocked_ioctl = zpl_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = zpl_compat_ioctl, +#endif }; const struct file_operations zpl_dir_file_operations = { @@ -451,4 +483,8 @@ const struct file_operations zpl_dir_file_operations = { .read = generic_read_dir, .readdir = zpl_readdir, .fsync = zpl_fsync, + .unlocked_ioctl = zpl_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = zpl_compat_ioctl, +#endif };