class: make class tmp directory configurable, not /tmp

/tmp usually gets mounted with 'noexec', making it a poor choice.

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil 2010-07-07 15:04:33 -07:00
parent 2096d8d77e
commit cf38e86e81
5 changed files with 8 additions and 10 deletions

1
debian/ceph.dirs vendored
View File

@ -5,3 +5,4 @@ etc/ceph
usr/share/doc/ceph
var/log/ceph
var/log/ceph/stat
var/lib/ceph/tmp

View File

@ -19,7 +19,6 @@ set -e
case "$1" in
configure)
# ldconfig
;;
abort-upgrade|abort-remove|abort-deconfigure)

View File

@ -22,21 +22,19 @@ void ClassHandler::_load_class(ClassData &cls)
{
dout(10) << "load_class " << cls.name << dendl;
char *fname=strdup("/tmp/class-XXXXXX");
int fd = mkstemp(fname);
cls_deps_t *(*cls_deps)();
for (list<bufferptr>::const_iterator it = cls.impl.binary.buffers().begin();
it != cls.impl.binary.buffers().end(); it++)
write(fd, it->c_str(), it->length());
char fname[80];
snprintf(fname, sizeof(fname), "%s/class-XXXXXX", g_conf.osd_class_tmp);
int fd = mkstemp(fname);
cls.impl.binary.write_fd(fd);
close(fd);
cls.handle = dlopen(fname, RTLD_NOW);
if (!cls.handle) {
char buf[80];
dout(0) << "could not open class (dlopen failed) " << strerror_r(errno, buf, sizeof(buf)) << dendl;
dout(0) << "could not open class (dlopen failed): " << dlerror() << dendl;
goto done;
}
cls_deps = (cls_deps_t *(*)())dlsym(cls.handle, "class_deps");
@ -52,8 +50,6 @@ void ClassHandler::_load_class(ClassData &cls)
cls.load();
done:
unlink(fname);
free(fname);
return;
}

View File

@ -478,6 +478,7 @@ static struct config_option config_optionsp[] = {
OPTION(osd_recovery_max_active, 0, OPT_INT, 5),
OPTION(osd_auto_weight, 0, OPT_BOOL, false),
OPTION(osd_class_timeout, 0, OPT_FLOAT, 10.0),
OPTION(osd_class_tmp, 0, OPT_STR, "/var/lib/ceph/tmp"),
OPTION(osd_check_for_log_corruption, 0, OPT_BOOL, false),
OPTION(filestore, 0, OPT_BOOL, false),
OPTION(filestore_max_sync_interval, 0, OPT_DOUBLE, 5), // seconds

View File

@ -344,6 +344,7 @@ struct md_config_t {
bool osd_auto_weight;
bool osd_class_timeout;
const char *osd_class_tmp;
bool osd_check_for_log_corruption; // bleh