Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
d5ea4e26
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
d5ea4e26
编写于
12月 21, 2005
作者:
L
Linus Torvalds
浏览文件
操作
浏览文件
下载
差异文件
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
上级
c7ac6b42
863a930a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
104 addition
and
14 deletion
+104
-14
drivers/scsi/scsi_scan.c
drivers/scsi/scsi_scan.c
+38
-10
drivers/scsi/scsi_transport_fc.c
drivers/scsi/scsi_transport_fc.c
+55
-4
include/scsi/scsi_transport_fc.h
include/scsi/scsi_transport_fc.h
+11
-0
未找到文件。
drivers/scsi/scsi_scan.c
浏览文件 @
d5ea4e26
...
...
@@ -400,6 +400,35 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
return
found_target
;
}
struct
work_queue_wrapper
{
struct
work_struct
work
;
struct
scsi_target
*
starget
;
};
static
void
scsi_target_reap_work
(
void
*
data
)
{
struct
work_queue_wrapper
*
wqw
=
(
struct
work_queue_wrapper
*
)
data
;
struct
scsi_target
*
starget
=
wqw
->
starget
;
struct
Scsi_Host
*
shost
=
dev_to_shost
(
starget
->
dev
.
parent
);
unsigned
long
flags
;
kfree
(
wqw
);
spin_lock_irqsave
(
shost
->
host_lock
,
flags
);
if
(
--
starget
->
reap_ref
==
0
&&
list_empty
(
&
starget
->
devices
))
{
list_del_init
(
&
starget
->
siblings
);
spin_unlock_irqrestore
(
shost
->
host_lock
,
flags
);
device_del
(
&
starget
->
dev
);
transport_unregister_device
(
&
starget
->
dev
);
put_device
(
&
starget
->
dev
);
return
;
}
spin_unlock_irqrestore
(
shost
->
host_lock
,
flags
);
return
;
}
/**
* scsi_target_reap - check to see if target is in use and destroy if not
*
...
...
@@ -411,19 +440,18 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
*/
void
scsi_target_reap
(
struct
scsi_target
*
starget
)
{
struct
Scsi_Host
*
shost
=
dev_to_shost
(
starget
->
dev
.
parent
);
unsigned
long
flags
;
spin_lock_irqsave
(
shost
->
host_lock
,
flags
);
struct
work_queue_wrapper
*
wqw
=
kzalloc
(
sizeof
(
struct
work_queue_wrapper
),
GFP_ATOMIC
);
if
(
--
starget
->
reap_ref
==
0
&&
list_empty
(
&
starget
->
devices
))
{
list_del_init
(
&
starget
->
siblings
);
spin_unlock_irqrestore
(
shost
->
host_lock
,
flags
);
device_del
(
&
starget
->
dev
);
transport_unregister_device
(
&
starget
->
dev
);
put_device
(
&
starget
->
dev
);
if
(
!
wqw
)
{
starget_printk
(
KERN_ERR
,
starget
,
"Failed to allocate memory in scsi_reap_target()
\n
"
);
return
;
}
spin_unlock_irqrestore
(
shost
->
host_lock
,
flags
);
INIT_WORK
(
&
wqw
->
work
,
scsi_target_reap_work
,
wqw
);
wqw
->
starget
=
starget
;
schedule_work
(
&
wqw
->
work
);
}
/**
...
...
drivers/scsi/scsi_transport_fc.c
浏览文件 @
d5ea4e26
...
...
@@ -105,6 +105,7 @@ static struct {
{
FC_PORTSTATE_LINKDOWN
,
"Linkdown"
},
{
FC_PORTSTATE_ERROR
,
"Error"
},
{
FC_PORTSTATE_LOOPBACK
,
"Loopback"
},
{
FC_PORTSTATE_DELETED
,
"Deleted"
},
};
fc_enum_name_search
(
port_state
,
fc_port_state
,
fc_port_state_names
)
#define FC_PORTSTATE_MAX_NAMELEN 20
...
...
@@ -211,6 +212,7 @@ fc_bitfield_name_search(remote_port_roles, fc_remote_port_role_names)
#define FC_MGMTSRVR_PORTID 0x00000a
static
void
fc_shost_remove_rports
(
void
*
data
);
static
void
fc_timeout_deleted_rport
(
void
*
data
);
static
void
fc_scsi_scan_rport
(
void
*
data
);
static
void
fc_rport_terminate
(
struct
fc_rport
*
rport
);
...
...
@@ -318,6 +320,8 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
fc_host_next_rport_number
(
shost
)
=
0
;
fc_host_next_target_id
(
shost
)
=
0
;
fc_host_flags
(
shost
)
=
0
;
INIT_WORK
(
&
fc_host_rport_del_work
(
shost
),
fc_shost_remove_rports
,
shost
);
return
0
;
}
...
...
@@ -387,6 +391,7 @@ show_fc_rport_##field (struct class_device *cdev, char *buf) \
struct fc_internal *i = to_fc_internal(shost->transportt); \
if ((i->f->get_rport_##field) && \
!((rport->port_state == FC_PORTSTATE_BLOCKED) || \
(rport->port_state == FC_PORTSTATE_DELETED) || \
(rport->port_state == FC_PORTSTATE_NOTPRESENT))) \
i->f->get_rport_##field(rport); \
return snprintf(buf, sz, format_string, cast rport->field); \
...
...
@@ -402,6 +407,7 @@ store_fc_rport_##field(struct class_device *cdev, const char *buf, \
struct Scsi_Host *shost = rport_to_shost(rport); \
struct fc_internal *i = to_fc_internal(shost->transportt); \
if ((rport->port_state == FC_PORTSTATE_BLOCKED) || \
(rport->port_state == FC_PORTSTATE_DELETED) || \
(rport->port_state == FC_PORTSTATE_NOTPRESENT)) \
return -EBUSY; \
val = simple_strtoul(buf, NULL, 0); \
...
...
@@ -519,6 +525,7 @@ store_fc_rport_dev_loss_tmo(struct class_device *cdev, const char *buf,
struct
Scsi_Host
*
shost
=
rport_to_shost
(
rport
);
struct
fc_internal
*
i
=
to_fc_internal
(
shost
->
transportt
);
if
((
rport
->
port_state
==
FC_PORTSTATE_BLOCKED
)
||
(
rport
->
port_state
==
FC_PORTSTATE_DELETED
)
||
(
rport
->
port_state
==
FC_PORTSTATE_NOTPRESENT
))
return
-
EBUSY
;
val
=
simple_strtoul
(
buf
,
NULL
,
0
);
...
...
@@ -1769,7 +1776,7 @@ fc_timeout_deleted_rport(void *data)
rport
->
maxframe_size
=
-
1
;
rport
->
supported_classes
=
FC_COS_UNSPECIFIED
;
rport
->
roles
=
FC_RPORT_ROLE_UNKNOWN
;
rport
->
port_state
=
FC_PORTSTATE_
NOTPRESENT
;
rport
->
port_state
=
FC_PORTSTATE_
DELETED
;
/* remove the identifiers that aren't used in the consisting binding */
switch
(
fc_host_tgtid_bind_type
(
shost
))
{
...
...
@@ -1789,14 +1796,23 @@ fc_timeout_deleted_rport(void *data)
break
;
}
spin_unlock_irqrestore
(
shost
->
host_lock
,
flags
);
/*
* As this only occurs if the remote port (scsi target)
* went away and didn't come back - we'll remove
* all attached scsi devices.
*
* We'll schedule the shost work item to perform the actual removal
* to avoid recursion in the different flush calls if we perform
* the removal in each target - and there are lots of targets
* whose timeouts fire at the same time.
*/
fc_rport_tgt_remove
(
rport
);
if
(
!
(
fc_host_flags
(
shost
)
&
FC_SHOST_RPORT_DEL_SCHEDULED
))
{
fc_host_flags
(
shost
)
|=
FC_SHOST_RPORT_DEL_SCHEDULED
;
scsi_queue_work
(
shost
,
&
fc_host_rport_del_work
(
shost
));
}
spin_unlock_irqrestore
(
shost
->
host_lock
,
flags
);
}
/**
...
...
@@ -1818,6 +1834,41 @@ fc_scsi_scan_rport(void *data)
}
/**
* fc_shost_remove_rports - called to remove all rports that are marked
* as in a deleted (not connected) state.
*
* @data: shost whose rports are to be looked at
**/
static
void
fc_shost_remove_rports
(
void
*
data
)
{
struct
Scsi_Host
*
shost
=
(
struct
Scsi_Host
*
)
data
;
struct
fc_rport
*
rport
,
*
next_rport
;
unsigned
long
flags
;
spin_lock_irqsave
(
shost
->
host_lock
,
flags
);
while
(
fc_host_flags
(
shost
)
&
FC_SHOST_RPORT_DEL_SCHEDULED
)
{
fc_host_flags
(
shost
)
&=
~
FC_SHOST_RPORT_DEL_SCHEDULED
;
restart_search:
list_for_each_entry_safe
(
rport
,
next_rport
,
&
fc_host_rport_bindings
(
shost
),
peers
)
{
if
(
rport
->
port_state
==
FC_PORTSTATE_DELETED
)
{
rport
->
port_state
=
FC_PORTSTATE_NOTPRESENT
;
spin_unlock_irqrestore
(
shost
->
host_lock
,
flags
);
fc_rport_tgt_remove
(
rport
);
spin_lock_irqsave
(
shost
->
host_lock
,
flags
);
goto
restart_search
;
}
}
}
spin_unlock_irqrestore
(
shost
->
host_lock
,
flags
);
}
MODULE_AUTHOR
(
"Martin Hicks"
);
MODULE_DESCRIPTION
(
"FC Transport Attributes"
);
MODULE_LICENSE
(
"GPL"
);
...
...
include/scsi/scsi_transport_fc.h
浏览文件 @
d5ea4e26
...
...
@@ -79,6 +79,7 @@ enum fc_port_state {
FC_PORTSTATE_LINKDOWN
,
FC_PORTSTATE_ERROR
,
FC_PORTSTATE_LOOPBACK
,
FC_PORTSTATE_DELETED
,
};
...
...
@@ -325,8 +326,14 @@ struct fc_host_attrs {
struct
list_head
rport_bindings
;
u32
next_rport_number
;
u32
next_target_id
;
u8
flags
;
struct
work_struct
rport_del_work
;
};
/* values for struct fc_host_attrs "flags" field: */
#define FC_SHOST_RPORT_DEL_SCHEDULED 0x01
#define fc_host_node_name(x) \
(((struct fc_host_attrs *)(x)->shost_data)->node_name)
#define fc_host_port_name(x) \
...
...
@@ -365,6 +372,10 @@ struct fc_host_attrs {
(((struct fc_host_attrs *)(x)->shost_data)->next_rport_number)
#define fc_host_next_target_id(x) \
(((struct fc_host_attrs *)(x)->shost_data)->next_target_id)
#define fc_host_flags(x) \
(((struct fc_host_attrs *)(x)->shost_data)->flags)
#define fc_host_rport_del_work(x) \
(((struct fc_host_attrs *)(x)->shost_data)->rport_del_work)
/* The functions by which the transport class and the driver communicate */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录