-
Notifications
You must be signed in to change notification settings - Fork 91
fix: start_block misalignment caused by SIGSTOP #552
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
base: v2.4.8-windows-support
Are you sure you want to change the base?
Changes from 9 commits
50f611f
33807bf
c89ef57
0cc254e
b24237b
ecefedd
9c20a47
855ae40
1b904ff
6ffafcd
148556b
d29056f
e509bfe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1187,6 +1187,9 @@ int tape_spacefm(struct device_data *dev, int count) | |
| ssize_t tape_write(struct device_data *dev, const char *buf, size_t count, bool ignore_less, bool ignore_nospc) | ||
| { | ||
| ssize_t ret; | ||
| struct tc_position current_position; | ||
| int ret_for_update_position = 0; | ||
| unsigned long long diff = 0; | ||
|
|
||
| CHECK_ARG_NULL(dev, -LTFS_NULL_ARG); | ||
| CHECK_ARG_NULL(buf, -LTFS_NULL_ARG); | ||
|
|
@@ -1241,6 +1244,24 @@ ssize_t tape_write(struct device_data *dev, const char *buf, size_t count, bool | |
| count = -LTFS_LESS_SPACE; | ||
| } | ||
|
|
||
| if (ltfs_caught_sigcont()) { | ||
| ltfsmsg(LTFS_DEBUG, 16503D, "ltfs_caught_sigcont", "tape_write"); | ||
| ret_for_update_position = tape_update_position(dev, ¤t_position); | ||
| if (ret_for_update_position) { | ||
| /* Return error since the current tape position was unable to be determined, so there could be an undetected position mismatch */ | ||
| ltfsmsg(LTFS_ERR, 11081E, ret); | ||
| return -LTFS_WRITE_ERROR; | ||
| } | ||
|
|
||
| ltfsmsg(LTFS_INFO, 11334I, "compare offset in tape_write", (unsigned long long)dev->position.block, (unsigned long long)current_position.block); | ||
| diff = ((unsigned long long)dev->position.block - (unsigned long long)current_position.block); | ||
| if (diff) { | ||
| /* Position mismatch, diff not equal zero */ | ||
| ltfsmsg(LTFS_INFO, 17293I, (unsigned long long)dev->position.block, (unsigned long long)current_position.block); | ||
| return -LTFS_WRITE_ERROR; | ||
| } | ||
| } | ||
|
Comment on lines
+1263
to
+1264
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's needed to put the "caught_sigcont" value as false before leaving the if() to avoid this check again if it's not necessary
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @amissael95 Could you confirm this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! Done in new commit |
||
|
|
||
| ltfs_mutex_lock(&dev->append_pos_mutex); | ||
| dev->append_pos[dev->position.partition] = dev->position.block; | ||
| ltfs_mutex_unlock(&dev->append_pos_mutex); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why to check the position again just after we already checked the position basically one line above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The position check of above lines is basically reading the position in ltfs cache, the position read by the "tape_update_position" is the real position drive, that is why we are comparing those two positions in the next lines.