mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 19:21:26 +00:00
Merge branch 'svn-trunk'
This commit is contained in:
@@ -49,12 +49,8 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport)
|
||||
ft_format_wwn(name, sizeof(name), lport->wwpn);
|
||||
FT_SESS_DBG("create %s\n", name);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)
|
||||
tport = rcu_dereference_protected(lport->prov[FC_TYPE_FCP],
|
||||
lockdep_is_held(&ft_lport_lock));
|
||||
#else
|
||||
tport = rcu_dereference(lport->prov[FC_TYPE_FCP]);
|
||||
#endif
|
||||
if (tport) {
|
||||
FT_SESS_DBG("tport alloc %s - already setup\n", name);
|
||||
return tport;
|
||||
@@ -187,11 +183,7 @@ static struct ft_sess *ft_sess_get(struct fc_lport *lport, u32 port_id)
|
||||
struct ft_sess *sess;
|
||||
|
||||
rcu_read_lock();
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)
|
||||
tport = rcu_dereference_protected(lport->prov[FC_TYPE_FCP], true);
|
||||
#else
|
||||
tport = rcu_dereference(lport->prov[FC_TYPE_FCP]);
|
||||
#endif
|
||||
if (!tport)
|
||||
goto out;
|
||||
|
||||
@@ -406,13 +398,9 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
|
||||
|
||||
if (!(fcp_parm & FCP_SPPF_INIT_FCN))
|
||||
return FC_SPP_RESP_CONF;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)
|
||||
tport = rcu_dereference_protected(
|
||||
rdata->local_port->prov[FC_TYPE_FCP],
|
||||
lockdep_is_held(&ft_lport_lock));
|
||||
#else
|
||||
tport = rcu_dereference(rdata->local_port->prov[FC_TYPE_FCP]);
|
||||
#endif
|
||||
if (!tport) {
|
||||
/* not a target for this local port */
|
||||
return FC_SPP_RESP_CONF;
|
||||
@@ -482,11 +470,7 @@ static void ft_sess_free(struct kref *kref)
|
||||
static void ft_sess_put(struct ft_sess *sess)
|
||||
{
|
||||
BUG_ON(!sess);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
BUG_ON(kref_read(&sess->kref) <= 0);
|
||||
#else
|
||||
BUG_ON(atomic_read(&sess->kref.refcount) <= 0);
|
||||
#endif
|
||||
kref_put(&sess->kref, ft_sess_free);
|
||||
}
|
||||
|
||||
@@ -496,12 +480,8 @@ static void ft_prlo(struct fc_rport_priv *rdata)
|
||||
struct ft_tport *tport;
|
||||
|
||||
mutex_lock(&ft_lport_lock);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)
|
||||
tport = rcu_dereference_protected(rdata->local_port->prov[FC_TYPE_FCP],
|
||||
lockdep_is_held(&ft_lport_lock));
|
||||
#else
|
||||
tport = rcu_dereference(rdata->local_port->prov[FC_TYPE_FCP]);
|
||||
#endif
|
||||
if (!tport) {
|
||||
mutex_unlock(&ft_lport_lock);
|
||||
return;
|
||||
|
||||
@@ -1402,11 +1402,7 @@ static void isert_kref_free(struct kref *kref)
|
||||
|
||||
void isert_conn_free(struct isert_connection *isert_conn)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
sBUG_ON(kref_read(&isert_conn->kref) == 0);
|
||||
#else
|
||||
sBUG_ON(atomic_read(&isert_conn->kref.refcount) == 0);
|
||||
#endif
|
||||
kref_put(&isert_conn->kref, isert_kref_free);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,11 +113,7 @@ static void isert_kref_release_dev(struct kref *kref)
|
||||
|
||||
static void isert_dev_release(struct isert_conn_dev *dev)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
sBUG_ON(kref_read(&dev->kref) == 0);
|
||||
#else
|
||||
sBUG_ON(atomic_read(&dev->kref.refcount) == 0);
|
||||
#endif
|
||||
mutex_lock(&isert_listen_dev.conn_lock);
|
||||
kref_put(&dev->kref, isert_kref_release_dev);
|
||||
mutex_unlock(&isert_listen_dev.conn_lock);
|
||||
|
||||
@@ -361,12 +361,17 @@ static inline int __must_check kref_get_unless_zero(struct kref *kref)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* See also commit 2c935bc57221 */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||||
#define kref_read(kref) (atomic_read(&(kref)->refcount))
|
||||
#endif
|
||||
|
||||
/* <linux/kthread.h> */
|
||||
|
||||
/* See also commit 207205a2ba26 */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
||||
#define kthread_create_on_node(threadfn, data, node, namefmt, arg...)\
|
||||
kthread_create((threadfn), (data), ##arg)
|
||||
kthread_create((threadfn), (data), (namefmt), ##arg)
|
||||
#endif
|
||||
|
||||
/* <linux/ktime.h> */
|
||||
@@ -520,6 +525,11 @@ static inline int __ratelimit(struct ratelimit_state *rs)
|
||||
|
||||
/* <linux/rcupdate.h> */
|
||||
|
||||
/* See also commit b62730baea32 */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
|
||||
#define rcu_dereference_protected(p, c) rcu_dereference(p)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) && !defined(kfree_rcu)
|
||||
typedef void (*rcu_callback_t)(struct rcu_head *);
|
||||
#define __is_kfree_rcu_offset(offset) ((offset) < 4096)
|
||||
|
||||
@@ -1203,13 +1203,7 @@ void scst_kobject_put_and_wait(struct kobject *kobj, const char *category,
|
||||
goto out_free;
|
||||
|
||||
PRINT_INFO("Waiting for release of sysfs entry for %s %s (%d refs)",
|
||||
category, name ? : "(?)",
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
kref_read(&kobj->kref)
|
||||
#else
|
||||
atomic_read(&kobj->kref.refcount)
|
||||
#endif
|
||||
);
|
||||
category, name ? : "(?)", kref_read(&kobj->kref));
|
||||
wait_for_completion(c);
|
||||
PRINT_INFO("Finished waiting for release of %s %s sysfs entry",
|
||||
category, name ? : "(?)");
|
||||
|
||||
Reference in New Issue
Block a user