Verified Commit a644e99c authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

bugfix: writev handles 0 sized writes

writev could reveive no-ops blocks characterized by a zero size length.
We simply need to skip them.
parent b0ddc0f4
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -797,8 +797,11 @@ ssize_t writev(int fd, const struct iovec *iov, int iovcnt) {
            ssize_t written = 0;
            ssize_t ret;
            for (int i = 0; i < iovcnt; ++i){
                auto buf = (iov+i)->iov_base;
                auto count = (iov+i)->iov_len;
                if(count == 0) {
                    continue;
                }
                auto buf = (iov+i)->iov_base;
                ret = adafs_pwrite_ws(fd, buf, count, pos);
                if(ret == -1) {
                    break;
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ using namespace std;
 */
ssize_t rpc_send_write(const string& path, const void* buf, const bool append_flag, const off64_t in_offset,
                       const size_t write_size, const int64_t updated_metadentry_size) {
    assert(write_size > 0);
    // Calculate chunkid boundaries and numbers so that daemons know in which interval to look for chunks
    off64_t offset = in_offset;
    if (append_flag)