Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
tgt.1295
tgt-git-update
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File tgt-git-update of Package tgt.1295
diff --git a/doc/README.rbd b/doc/README.rbd index 274cc4d..18aeceb 100644 --- a/doc/README.rbd +++ b/doc/README.rbd @@ -43,7 +43,13 @@ something like "tgt" so that the name of the ceph client is for the tgt client compared to others, and sets the default log path, etc. See the Ceph documentation regarding client names. -To specify both options, separate them with ';', and since you are, +cluster=<cluster name> + +This sets the Ceph cluster name, if you have multiple clusters or +if your cluster name is anything other than "ceph". +This is in turn used by librados to find the conf file and key files. + +To specify multiple options, separate them with ';', and since you are, make sure to quote the option string to protect the semicolon from the shell: diff --git a/usr/bs_rbd.c b/usr/bs_rbd.c index 3ea9d36..3a052ed 100644 --- a/usr/bs_rbd.c +++ b/usr/bs_rbd.c @@ -480,6 +480,9 @@ static char *slurp_to_semi(char **p) strncpy(ret, *p, len); ret[len] = '\0'; *p = end; + /* Jump past the semicolon, if we stopped at one */ + if (**p == ';') + *p = end + 1; return ret; } @@ -514,17 +517,21 @@ static tgtadm_err bs_rbd_init(struct scsi_lu *lu, char *bsopts) struct active_rbd *rbd = RBDP(lu); char *confname = NULL; char *clientid = NULL; + char *clustername = NULL; + char clientid_full[128]; char *ignore = NULL; dprintf("bs_rbd_init bsopts: \"%s\"\n", bsopts); - // look for conf= or id= + // look for conf= or id= or cluster= while (bsopts && strlen(bsopts)) { if (is_opt("conf", bsopts)) confname = slurp_value(&bsopts); else if (is_opt("id", bsopts)) clientid = slurp_value(&bsopts); + else if (is_opt("cluster", bsopts)) + clustername = slurp_value(&bsopts); else { ignore = slurp_to_semi(&bsopts); eprintf("bs_rbd: ignoring unknown option \"%s\"\n", @@ -538,10 +545,27 @@ static tgtadm_err bs_rbd_init(struct scsi_lu *lu, char *bsopts) eprintf("bs_rbd_init: clientid %s\n", clientid); if (confname) eprintf("bs_rbd_init: confname %s\n", confname); + if (clustername) + eprintf("bs_rbd_init: clustername %s\n", clustername); eprintf("bs_rbd_init bsopts=%s\n", bsopts); - /* clientid may be set by -i/--id */ - rados_ret = rados_create(&rbd->cluster, clientid); + /* + * clientid may be set by -i/--id. If clustername is set, then + * we use rados_create2, else rados_create + */ + if (clustername) { + /* rados_create2 wants the full client name */ + if (clientid) + snprintf(clientid_full, sizeof clientid_full, + "client.%s", clientid); + else /* if not specified, default to client.admin */ + snprintf(clientid_full, sizeof clientid_full, + "client.admin"); + rados_ret = rados_create2(&rbd->cluster, clustername, + clientid_full, 0); + } else { + rados_ret = rados_create(&rbd->cluster, clientid); + } if (rados_ret < 0) { eprintf("bs_rbd_init: rados_create: %d\n", rados_ret); return ret; diff --git a/usr/iscsi/conn.c b/usr/iscsi/conn.c index bb18ac0..4cef6fd 100644 --- a/usr/iscsi/conn.c +++ b/usr/iscsi/conn.c @@ -100,13 +100,13 @@ void conn_close(struct iscsi_connection *conn) eprintf("failed to close a connection, %p %u %s\n", conn, conn->refcount, strerror(errno)); else - eprintf("connection closed, %p %u\n", conn, conn->refcount); + dprintf("connection closed, %p %u\n", conn, conn->refcount); /* may not have been in FFP yet */ if (!conn->session) goto done; - eprintf("session %p %d\n", conn->session, conn->session->refcount); + dprintf("session %p %d\n", conn->session, conn->session->refcount); /* * We just closed the ep so we are not going to send/recv anything. diff --git a/usr/iscsi/iser_text.c b/usr/iscsi/iser_text.c index 08cdfe5..16520cb 100644 --- a/usr/iscsi/iser_text.c +++ b/usr/iscsi/iser_text.c @@ -832,6 +832,7 @@ static void iser_text_scan(struct iscsi_connection *iscsi_conn, struct sockaddr_storage ss; socklen_t slen, blen; char *p, buf[NI_MAXHOST + 128]; + int port; if (value[0] == 0) continue; @@ -857,7 +858,14 @@ static void iser_text_scan(struct iscsi_connection *iscsi_conn, if (ss.ss_family == AF_INET6) *p++ = ']'; - sprintf(p, ":%d,1", ISCSI_LISTEN_PORT); + if (ss.ss_family == AF_INET6) + port = ntohs(((struct sockaddr_in6 *) + &ss)->sin6_port); + else + port = ntohs(((struct sockaddr_in *) + &ss)->sin_port); + + sprintf(p, ":%d,1", port); iser_target_list_build(iscsi_conn, tx_pdu, buf, strcmp(value, "All") ? value : NULL); } else diff --git a/usr/iscsi/session.c b/usr/iscsi/session.c index 98c0949..22638e7 100644 --- a/usr/iscsi/session.c +++ b/usr/iscsi/session.c @@ -106,8 +106,7 @@ int session_create(struct iscsi_connection *conn) session->info = zalloc(1024); if (!session->info) { free(session->initiator); - if (session->initiator_alias) - free(session->initiator_alias); + free(session->initiator_alias); free(session); return -ENOMEM; } @@ -124,6 +123,7 @@ int session_create(struct iscsi_connection *conn) err = it_nexus_create(target->tid, tsih, 0, session->info); if (err) { free(session->initiator); + free(session->initiator_alias); free(session->info); free(session); return err; @@ -174,6 +174,7 @@ static void session_destroy(struct iscsi_session *session) list_del(&session->hlist); free(session->initiator); + free(session->initiator_alias); free(session->info); free(session); } diff --git a/usr/scsi.c b/usr/scsi.c index d7c0095..4eccf13 100644 --- a/usr/scsi.c +++ b/usr/scsi.c @@ -59,164 +59,184 @@ int get_scsi_cdb_size(struct scsi_cmd *cmd) const unsigned char *get_scsi_cdb_usage_data(unsigned char op, unsigned char sa) { static const unsigned char usage[16]; + unsigned char *buf = NULL; - static const unsigned char allow_medium_removal[] = { + static unsigned char allow_medium_removal[] = { 0xff, 0x00, 0x00, 0x00, 0x03, 0x07}; - static const unsigned char send_diagnostics[] = { + static unsigned char send_diagnostics[] = { 0xff, 0xff, 0x00, 0xff, 0xff, 0x07}; - static const unsigned char start_stop[] = { + static unsigned char start_stop[] = { 0xff, 0x01, 0x00, 0x0f, 0xf7, 0x07}; - static const unsigned char mode_sense[] = { + static unsigned char mode_sense[] = { 0xff, 0x08, 0xff, 0xff, 0xff, 0x07}; - static const unsigned char mode_select[] = { + static unsigned char mode_select[] = { 0xff, 0x11, 0x00, 0x00, 0xff, 0x07}; - static const unsigned char reserve_release[] = { + static unsigned char reserve_release[] = { 0xff, 0x00, 0x00, 0x00, 0x00, 0x07}; - static const unsigned char inquiry[] = { + static unsigned char inquiry[] = { 0xff, 0x01, 0xff, 0xff, 0xff, 0x07}; - static const unsigned char read_write_6[] = { + static unsigned char read_write_6[] = { 0xff, 0x1f, 0xff, 0xff, 0xff, 0x07}; - static const unsigned char format_unit[] = { + static unsigned char format_unit[] = { 0xff, 0xff, 0x00, 0x00, 0x00, 0x07}; - static const unsigned char request_sense[] = { + static unsigned char request_sense[] = { 0xff, 0x01, 0x00, 0x00, 0xff, 0x07}; - static const unsigned char test_unit_ready[] = { + static unsigned char test_unit_ready[] = { 0xff, 0x00, 0x00, 0x00, 0x00, 0x07}; - - static const unsigned char persistent_reserve_in[] = { + static unsigned char persistent_reserve_in[] = { 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07}; - static const unsigned char persistent_reserve_out[] = { + static unsigned char persistent_reserve_out[] = { 0xff, 0x1f, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07}; - static const unsigned char mode_sense_10[] = { + static unsigned char mode_sense_10[] = { 0xff, 0x18, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07}; - static const unsigned char mode_select_10[] = { + static unsigned char mode_select_10[] = { 0xff, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07}; - static const unsigned char unmap[] = { + static unsigned char unmap[] = { 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07}; - static const unsigned char write_same_10[] = { + static unsigned char write_same_10[] = { 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x07}; - static const unsigned char pre_fetch_10[] = { + static unsigned char pre_fetch_10[] = { 0xff, 0x02, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x07}; - static const unsigned char synchronize_cache_10[] = { + static unsigned char synchronize_cache_10[] = { 0xff, 0x06, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x07}; - static const unsigned char verify_10[] = { + static unsigned char verify_10[] = { 0xff, 0xf2, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x07}; - static const unsigned char write_10[] = { + static unsigned char write_10[] = { 0xff, 0xfa, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x07}; - static const unsigned char read_10[] = { + static unsigned char read_10[] = { 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x07}; - static const unsigned char read_capacity[] = { + static unsigned char read_capacity[] = { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07}; - - static const unsigned char verify_12[] = { + static unsigned char verify_12[] = { 0xff, 0xf2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - static const unsigned char write_12[] = { + static unsigned char write_12[] = { 0xff, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - static const unsigned char read_12[] = { + static unsigned char read_12[] = { 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - static const unsigned char rep_sup_opcodes[] = { + static unsigned char rep_sup_opcodes[] = { 0xff, 0x1f, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - static const unsigned char report_luns[] = { + static unsigned char report_luns[] = { 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - - static const unsigned char get_lba_status[] = { + static unsigned char get_lba_status[] = { 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - static const unsigned char read_capacity_16[] = { + static unsigned char read_capacity_16[] = { 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - static const unsigned char write_same_16[] = { + static unsigned char write_same_16[] = { 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - static const unsigned char synchronize_cache_16[] = { + static unsigned char synchronize_cache_16[] = { 0xff, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - static const unsigned char pre_fetch_16[] = { + static unsigned char pre_fetch_16[] = { 0xff, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - static const unsigned char verify_16[] = { + static unsigned char verify_16[] = { 0xff, 0xf2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - static const unsigned char orwrite_16[] = { + static unsigned char orwrite_16[] = { 0xff, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; - static const unsigned char compare_and_write[] = { + static unsigned char compare_and_write[] = { 0xff, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x07}; - static const unsigned char read_16[] = { + static unsigned char read_16[] = { 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}; switch (op) { case TEST_UNIT_READY: - return test_unit_ready; + buf = test_unit_ready; + break; case REQUEST_SENSE: - return request_sense; + buf = request_sense; + break; case FORMAT_UNIT: - return format_unit; + buf = format_unit; + break; case READ_6: case WRITE_6: - return read_write_6; + buf = read_write_6; + break; case INQUIRY: - return inquiry; + buf = inquiry; + break; case MODE_SELECT: - return mode_select; + buf = mode_select; + break; case RELEASE: case RESERVE: - return reserve_release; + buf = reserve_release; + break; case MODE_SENSE: - return mode_sense; + buf = mode_sense; + break; case START_STOP: - return start_stop; + buf = start_stop; + break; case SEND_DIAGNOSTIC: - return send_diagnostics; + buf = send_diagnostics; + break; case ALLOW_MEDIUM_REMOVAL: - return allow_medium_removal; + buf = allow_medium_removal; + break; case READ_CAPACITY: - return read_capacity; + buf = read_capacity; + break; case READ_10: - return read_10; + buf = read_10; + break; case WRITE_10: - return write_10; + buf = write_10; + break; case WRITE_VERIFY: case VERIFY_10: - return verify_10; + buf = verify_10; + break; case PRE_FETCH_10: - return pre_fetch_10; + buf = pre_fetch_10; + break; case SYNCHRONIZE_CACHE: - return synchronize_cache_10; + buf = synchronize_cache_10; + break; case WRITE_SAME: - return write_same_10; + buf = write_same_10; + break; case UNMAP: - return unmap; + buf = unmap; + break; case MODE_SELECT_10: - return mode_select_10; + buf = mode_select_10; + break; case MODE_SENSE_10: - return mode_sense_10; + buf = mode_sense_10; + break; case PERSISTENT_RESERVE_IN: switch (sa) { case PR_IN_READ_KEYS: case PR_IN_READ_RESERVATION: case PR_IN_REPORT_CAPABILITIES: case PR_IN_READ_FULL_STATUS: - return persistent_reserve_in; + buf = persistent_reserve_in; + break; } break; case PERSISTENT_RESERVE_OUT: @@ -229,49 +249,70 @@ const unsigned char *get_scsi_cdb_usage_data(unsigned char op, unsigned char sa) case PR_OUT_PREEMPT_AND_ABORT: case PR_OUT_REGISTER_AND_IGNORE_EXISTING_KEY: case PR_OUT_REGISTER_AND_MOVE: - return persistent_reserve_out; + buf = persistent_reserve_out; + break; } break; case READ_16: - return read_16; + buf = read_16; + break; case COMPARE_AND_WRITE: - return compare_and_write; + buf = compare_and_write; + break; case WRITE_16: case ORWRITE_16: - return orwrite_16; + buf = orwrite_16; + break; case WRITE_VERIFY_16: case VERIFY_16: - return verify_16; + buf = verify_16; + break; case PRE_FETCH_16: - return pre_fetch_16; + buf = pre_fetch_16; + break; case SYNCHRONIZE_CACHE_16: - return synchronize_cache_16; + buf = synchronize_cache_16; + break; case WRITE_SAME_16: - return write_same_16; + buf = write_same_16; + break; case SERVICE_ACTION_IN: switch (sa) { case SAI_READ_CAPACITY_16: - return read_capacity_16; + buf = read_capacity_16; + break; case SAI_GET_LBA_STATUS: - return get_lba_status; + buf = get_lba_status; + break; } break; case REPORT_LUNS: - return report_luns; + buf = report_luns; + break; case MAINT_PROTOCOL_IN: switch (sa) { case MPI_REPORT_SUPPORTED_OPCODES: - return rep_sup_opcodes; + buf = rep_sup_opcodes; + break; } break; case READ_12: - return read_12; + buf = read_12; + break; case VERIFY_12: case WRITE_VERIFY_12: - return verify_12; + buf = verify_12; + break; case WRITE_12: - return write_12; + buf = write_12; + break; } + + if (buf) { + buf[0] = op; + return buf; + } + return usage; } diff --git a/usr/target.c b/usr/target.c index f4c5b4e..b6f324c 100644 --- a/usr/target.c +++ b/usr/target.c @@ -1581,7 +1581,6 @@ static tgtadm_err __inaccount_bind(struct target *target, int aid) } target->account.in_aids[i] = aid; - target->account.nr_inaccount++; } else { int new_max = target->account.max_inaccount << 1; int *buf; @@ -1597,6 +1596,7 @@ static tgtadm_err __inaccount_bind(struct target *target, int aid) target->account.in_aids[target->account.max_inaccount] = aid; target->account.max_inaccount = new_max; } + target->account.nr_inaccount++; return TGTADM_SUCCESS; } diff --git a/usr/tgtd.c b/usr/tgtd.c index 50e1c83..9975e03 100644 --- a/usr/tgtd.c +++ b/usr/tgtd.c @@ -212,6 +212,8 @@ static struct event_data *tgt_event_lookup(int fd) return NULL; } +static int event_need_refresh; + void tgt_event_del(int fd) { struct event_data *tev; @@ -229,6 +231,8 @@ void tgt_event_del(int fd) list_del(&tev->e_list); free(tev); + + event_need_refresh = 1; } int tgt_event_modify(int fd, int events) @@ -426,6 +430,11 @@ retry: for (i = 0; i < nevent; i++) { tev = (struct event_data *) events[i].data.ptr; tev->handler(tev->fd, events[i].events, tev->data); + + if (event_need_refresh) { + event_need_refresh = 0; + goto retry; + } } }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor