Merge PR #17205 into master

* refs/remotes/upstream/pull/17205/head:
	client: fix locking in Client::getcwd

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2017-08-23 20:48:22 -07:00
commit 270f1edaae
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
2 changed files with 9 additions and 2 deletions

View File

@ -9380,11 +9380,11 @@ int Client::chdir(const char *relpath, std::string &new_cwd,
cwd.swap(in);
ldout(cct, 3) << "chdir(" << relpath << ") cwd now " << cwd->ino << dendl;
getcwd(new_cwd, perms);
_getcwd(new_cwd, perms);
return 0;
}
void Client::getcwd(string& dir, const UserPerm& perms)
void Client::_getcwd(string& dir, const UserPerm& perms)
{
filepath path;
ldout(cct, 10) << "getcwd " << *cwd << dendl;
@ -9424,6 +9424,12 @@ void Client::getcwd(string& dir, const UserPerm& perms)
dir += path.get_path();
}
void Client::getcwd(string& dir, const UserPerm& perms)
{
Mutex::Locker l(client_lock);
_getcwd(dir, perms);
}
int Client::statfs(const char *path, struct statvfs *stbuf,
const UserPerm& perms)
{

View File

@ -956,6 +956,7 @@ public:
// crap
int chdir(const char *s, std::string &new_cwd, const UserPerm& perms);
void _getcwd(std::string& cwd, const UserPerm& perms);
void getcwd(std::string& cwd, const UserPerm& perms);
// namespace ops