[19/90] ext4: Return exchanged blocks count to user space in failure

Greg KH
2009-12-11T04:36:38Z

[-- Attachment #1: 0019-ext4-Return-exchanged-blocks-count-to-user-space-in-.patch --]
[-- Type: text/plain, Size: 871 bytes --]

2.6.31-stable review patch. If anyone has any objections, please let us know.

------------------
(cherry picked from commit 8d6669133d8cdbb7cbe0e1f0f3744e7802a84afe)

Return exchanged blocks count (moved_len) to user space,
if ext4_move_extents() failed on the way.

Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/ext4/ioctl.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -243,10 +243,9 @@ setversion_out:
me.donor_start, me.len, &me.moved_len);
fput(donor_filp);

- if (!err)
- if (copy_to_user((struct move_extent *)arg,
- &me, sizeof(me)))
- return -EFAULT;
+ if (copy_to_user((struct move_extent *)arg, &me, sizeof(me)))
+ return -EFAULT;
+
return err;
}