Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix write(2) return zero bug from 933ec99 #5726

Merged
merged 1 commit into from
Feb 2, 2017

Conversation

tuxoko
Copy link
Contributor

@tuxoko tuxoko commented Feb 1, 2017

For generic_write_checks with 2 args, we can exit when it returns zero because
it means count is zero. However this is not the case for generic_write_checks
with 4 args, where zero means no error.

Signed-off-by: Chunwei Chen [email protected]

@mention-bot
Copy link

@tuxoko, thanks for your PR! By analyzing the history of the files in this pull request, we identified @behlendorf, @dweeezil and @ryao to be potential reviewers.

@inkdot7
Copy link
Contributor

inkdot7 commented Feb 1, 2017

7a7c706 (tuxoko/iter_fix) resolves #5720 for me.

@tuxoko
Copy link
Contributor Author

tuxoko commented Feb 1, 2017

@inkdot7 Thanks for testing.

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job running this down.

@@ -387,6 +387,8 @@ zpl_iter_write(struct kiocb *kiocb, struct iov_iter *from)

count = iov_iter_count(from);
ret = generic_write_checks(file, &kiocb->ki_pos, &count, isblk);
if (ret < 0)
return (ret);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make the same change to zpl_aio_write.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or I can make both != 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'd be fine, I think sameness is the important thing.

@@ -395,9 +397,9 @@ zpl_iter_write(struct kiocb *kiocb, struct iov_iter *from)
*/
ret = generic_write_checks(kiocb, from);
count = ret;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could move the count = ret; assignment after the ret check now, but it really doesn't matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.

For generic_write_checks with 2 args, we can exit when it returns zero because
it means count is zero. However this is not the case for generic_write_checks
with 4 args, where zero means no error.

Signed-off-by: Chunwei Chen <[email protected]>
@behlendorf behlendorf merged commit c7af63d into openzfs:master Feb 2, 2017
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Feb 2, 2017
For generic_write_checks with 2 args, we can exit when it returns zero because
it means count is zero. However this is not the case for generic_write_checks
with 4 args, where zero means no error.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Haakan T Johansson <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes openzfs#5720 
Closes openzfs#5726
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Feb 2, 2017
For generic_write_checks with 2 args, we can exit when it returns zero because
it means count is zero. However this is not the case for generic_write_checks
with 4 args, where zero means no error.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Haakan T Johansson <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes openzfs#5720
Closes openzfs#5726
Requires-builders: style
behlendorf pushed a commit that referenced this pull request Feb 3, 2017
For generic_write_checks with 2 args, we can exit when it returns zero because
it means count is zero. However this is not the case for generic_write_checks
with 4 args, where zero means no error.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Haakan T Johansson <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes #5720
Closes #5726
wli5 pushed a commit to wli5/zfs that referenced this pull request Feb 28, 2017
For generic_write_checks with 2 args, we can exit when it returns zero because
it means count is zero. However this is not the case for generic_write_checks
with 4 args, where zero means no error.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Haakan T Johansson <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes openzfs#5720 
Closes openzfs#5726
wli5 pushed a commit to wli5/zfs that referenced this pull request Feb 28, 2017
For generic_write_checks with 2 args, we can exit when it returns zero because
it means count is zero. However this is not the case for generic_write_checks
with 4 args, where zero means no error.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Haakan T Johansson <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes openzfs#5720
Closes openzfs#5726
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants