The patch titled fs-truncate-blocks-outside-i_size-after-o_direct-write-error-fix has been added to the -mm tree. Its filename is fs-truncate-blocks-outside-i_size-after-o_direct-write-error-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: fs-truncate-blocks-outside-i_size-after-o_direct-write-error-fix From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Badari Pulavarty <pbadari@xxxxxxxxxx> Cc: Chris Mason <chris.mason@xxxxxxxxxx> Cc: Dave Chinner <david@xxxxxxxxxxxxx> Cc: Dmitri Monakhov <dmonakhov@xxxxxxxxxx> Cc: Nick Piggin <npiggin@xxxxxxx> Cc: Zach Brown <zach.brown@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/direct-io.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff -puN fs/direct-io.c~fs-truncate-blocks-outside-i_size-after-o_direct-write-error-fix fs/direct-io.c --- a/fs/direct-io.c~fs-truncate-blocks-outside-i_size-after-o_direct-write-error-fix +++ a/fs/direct-io.c @@ -1215,9 +1215,12 @@ __blockdev_direct_IO(int rw, struct kioc * NOTE: DIO_NO_LOCK/DIO_OWN_LOCK callers have to handle this by * it's own meaner. */ - if (unlikely(retval < 0 && (rw & WRITE) && (end > i_size_read(inode)) - && dio_lock_type == DIO_LOCKING)) - vmtruncate(inode, inode->i_size); + if (unlikely(retval < 0 && (rw & WRITE))) { + loff_t isize = i_size_read(inode); + + if (end > isize && dio_lock_type == DIO_LOCKING) + vmtruncate(inode, isize); + } if (rw == READ && dio_lock_type == DIO_LOCKING) release_i_mutex = 0; _ Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are bdi-register-sysfs-bdi-device-only-once-per-queue.patch ksym_symbol_len-fixes.patch mm-remove-the-might_sleep-from-lock_page.patch make-linx-next-apply.patch linux-next.patch next-remove-localversion.patch tick-schedc-suppress-needless-timer-reprogramming.patch linux-timexh-cleanup-for-userspace.patch drivers-input-touchscreen-ucb1400_tsc-needs-gpio.patch netdev-smc911x-fix-for-driver-resume-cleanup.patch backlight-catch-invalid-input.patch pci-uninline-pci_ioremap_bar.patch scsi-dpt_i2o-is-bust-on-ia64.patch mm-invoke-oom-killer-from-page-fault-fix.patch mm-invoke-oom-killer-from-page-fault-fix-fix-2.patch mm-write_cache_pages-more-terminate-quickly.patch fs-truncate-blocks-outside-i_size-after-o_direct-write-error-fix.patch init-properly-placing-noinline-keyword.patch add-pr_prefix-to-pr_xyz-macros-checkpatch-fixes.patch poll-allow-f_op-poll-to-sleep-take6.patch binfmtsh-include-listh-fix.patch max3100-spi-uart-driver-select-serial_core-fix.patch spi_gpio-driver-cleanups.patch kprobes-support-probing-module-__exit-function-fix.patch kprobes-support-probing-module-__exit-function-fix-2.patch rtc-au1000-on-chip-counter0-as-rtc-driver-fix.patch memcg-introduce-charge-commit-cancel-style-of-functions-fix.patch memcg-new-force_empty-to-free-pages-under-group-fix-fix.patch memcg-swap-cgroup-for-remembering-usage.patch memory-cgroup-resource-counters-for-hierarchy-v4-checkpatch-fixes.patch memory-cgroup-hierarchical-reclaim-v4-checkpatch-fixes.patch memcg-avoid-unnecessary-system-wide-oom-killer-fix.patch edac-struct-device-replace-bus_id-with-dev_name-dev_set_name-checkpatch-fixes.patch edac-x38-use-the-architectures-readq-function-fix.patch romfs-romfs_iget-unsigned-ino-=-0-is-always-true-checkpatch-fixes.patch filesystem-freeze-implement-generic-freeze-feature-fix.patch linuxpps-core-support-drivers-pps-sysfsc-make-dev_attr_name-static.patch nilfs2-inode-operations-fix.patch nilfs2-pathname-operations-fix.patch nilfs2-super-block-operations-fix.patch reiser4.patch reiser4-tree_lock-fixes.patch reiser4-tree_lock-fixes-fix.patch reiser4-semaphore-fix.patch slb-drop-kmem-cache-argument-from-constructor-reiser4.patch reiser4-suid.patch reiser4-track-upstream-changes.patch reiser4-remove-simple_prepare_write-usage-checkpatch-fixes.patch nr_blockdev_pages-in_interrupt-warning.patch slab-leaks3-default-y.patch put_bh-debug.patch shrink_slab-handle-bad-shrinkers.patch getblk-handle-2tb-devices.patch getblk-handle-2tb-devices-fix.patch undeprecate-pci_find_device.patch notify_change-callers-must-hold-i_mutex.patch drivers-net-bonding-bond_sysfsc-suppress-uninitialized-var-warning.patch w1-build-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html