Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 86622
b: refs/heads/master
c: f843615
h: refs/heads/master
v: v3
  • Loading branch information
Stefan Richter committed Mar 2, 2008
1 parent 18c0963 commit 259ede8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8d07a67cface19ac07d7324f38bda7bbb06bbdb2
refs/heads/master: f8436158b1d76e6842856048f287799468b56eb2
46 changes: 27 additions & 19 deletions trunk/drivers/firewire/fw-sbp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ static const char sbp2_driver_name[] = "sbp2";
struct sbp2_logical_unit {
struct sbp2_target *tgt;
struct list_head link;
struct scsi_device *sdev;
struct fw_address_handler address_handler;
struct list_head orb_list;

Expand All @@ -139,6 +138,7 @@ struct sbp2_logical_unit {
int generation;
int retries;
struct delayed_work work;
bool has_sdev;
bool blocked;
};

Expand Down Expand Up @@ -751,20 +751,33 @@ static void sbp2_unblock(struct sbp2_target *tgt)
scsi_unblock_requests(shost);
}

static int sbp2_lun2int(u16 lun)
{
struct scsi_lun eight_bytes_lun;

memset(&eight_bytes_lun, 0, sizeof(eight_bytes_lun));
eight_bytes_lun.scsi_lun[0] = (lun >> 8) & 0xff;
eight_bytes_lun.scsi_lun[1] = lun & 0xff;

return scsilun_to_int(&eight_bytes_lun);
}

static void sbp2_release_target(struct kref *kref)
{
struct sbp2_target *tgt = container_of(kref, struct sbp2_target, kref);
struct sbp2_logical_unit *lu, *next;
struct Scsi_Host *shost =
container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
struct scsi_device *sdev;

/* prevent deadlocks */
sbp2_unblock(tgt);

list_for_each_entry_safe(lu, next, &tgt->lu_list, link) {
if (lu->sdev) {
scsi_remove_device(lu->sdev);
scsi_device_put(lu->sdev);
sdev = scsi_device_lookup(shost, 0, 0, sbp2_lun2int(lu->lun));
if (sdev) {
scsi_remove_device(sdev);
scsi_device_put(sdev);
}
sbp2_send_management_orb(lu, tgt->node_id, lu->generation,
SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
Expand Down Expand Up @@ -807,7 +820,6 @@ static void sbp2_login(struct work_struct *work)
struct fw_device *device = fw_device(tgt->unit->device.parent);
struct Scsi_Host *shost;
struct scsi_device *sdev;
struct scsi_lun eight_bytes_lun;
struct sbp2_login_response response;
int generation, node_id, local_node_id;

Expand All @@ -820,7 +832,7 @@ static void sbp2_login(struct work_struct *work)
local_node_id = device->card->node_id;

/* If this is a re-login attempt, log out, or we might be rejected. */
if (lu->sdev)
if (lu->has_sdev)
sbp2_send_management_orb(lu, device->node_id, generation,
SBP2_LOGOUT_REQUEST, lu->login_id, NULL);

Expand Down Expand Up @@ -859,7 +871,7 @@ static void sbp2_login(struct work_struct *work)
sbp2_agent_reset(lu);

/* This was a re-login. */
if (lu->sdev) {
if (lu->has_sdev) {
sbp2_cancel_orbs(lu);
sbp2_conditionally_unblock(lu);
goto out;
Expand All @@ -868,13 +880,8 @@ static void sbp2_login(struct work_struct *work)
if (lu->tgt->workarounds & SBP2_WORKAROUND_DELAY_INQUIRY)
ssleep(SBP2_INQUIRY_DELAY);

memset(&eight_bytes_lun, 0, sizeof(eight_bytes_lun));
eight_bytes_lun.scsi_lun[0] = (lu->lun >> 8) & 0xff;
eight_bytes_lun.scsi_lun[1] = lu->lun & 0xff;
shost = container_of((void *)tgt, struct Scsi_Host, hostdata[0]);

sdev = __scsi_add_device(shost, 0, 0,
scsilun_to_int(&eight_bytes_lun), lu);
sdev = __scsi_add_device(shost, 0, 0, sbp2_lun2int(lu->lun), lu);
/*
* FIXME: We are unable to perform reconnects while in sbp2_login().
* Therefore __scsi_add_device() will get into trouble if a bus reset
Expand All @@ -896,7 +903,8 @@ static void sbp2_login(struct work_struct *work)
}

/* No error during __scsi_add_device() */
lu->sdev = sdev;
lu->has_sdev = true;
scsi_device_put(sdev);
sbp2_allow_block(lu);
goto out;

Expand Down Expand Up @@ -934,11 +942,11 @@ static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry)
return -ENOMEM;
}

lu->tgt = tgt;
lu->sdev = NULL;
lu->lun = lun_entry & 0xffff;
lu->retries = 0;
lu->blocked = false;
lu->tgt = tgt;
lu->lun = lun_entry & 0xffff;
lu->retries = 0;
lu->has_sdev = false;
lu->blocked = false;
++tgt->dont_block;
INIT_LIST_HEAD(&lu->orb_list);
INIT_DELAYED_WORK(&lu->work, sbp2_login);
Expand Down
19 changes: 7 additions & 12 deletions trunk/kernel/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ void audit_panic(const char *message)
printk(KERN_ERR "audit: %s\n", message);
break;
case AUDIT_FAIL_PANIC:
/* test audit_pid since printk is always losey, why bother? */
if (audit_pid)
panic("audit: %s\n", message);
panic("audit: %s\n", message);
break;
}
}
Expand Down Expand Up @@ -354,7 +352,6 @@ static int kauditd_thread(void *dummy)
if (err < 0) {
BUG_ON(err != -ECONNREFUSED); /* Shoudn't happen */
printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid);
audit_log_lost("auditd dissapeared\n");
audit_pid = 0;
}
} else {
Expand Down Expand Up @@ -1353,19 +1350,17 @@ void audit_log_end(struct audit_buffer *ab)
if (!audit_rate_check()) {
audit_log_lost("rate limit exceeded");
} else {
struct nlmsghdr *nlh = nlmsg_hdr(ab->skb);
if (audit_pid) {
struct nlmsghdr *nlh = nlmsg_hdr(ab->skb);
nlh->nlmsg_len = ab->skb->len - NLMSG_SPACE(0);
skb_queue_tail(&audit_skb_queue, ab->skb);
ab->skb = NULL;
wake_up_interruptible(&kauditd_wait);
} else if (nlh->nlmsg_type != AUDIT_EOE) {
if (printk_ratelimit()) {
printk(KERN_NOTICE "type=%d %s\n",
nlh->nlmsg_type,
ab->skb->data + NLMSG_SPACE(0));
} else
audit_log_lost("printk limit exceeded\n");
} else if (printk_ratelimit()) {
struct nlmsghdr *nlh = nlmsg_hdr(ab->skb);
printk(KERN_NOTICE "type=%d %s\n", nlh->nlmsg_type, ab->skb->data + NLMSG_SPACE(0));
} else {
audit_log_lost("printk limit exceeded\n");
}
}
audit_buffer_free(ab);
Expand Down
2 changes: 1 addition & 1 deletion trunk/kernel/auditsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
* so we can be sure nothing was lost.
*/
if ((i == 0) && (too_long))
audit_log_format(*ab, "a%d_len=%zu ", arg_num,
audit_log_format(*ab, "a%d_len=%ld ", arg_num,
has_cntl ? 2*len : len);

/*
Expand Down

0 comments on commit 259ede8

Please sign in to comment.