Skip to content

Commit

Permalink
Merge branch 'upstream-linus' of git://oss.oracle.com/home/sourcebo/g…
Browse files Browse the repository at this point in the history
…it/ocfs2
  • Loading branch information
Linus Torvalds committed Mar 1, 2006
2 parents e0a5c57 + 81f2094 commit b1e2d90
Show file tree
Hide file tree
Showing 18 changed files with 249 additions and 142 deletions.
1 change: 1 addition & 0 deletions fs/ocfs2/cluster/masklog.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ struct mlog_attribute {
#define define_mask(_name) { \
.attr = { \
.name = #_name, \
.owner = THIS_MODULE, \
.mode = S_IRUGO | S_IWUSR, \
}, \
.mask = ML_##_name, \
Expand Down
2 changes: 1 addition & 1 deletion fs/ocfs2/cluster/masklog.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
} \
} while (0)

#if (BITS_PER_LONG == 32) || defined(CONFIG_X86_64)
#if (BITS_PER_LONG == 32) || defined(CONFIG_X86_64) || (defined(CONFIG_UML_X86) && defined(CONFIG_64BIT))
#define MLFi64 "lld"
#define MLFu64 "llu"
#define MLFx64 "llx"
Expand Down
4 changes: 3 additions & 1 deletion fs/ocfs2/cluster/nodemanager.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ static int __init init_o2nm(void)
if (!ocfs2_table_header) {
printk(KERN_ERR "nodemanager: unable to register sysctl\n");
ret = -ENOMEM; /* or something. */
goto out;
goto out_o2net;
}

ret = o2net_register_hb_callbacks();
Expand All @@ -780,6 +780,8 @@ static int __init init_o2nm(void)
o2net_unregister_hb_callbacks();
out_sysctl:
unregister_sysctl_table(ocfs2_table_header);
out_o2net:
o2net_exit();
out:
return ret;
}
Expand Down
14 changes: 12 additions & 2 deletions fs/ocfs2/cluster/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ static void o2net_start_connect(void *arg)
{
struct o2net_node *nn = arg;
struct o2net_sock_container *sc = NULL;
struct o2nm_node *node = NULL;
struct o2nm_node *node = NULL, *mynode = NULL;
struct socket *sock = NULL;
struct sockaddr_in myaddr = {0, }, remoteaddr = {0, };
int ret = 0;
Expand All @@ -1334,6 +1334,12 @@ static void o2net_start_connect(void *arg)
goto out;
}

mynode = o2nm_get_node_by_num(o2nm_this_node());
if (mynode == NULL) {
ret = 0;
goto out;
}

spin_lock(&nn->nn_lock);
/* see if we already have one pending or have given up */
if (nn->nn_sc || nn->nn_persistent_error)
Expand Down Expand Up @@ -1361,12 +1367,14 @@ static void o2net_start_connect(void *arg)
sock->sk->sk_allocation = GFP_ATOMIC;

myaddr.sin_family = AF_INET;
myaddr.sin_addr.s_addr = (__force u32)mynode->nd_ipv4_address;
myaddr.sin_port = (__force u16)htons(0); /* any port */

ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr,
sizeof(myaddr));
if (ret) {
mlog(0, "bind failed: %d\n", ret);
mlog(ML_ERROR, "bind failed with %d at address %u.%u.%u.%u\n",
ret, NIPQUAD(mynode->nd_ipv4_address));
goto out;
}

Expand Down Expand Up @@ -1407,6 +1415,8 @@ static void o2net_start_connect(void *arg)
sc_put(sc);
if (node)
o2nm_node_put(node);
if (mynode)
o2nm_node_put(mynode);

return;
}
Expand Down
5 changes: 0 additions & 5 deletions fs/ocfs2/cluster/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,10 @@ enum {
O2NET_DRIVER_READY,
};

int o2net_init_tcp_sock(struct inode *inode);
int o2net_send_message(u32 msg_type, u32 key, void *data, u32 len,
u8 target_node, int *status);
int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *vec,
size_t veclen, u8 target_node, int *status);
int o2net_broadcast_message(u32 msg_type, u32 key, void *data, u32 len,
struct inode *group);

