unsigned char outbuf[max_out + OUT_BUF_EXTRA];
if (secret.length() < AES_KEY_LEN) {
- derr(0) << "key is too short" << dendl;
+ dout(0) << "key is too short" << dendl;
return false;
}
} else if (strcmp(op, "ro") == 0) {
set_readonly(true);
} else {
- derr(0) << "Error: unknown option '" << op << "'" << dendl;
+ dout(0) << "Error: unknown option '" << op << "'" << dendl;
}
op = strsep(&tmp, ", ");
}
if (decode_decrypt(secrets, secret_key, indata) == 0) {
rotating_secrets->set_secrets(secrets);
} else {
- derr(0) << "could not set rotating key: decode_decrypt failed" << dendl;
+ dout(0) << "could not set rotating key: decode_decrypt failed" << dendl;
}
}
}
struct stat stbuf;
int lstat_result = client->lstat(fn.c_str(), &stbuf);
if (lstat_result < 0) {
- derr(0) << "lstat error for file " << fn << dendl;
+ dout(0) << "lstat error for file " << fn << dendl;
return lstat_result;
}
lock.Unlock();
dout(5) << "create_objects done" << dendl;
- derr(0) << "create_objects done" << dendl;
return 0;
}
if (r) {
char buf[80];
- generic_derr(0) << "pthread_create failed with message: " << strerror_r(r, buf, sizeof(buf)) << dendl;
+ generic_dout(0) << "pthread_create failed with message: " << strerror_r(r, buf, sizeof(buf)) << dendl;
} else {
_num_threads.inc();
generic_dout(10) << "thread " << thread_id << " start" << dendl;
}
int join(void **prval = 0) {
if (thread_id == 0) {
- generic_derr(0) << "WARNING: join on thread that was never started" << dendl;
+ generic_dout(0) << "WARNING: join on thread that was never started" << dendl;
assert(0);
return -EINVAL; // never started.
}
if (status != 0) {
switch (status) {
case -EINVAL:
- generic_derr(0) << "thread " << thread_id << " join status = EINVAL" << dendl;
+ generic_dout(0) << "thread " << thread_id << " join status = EINVAL" << dendl;
break;
case -ESRCH:
- generic_derr(0) << "thread " << thread_id << " join status = ESRCH" << dendl;
+ generic_dout(0) << "thread " << thread_id << " join status = ESRCH" << dendl;
assert(0);
break;
case -EDEADLK:
- generic_derr(0) << "thread " << thread_id << " join status = EDEADLK" << dendl;
+ generic_dout(0) << "thread " << thread_id << " join status = EDEADLK" << dendl;
break;
default:
- generic_derr(0) << "thread " << thread_id << " join status = " << status << dendl;
+ generic_dout(0) << "thread " << thread_id << " join status = " << status << dendl;
}
assert(0); // none of these should happen.
}
// debug output
Mutex _dout_lock("_dout_lock", false, false /* no lockdep */);
ostream *_dout = &std::cout;
-ostream *_derr = &std::cerr;
char _dout_dir[PATH_MAX] = {0};
char _dout_symlink_dir[PATH_MAX] = {0};
char _dout_file[PATH_MAX] = {0};
// the streams
extern ostream *_dout;
-extern ostream *_derr;
extern Mutex _dout_lock;
extern void _dout_open_log();
-static inline void dout_open_log() {
- _dout_lock.Lock();
- _dout_open_log();
- _dout_lock.Unlock();
-}
extern int dout_rename_output_file(); // after calling daemon()
extern int dout_create_rank_symlink(int64_t n);
// generic macros
#define generic_dout(x) do { if ((x) <= g_conf.debug) { *_dout << dbeginl
-#define generic_derr(x) do { if ((x) <= g_conf.debug) { *_derr << dbeginl
#define pdout(x,p) do { if ((x) <= (p)) { *_dout << dbeginl
#define DOUT_COND(l) l <= XDOUT_CONDVAR(DOUT_SUBSYS)
#define dout(l) do { if (DOUT_COND(l)) { dout_prefix
-#define derr(l) do { if (DOUT_COND(l)) { dout_prefix
#define dendl std::endl; _dout_end_line(); } } while (0)
cerr << TEXT_RED << " ** ERROR: unable to open OSD superblock on " << g_conf.osd_data << ": " << strerror_r(-r, buf, sizeof(buf)) << TEXT_NORMAL << std::endl;
if (r == -ENOTSUP)
cerr << TEXT_RED << " ** please verify that underlying storage supports xattrs" << TEXT_NORMAL << std::endl;
- derr(0) << "unable to open OSD superblock on " << g_conf.osd_data << ": " << strerror_r(-r, buf, sizeof(buf)) << dendl;
+ dout(0) << "unable to open OSD superblock on " << g_conf.osd_data << ": " << strerror_r(-r, buf, sizeof(buf)) << dendl;
exit(1);
}
if (w != whoami) {
// verify dir exists
DIR *d = ::opendir(dir.c_str());
if (!d) {
- derr(1) << "basedir " << dir << " dne" << dendl;
+ dout(1) << "basedir " << dir << " dne" << dendl;
return -ENOENT;
}
::closedir(d);
l.l_len = 0;
int r = ::fcntl(lock_fd, F_SETLK, &l);
if (r < 0) {
- derr(0) << "failed to lock " << t << ", is another cmon still running?" << dendl;
+ dout(0) << "failed to lock " << t << ", is another cmon still running?" << dendl;
return -errno;
}
int r = ::read(fd, bp.c_str()+off, len-off);
if (r < 0) {
char buf[80];
- derr(0) << "errno on read " << strerror_r(errno, buf, sizeof(buf)) << dendl;
+ dout(0) << "errno on read " << strerror_r(errno, buf, sizeof(buf)) << dendl;
}
assert(r>0);
off += r;
listen_sd = ::socket(family, SOCK_STREAM, 0);
if (listen_sd < 0) {
char buf[80];
- derr(0) << "accepter.bind unable to create socket: "
+ dout(0) << "accepter.bind unable to create socket: "
<< strerror_r(errno, buf, sizeof(buf)) << dendl;
cerr << "accepter.bind unable to create socket: "
<< strerror_r(errno, buf, sizeof(buf)) << std::endl;
rc = ::bind(listen_sd, (struct sockaddr *) &listen_addr.ss_addr(), sizeof(listen_addr.ss_addr()));
if (rc < 0) {
char buf[80];
- derr(0) << "accepter.bind unable to bind to " << bind_addr.ss_addr()
+ dout(0) << "accepter.bind unable to bind to " << bind_addr.ss_addr()
<< ": " << strerror_r(errno, buf, sizeof(buf)) << dendl;
cerr << "accepter.bind unable to bind to " << bind_addr.ss_addr()
<< ": " << strerror_r(errno, buf, sizeof(buf)) << std::endl;
}
if (rc < 0) {
char buf[80];
- derr(0) << "accepter.bind unable to bind to " << bind_addr.ss_addr()
+ dout(0) << "accepter.bind unable to bind to " << bind_addr.ss_addr()
<< " on any port in range " << CEPH_PORT_START << "-" << CEPH_PORT_LAST
<< ": " << strerror_r(errno, buf, sizeof(buf)) << dendl;
cerr << "accepter.bind unable to bind to " << bind_addr.ss_addr()
rc = ::listen(listen_sd, 128);
if (rc < 0) {
char buf[80];
- derr(0) << "accepter.bind unable to listen on " << bind_addr.ss_addr()
+ dout(0) << "accepter.bind unable to listen on " << bind_addr.ss_addr()
<< ": " << strerror_r(errno, buf, sizeof(buf)) << dendl;
cerr << "accepter.bind unable to listen on " << bind_addr.ss_addr()
<< ": " << strerror_r(errno, buf, sizeof(buf)) << std::endl;
void SimpleMessenger::Pipe::fail()
{
- derr(10) << "fail" << dendl;
+ dout(10) << "fail" << dendl;
assert(pipe_lock.is_locked());
stop();
pipe_lock.Lock();
if (rc < 0) {
- derr(1) << "writer error sending " << m << ", "
+ dout(1) << "writer error sending " << m << ", "
<< errno << ": " << strerror_r(errno, buf, sizeof(buf)) << dendl;
fault();
}
// daemonize?
if (g_conf.daemonize && !nodaemon) {
if (Thread::get_num_threads() > 0) {
- derr(0) << "messenger.start BUG: there are " << Thread::get_num_threads()
+ dout(0) << "messenger.start BUG: there are " << Thread::get_num_threads()
<< " already started that will now die! call messenger.start() sooner."
<< dendl;
}
dout(20) << "submit_message " << *m << " local" << dendl;
dispatch_queue.local_delivery(m, m->get_priority());
} else {
- derr(0) << "submit_message " << *m << " " << dest_addr << " local but no local endpoint, dropping." << dendl;
+ dout(0) << "submit_message " << *m << " " << dest_addr << " local but no local endpoint, dropping." << dendl;
assert(0); // hmpf, this is probably mds->mon beacon from newsyn.
m->put();
}
err = -EINVAL;
}
if (header.alignment != block_size && directio) {
- derr(0) << "open journal alignment " << header.alignment << " does not match block size "
+ dout(0) << "open journal alignment " << header.alignment << " does not match block size "
<< block_size << " (required for direct_io journal mode)" << dendl;
err = -EINVAL;
}
if ((header.alignment % PAGE_SIZE) && directio) {
- derr(0) << "open journal alignment " << header.alignment << " is not multiple of page size " << PAGE_SIZE
+ dout(0) << "open journal alignment " << header.alignment << " is not multiple of page size " << PAGE_SIZE
<< " (required for direct_io journal mode)" << dendl;
err = -EINVAL;
}
int err = bl.write_fd(fd);
if (err) {
char buf[80];
- derr(0) << "write_bl failed with " << err << " " << strerror_r(-err, buf, sizeof(buf))
+ dout(0) << "write_bl failed with " << err << " " << strerror_r(-err, buf, sizeof(buf))
<< dendl;
}
pos += bl.length();
int r = ::fcntl(fsid_fd, F_SETLK, &l);
if (r < 0) {
char buf[80];
- derr(0) << "lock_fsid failed to lock " << basedir << "/fsid, is another cosd still running? " << strerror_r(errno, buf, sizeof(buf)) << dendl;
+ dout(0) << "lock_fsid failed to lock " << basedir << "/fsid, is another cosd still running? " << strerror_r(errno, buf, sizeof(buf)) << dendl;
return -errno;
}
return 0;
<< " " << strerror(errno)
<< dendl;*/
if (x != y) {
- derr(0) << "xattrs don't appear to work (" << strerror_r(errno, buf, sizeof(buf))
+ dout(0) << "xattrs don't appear to work (" << strerror_r(errno, buf, sizeof(buf))
<< ") on " << fn << ", be sure to mount underlying file system with 'user_xattr' option" << dendl;
return -errno;
}
struct stat st;
int r = ::stat(basedir.c_str(), &st);
if (r != 0) {
- derr(0) << "unable to stat basedir " << basedir << ", " << strerror_r(errno, buf, sizeof(buf)) << dendl;
+ dout(0) << "unable to stat basedir " << basedir << ", " << strerror_r(errno, buf, sizeof(buf)) << dendl;
return -errno;
}
char buf[80];
int fd = ::open(basedir.c_str(), O_RDONLY);
if (fd < 0) {
- derr(0) << "transaction_start got " << strerror_r(errno, buf, sizeof(buf))
+ dout(0) << "transaction_start got " << strerror_r(errno, buf, sizeof(buf))
<< " from btrfs open" << dendl;
assert(0);
}
int r = ::ioctl(fd, BTRFS_IOC_TRANS_START);
if (r < 0) {
- derr(0) << "transaction_start got " << strerror_r(errno, buf, sizeof(buf))
+ dout(0) << "transaction_start got " << strerror_r(errno, buf, sizeof(buf))
<< " from btrfs ioctl" << dendl;
::close(fd);
return -errno;
int flags = O_WRONLY|O_CREAT;
int fd = ::open(fn, flags, 0644);
if (fd < 0) {
- derr(0) << "write couldn't open " << fn << " flags " << flags << " errno " << errno << " " << strerror_r(errno, buf, sizeof(buf)) << dendl;
+ dout(0) << "write couldn't open " << fn << " flags " << flags << " errno " << errno << " " << strerror_r(errno, buf, sizeof(buf)) << dendl;
r = -errno;
goto out;
}
}
if (whoami != superblock.whoami) {
- derr(0) << "read_superblock superblock says osd" << superblock.whoami
+ dout(0) << "read_superblock superblock says osd" << superblock.whoami
<< ", but i (think i) am osd" << whoami << dendl;
return -1;
}
if (!op->may_write()) {
stat_rd_ops++;
if (op->get_source().is_osd()) {
- //derr(-10) << "shed in " << stat_rd_ops_shed_in << " / " << stat_rd_ops << dendl;
+ //dout(-10) << "shed in " << stat_rd_ops_shed_in << " / " << stat_rd_ops << dendl;
stat_rd_ops_shed_in++;
}
}
int rweights[ndom];
int nper = ((num_osd - 1) / ndom) + 1;
- derr(0) << ndom << " failure domains, " << nper << " osds each" << dendl;
+ dout(0) << ndom << " failure domains, " << nper << " osds each" << dendl;
int o = 0;
for (int i=0; i<ndom; i++) {
Context *onapply = new C_OSD_RepModifyApply(rm);
int r = osd->store->queue_transactions(&osr, rm->tls, onapply, oncommit);
if (r) {
- derr(0) << "error applying transaction: r = " << r << dendl;
+ dout(0) << "error applying transaction: r = " << r << dendl;
assert(0);
}
// op is cleaned up by oncommit/onapply when both are executed
// did we finish the last oid?
if (head != sobject_t()) {
- derr(0) << " missing clone(s) for " << head << dendl;
+ dout(0) << " missing clone(s) for " << head << dendl;
assert(head == sobject_t()); // we had better be done
errors++;
}
<< read_pos << "~" << (sizeof(s)+s) << " (have " << read_buf.length() << ")" << dendl;
if (s == 0) {
- derr(0) << "try_read_entry got 0 len entry at offset " << read_pos << dendl;
+ dout(0) << "try_read_entry got 0 len entry at offset " << read_pos << dendl;
error = -EINVAL;
return false;
}
bufferlist enc_out;
if (key.encrypt(enc_in, enc_out) < 0) {
- derr(0) << "couldn't encode!" << dendl;
+ dout(0) << "couldn't encode!" << dendl;
exit(1);
}
dec_in = enc_out;
if (key.decrypt(dec_in, dec_out) < 0) {
- derr(0) << "couldn't decode!" << dendl;
+ dout(0) << "couldn't decode!" << dendl;
}
dout(0) << "decoded len: " << dec_out.length() << dendl;