Skip to content

Commit

Permalink
Merge pull request #9838 from xiexingguo/xxg-wip-fix-synthetic-client
Browse files Browse the repository at this point in the history
client: misc fixes

Reviewed-by: John Spray <john.spray@redhat.com>
  • Loading branch information
John Spray committed Jul 1, 2016
2 parents 6655f54 + 2d52677 commit f76f5a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/client/Client.cc
Expand Up @@ -8796,7 +8796,7 @@ int Client::_fsync(Fh *f, bool syncdataonly)
int Client::fstat(int fd, struct stat *stbuf, int mask)
{
Mutex::Locker lock(client_lock);
tout(cct) << "fstat mask " << hex << mask << std::endl;
tout(cct) << "fstat mask " << hex << mask << dec << std::endl;
tout(cct) << fd << std::endl;

Fh *f = get_filehandle(fd);
Expand Down
13 changes: 9 additions & 4 deletions src/client/SyntheticClient.cc
Expand Up @@ -1702,6 +1702,7 @@ int SyntheticClient::dump_placement(string& fn) {
int lstat_result = client->lstat(fn.c_str(), &stbuf);
if (lstat_result < 0) {
dout(0) << "lstat error for file " << fn << dendl;
client->close(fd);
return lstat_result;
}

Expand Down Expand Up @@ -3324,10 +3325,15 @@ int SyntheticClient::lookup_ino(inodeno_t ino)
int SyntheticClient::chunk_file(string &filename)
{
int fd = client->open(filename.c_str(), O_RDONLY);
int ret;
if (fd < 0)
return fd;

struct stat st;
client->fstat(fd, &st);
int ret = client->fstat(fd, &st);
if (ret < 0) {
client->close(fd);
return ret;
}
uint64_t size = st.st_size;
dout(0) << "file " << filename << " size is " << size << dendl;

Expand All @@ -3337,8 +3343,7 @@ int SyntheticClient::chunk_file(string &filename)
memset(&inode, 0, sizeof(inode));
inode.ino = st.st_ino;
ret = client->fdescribe_layout(fd, &inode.layout);
if (ret < 0)
return ret;
assert(ret == 0); // otherwise fstat did a bad thing

uint64_t pos = 0;
bufferlist from_before;
Expand Down

0 comments on commit f76f5a9

Please sign in to comment.