diff options
author | Sage Weil <sage@inktank.com> | 2013-08-22 17:23:09 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-22 17:23:09 -0700 |
commit | 27b0411908c2d1c7397982649bd82de5c90f9ba8 (patch) | |
tree | d8cd57b1c67f4648335cdc49ff93e7c6b1297f21 | |
parent | 98583b59aaae509411dc66e7190bf14fd28082a1 (diff) | |
parent | 3d55534268de7124d29bd365ea65da8d2f63e501 (diff) | |
download | ceph-27b0411908c2d1c7397982649bd82de5c90f9ba8.tar.gz |
Merge remote-tracking branch 'gh/next'
-rw-r--r-- | src/mds/MDCache.cc | 2 | ||||
-rw-r--r-- | src/os/BtrfsFileStoreBackend.cc | 29 | ||||
-rw-r--r-- | src/rgw/rgw_rados.cc | 16 | ||||
-rw-r--r-- | src/tools/ceph-monstore-tool.cc | 3 |
4 files changed, 29 insertions, 21 deletions
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 898dcd39f48..86b380f2827 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -7935,7 +7935,7 @@ void MDCache::_open_ino_backtrace_fetched(inodeno_t ino, bufferlist& bl, int err inode_backtrace_t backtrace; if (err == 0) { ::decode(backtrace, bl); - if (backtrace.pool != info.pool) { + if (backtrace.pool != info.pool && backtrace.pool != -1) { dout(10) << " old object in pool " << info.pool << ", retrying pool " << backtrace.pool << dendl; info.pool = backtrace.pool; diff --git a/src/os/BtrfsFileStoreBackend.cc b/src/os/BtrfsFileStoreBackend.cc index 580a4b5bebf..9fa96babab7 100644 --- a/src/os/BtrfsFileStoreBackend.cc +++ b/src/os/BtrfsFileStoreBackend.cc @@ -51,7 +51,8 @@ #define ALIGN_UP(x, by) (ALIGNED((x), (by)) ? (x) : (ALIGN_DOWN((x), (by)) + (by))) BtrfsFileStoreBackend::BtrfsFileStoreBackend(FileStore *fs): - GenericFileStoreBackend(fs), has_clone_range(false), has_snap_create(false), + GenericFileStoreBackend(fs), has_clone_range(false), + has_snap_create(false), has_snap_destroy(false), has_snap_create_v2(false), has_wait_sync(false), stable_commits(false), m_filestore_btrfs_clone_range(g_conf->filestore_btrfs_clone_range), m_filestore_btrfs_snap (g_conf->filestore_btrfs_snap) { } @@ -298,8 +299,10 @@ int BtrfsFileStoreBackend::create_current() int BtrfsFileStoreBackend::list_checkpoints(list<string>& ls) { + int ret, err = 0; + struct stat basest; - int ret = ::fstat(get_basedir_fd(), &basest); + ret = ::fstat(get_basedir_fd(), &basest); if (ret < 0) { ret = -errno; dout(0) << "list_checkpoints: cannot fstat basedir " << cpp_strerror(ret) << dendl; @@ -327,10 +330,10 @@ int BtrfsFileStoreBackend::list_checkpoints(list<string>& ls) struct stat st; ret = ::stat(path, &st); if (ret < 0) { - ret = -errno; + err = -errno; dout(0) << "list_checkpoints: stat '" << path << "' failed: " - << cpp_strerror(ret) << dendl; - return ret; + << cpp_strerror(err) << dendl; + break; } if (!S_ISDIR(st.st_mode)) @@ -339,10 +342,10 @@ int BtrfsFileStoreBackend::list_checkpoints(list<string>& ls) struct statfs fs; ret = ::statfs(path, &fs); if (ret < 0) { - ret = -errno; + err = -errno; dout(0) << "list_checkpoints: statfs '" << path << "' failed: " - << cpp_strerror(ret) << dendl; - return ret; + << cpp_strerror(err) << dendl; + break; } if (fs.f_type == BTRFS_SUPER_MAGIC && basest.st_dev != st.st_dev) @@ -352,9 +355,13 @@ int BtrfsFileStoreBackend::list_checkpoints(list<string>& ls) if (::closedir(dir) < 0) { ret = -errno; dout(0) << "list_checkpoints: closedir failed: " << cpp_strerror(ret) << dendl; - return ret; + if (!err) + err = ret; } + if (err) + return err; + ls.swap(snaps); return 0; } @@ -367,7 +374,7 @@ int BtrfsFileStoreBackend::create_checkpoint(const string& name, uint64_t *trans memset(&async_args, 0, sizeof(async_args)); async_args.fd = get_current_fd(); async_args.flags = BTRFS_SUBVOL_CREATE_ASYNC; - strcpy(async_args.name, name.c_str()); + strncpy(async_args.name, name.c_str(), sizeof(async_args.name)); int r = ::ioctl(get_basedir_fd(), BTRFS_IOC_SNAP_CREATE_V2, &async_args); if (r < 0) { @@ -455,7 +462,7 @@ int BtrfsFileStoreBackend::destroy_checkpoint(const string& name) btrfs_ioctl_vol_args vol_args; memset(&vol_args, 0, sizeof(vol_args)); vol_args.fd = 0; - strcpy(vol_args.name, name.c_str()); + strncpy(vol_args.name, name.c_str(), sizeof(vol_args.name)); int ret = ::ioctl(get_basedir_fd(), BTRFS_IOC_SNAP_DESTROY, &vol_args); if (ret) { diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 0bbbf177b7a..03cc1ebfdb3 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -875,6 +875,14 @@ int RGWRados::init_complete() { int ret; + if (need_watch_notify()) { + ret = init_watch(); + if (ret < 0) { + lderr(cct) << "ERROR: failed to initialize watch" << dendl; + return ret; + } + } + ret = region.init(cct, this); if (ret < 0) return ret; @@ -912,14 +920,6 @@ int RGWRados::init_complete() } } - if (need_watch_notify()) { - ret = init_watch(); - if (ret < 0) { - lderr(cct) << "ERROR: failed to initialize watch" << dendl; - return ret; - } - } - map<string, RGWZone>::iterator ziter; for (ziter = region.zones.begin(); ziter != region.zones.end(); ++ziter) { const string& name = ziter->first; diff --git a/src/tools/ceph-monstore-tool.cc b/src/tools/ceph-monstore-tool.cc index 4ab8fa86465..8f294c4a4e3 100644 --- a/src/tools/ceph-monstore-tool.cc +++ b/src/tools/ceph-monstore-tool.cc @@ -179,7 +179,7 @@ int main(int argc, char **argv) { int fd; if (vm.count("out")) { - if ((fd = open(out_path.c_str(), O_WRONLY|O_CREAT|O_TRUNC, 0666)) == -1) { + if ((fd = open(out_path.c_str(), O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { int _err = errno; if (_err != EISDIR) { std::cerr << "Couldn't open " << out_path << ": " << cpp_strerror(_err) << std::endl; @@ -214,6 +214,7 @@ int main(int argc, char **argv) { } else if (cmd == "compact") { st.compact(); } else if (cmd == "getmonmap") { + assert(fd >= 0); if (!store_path.size()) { std::cerr << "need mon store path" << std::endl; std::cerr << desc << std::endl; |