int o2net_register_handler(u32 msg_type, u32 key, u32 max_len,
o2net_msg_handler_func *func, void *data,
Expand All @@ -107,7 +104,5 @@ void o2net_disconnect_node(struct o2nm_node *node);

int o2net_init(void);
void o2net_exit(void);
int o2net_proc_init(struct proc_dir_entry *parent);
void o2net_proc_exit(struct proc_dir_entry *parent);

#endif /* O2CLUSTER_TCP_H */
8 changes: 3 additions & 5 deletions fs/ocfs2/dlm/dlmcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
#define DLM_THREAD_SHUFFLE_INTERVAL 5 // flush everything every 5 passes
#define DLM_THREAD_MS 200 // flush at least every 200 ms

#define DLM_HASH_BITS 7
#define DLM_HASH_SIZE (1 << DLM_HASH_BITS)
#define DLM_HASH_MASK (DLM_HASH_SIZE - 1)
#define DLM_HASH_BUCKETS (PAGE_SIZE / sizeof(struct hlist_head))

enum dlm_ast_type {
DLM_AST = 0,
Expand Down Expand Up @@ -87,7 +85,7 @@ enum dlm_ctxt_state {
struct dlm_ctxt
{
struct list_head list;
struct list_head *resources;
struct hlist_head *lockres_hash;
struct list_head dirty_list;
struct list_head purge_list;
struct list_head pending_asts;
Expand Down Expand Up @@ -217,7 +215,7 @@ struct dlm_lock_resource
{
/* WARNING: Please see the comment in dlm_init_lockres before
* adding fields here. */
struct list_head list;
struct hlist_node hash_node;
struct kref refs;

/* please keep these next 3 in this order
Expand Down
12 changes: 5 additions & 7 deletions fs/ocfs2/dlm/dlmdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ EXPORT_SYMBOL_GPL(dlm_print_one_lock);
void dlm_dump_lock_resources(struct dlm_ctxt *dlm)
{
struct dlm_lock_resource *res;
struct list_head *iter;
struct list_head *bucket;
struct hlist_node *iter;
struct hlist_head *bucket;
int i;

mlog(ML_NOTICE, "struct dlm_ctxt: %s, node=%u, key=%u\n",
Expand All @@ -129,12 +129,10 @@ void dlm_dump_lock_resources(struct dlm_ctxt *dlm)
}

spin_lock(&dlm->spinlock);
for (i=0; i<DLM_HASH_SIZE; i++) {
bucket = &(dlm->resources[i]);
list_for_each(iter, bucket) {
res = list_entry(iter, struct dlm_lock_resource, list);
for (i=0; i<DLM_HASH_BUCKETS; i++) {
bucket = &(dlm->lockres_hash[i]);
hlist_for_each_entry(res, iter, bucket, hash_node)
dlm_print_one_lock_resource(res);
}
}
spin_unlock(&dlm->spinlock);
}
Expand Down
39 changes: 19 additions & 20 deletions fs/ocfs2/dlm/dlmdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,48 +77,48 @@ static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm);

void __dlm_unhash_lockres(struct dlm_lock_resource *lockres)
{
list_del_init(&lockres->list);
hlist_del_init(&lockres->hash_node);
dlm_lockres_put(lockres);
}

void __dlm_insert_lockres(struct dlm_ctxt *dlm,
struct dlm_lock_resource *res)
{
struct list_head *bucket;
struct hlist_head *bucket;
struct qstr *q;

assert_spin_locked(&dlm->spinlock);

q = &res->lockname;
q->hash = full_name_hash(q->name, q->len);
bucket = &(dlm->resources[q->hash & DLM_HASH_MASK]);
bucket = &(dlm->lockres_hash[q->hash % DLM_HASH_BUCKETS]);

/* get a reference for our hashtable */
dlm_lockres_get(res);

list_add_tail(&res->list, bucket);
hlist_add_head(&res->hash_node, bucket);
}

struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm,
const char *name,
unsigned int len)
{
unsigned int hash;
struct list_head *iter;
struct hlist_node *iter;
struct dlm_lock_resource *tmpres=NULL;
struct list_head *bucket;
struct hlist_head *bucket;

mlog_entry("%.*s\n", len, name);

assert_spin_locked(&dlm->spinlock);

hash = full_name_hash(name, len);

bucket = &(dlm->resources[hash & DLM_HASH_MASK]);
bucket = &(dlm->lockres_hash[hash % DLM_HASH_BUCKETS]);

/* check for pre-existing lock */
list_for_each(iter, bucket) {
tmpres = list_entry(iter, struct dlm_lock_resource, list);
hlist_for_each(iter, bucket) {
tmpres = hlist_entry(iter, struct dlm_lock_resource, hash_node);
if (tmpres->lockname.len == len &&
memcmp(tmpres->lockname.name, name, len) == 0) {
dlm_lockres_get(tmpres);
Expand Down Expand Up @@ -193,8 +193,8 @@ static int dlm_wait_on_domain_helper(const char *domain)

static void dlm_free_ctxt_mem(struct dlm_ctxt *dlm)
{
if (dlm->resources)
free_page((unsigned long) dlm->resources);
if (dlm->lockres_hash)
free_page((unsigned long) dlm->lockres_hash);

if (dlm->name)
kfree(dlm->name);
Expand Down Expand Up @@ -303,10 +303,10 @@ static void dlm_migrate_all_locks(struct dlm_ctxt *dlm)
mlog(0, "Migrating locks from domain %s\n", dlm->name);
restart:
spin_lock(&dlm->spinlock);
for (i=0; i<DLM_HASH_SIZE; i++) {
while (!list_empty(&dlm->resources[i])) {
res = list_entry(dlm->resources[i].next,
struct dlm_lock_resource, list);
for (i = 0; i < DLM_HASH_BUCKETS; i++) {
while (!hlist_empty(&dlm->lockres_hash[i])) {
res = hlist_entry(dlm->lockres_hash[i].first,
struct dlm_lock_resource, hash_node);
/* need reference when manually grabbing lockres */
dlm_lockres_get(res);
/* this should unhash the lockres
Expand Down Expand Up @@ -1191,18 +1191,17 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
goto leave;
}

dlm->resources = (struct list_head *) __get_free_page(GFP_KERNEL);
if (!dlm->resources) {
dlm->lockres_hash = (struct hlist_head *) __get_free_page(GFP_KERNEL);
if (!dlm->lockres_hash) {
mlog_errno(-ENOMEM);
kfree(dlm->name);
kfree(dlm);
dlm = NULL;
goto leave;
}
memset(dlm->resources, 0, PAGE_SIZE);

for (i=0; i<DLM_HASH_SIZE; i++)
INIT_LIST_HEAD(&dlm->resources[i]);
for (i=0; i<DLM_HASH_BUCKETS; i++)
INIT_HLIST_HEAD(&dlm->lockres_hash[i]);

strcpy(dlm->name, domain);
dlm->key = key;
Expand Down
4 changes: 2 additions & 2 deletions fs/ocfs2/dlm/dlmmaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ static void dlm_lockres_release(struct kref *kref)

/* By the time we're ready to blow this guy away, we shouldn't
* be on any lists. */
BUG_ON(!list_empty(&res->list));
BUG_ON(!hlist_unhashed(&res->hash_node));
BUG_ON(!list_empty(&res->granted));
BUG_ON(!list_empty(&res->converting));
BUG_ON(!list_empty(&res->blocked));
Expand Down Expand Up @@ -605,7 +605,7 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,

init_waitqueue_head(&res->wq);
spin_lock_init(&res->spinlock);
INIT_LIST_HEAD(&res->list);
INIT_HLIST_NODE(&res->hash_node);
INIT_LIST_HEAD(&res->granted);
INIT_LIST_HEAD(&res->converting);
INIT_LIST_HEAD(&res->blocked);
Expand Down
23 changes: 12 additions & 11 deletions fs/ocfs2/dlm/dlmrecovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,10 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm,
u8 dead_node, u8 new_master)
{
int i;
struct list_head *iter, *iter2, *bucket;
struct list_head *iter, *iter2;
struct hlist_node *hash_iter;
struct hlist_head *bucket;

struct dlm_lock_resource *res;

mlog_entry_void();
Expand All @@ -1717,10 +1720,9 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm,
* for now we need to run the whole hash, clear
* the RECOVERING state and set the owner
* if necessary */
for (i=0; i<DLM_HASH_SIZE; i++) {
bucket = &(dlm->resources[i]);
list_for_each(iter, bucket) {
res = list_entry (iter, struct dlm_lock_resource, list);
for (i = 0; i < DLM_HASH_BUCKETS; i++) {
bucket = &(dlm->lockres_hash[i]);
hlist_for_each_entry(res, hash_iter, bucket, hash_node) {
if (res->state & DLM_LOCK_RES_RECOVERING) {
if (res->owner == dead_node) {
mlog(0, "(this=%u) res %.*s owner=%u "
Expand Down Expand Up @@ -1852,10 +1854,10 @@ static void dlm_free_dead_locks(struct dlm_ctxt *dlm,

static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
{
struct list_head *iter;
struct hlist_node *iter;
struct dlm_lock_resource *res;
int i;
struct list_head *bucket;
struct hlist_head *bucket;
struct dlm_lock *lock;


Expand All @@ -1876,10 +1878,9 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
* can be kicked again to see if any ASTs or BASTs
* need to be fired as a result.
*/
for (i=0; i<DLM_HASH_SIZE; i++) {
bucket = &(dlm->resources[i]);
list_for_each(iter, bucket) {
res = list_entry (iter, struct dlm_lock_resource, list);
for (i = 0; i < DLM_HASH_BUCKETS; i++) {
bucket = &(dlm->lockres_hash[i]);
hlist_for_each_entry(res, iter, bucket, hash_node) {
/* always prune any $RECOVERY entries for dead nodes,
* otherwise hangs can occur during later recovery */
if (dlm_is_recovery_lock(res->lockname.name,
Expand Down
Loading

0 comments on commit b1e2d90

Please sign in to comment.