diff --git a/src/client/Client.cc b/src/client/Client.cc index 426abac9cfe..1f09e363db6 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -9392,6 +9392,8 @@ int Client::_preadv_pwritev(int fd, const struct iovec *iov, unsigned iovcnt, in int64_t Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf, const struct iovec *iov, int iovcnt) { + uint64_t fpos = 0; + if ((uint64_t)(offset+size) > mdsmap->get_max_filesize()) //too large! return -EFBIG; @@ -9430,7 +9432,7 @@ int64_t Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf, } } offset = f->pos; - f->pos = offset+size; + fpos = offset+size; unlock_fh_pos(f); } @@ -9569,6 +9571,11 @@ success: lat -= start; logger->tinc(l_c_wrlat, lat); + if (fpos) { + lock_fh_pos(f); + f->pos = fpos; + unlock_fh_pos(f); + } totalwritten = size; r = (int64_t)totalwritten;