dlm: initialize file_lock struct in GETLK before copying conflicting lock
[safe/jmp/linux-2.6] / fs / dlm / lowcomms.c
index 637018c..103a5eb 100644 (file)
@@ -295,6 +295,7 @@ static int add_sock(struct socket *sock, struct connection *con)
        con->sock->sk->sk_write_space = lowcomms_write_space;
        con->sock->sk->sk_state_change = lowcomms_state_change;
        con->sock->sk->sk_user_data = con;
+       con->sock->sk->sk_allocation = GFP_NOFS;
        return 0;
 }
 
@@ -823,7 +824,6 @@ static void sctp_init_assoc(struct connection *con)
        len = e->len;
        offset = e->offset;
        spin_unlock(&con->writequeue_lock);
-       kmap(e->page);
 
        /* Send the first block off the write queue */
        iov[0].iov_base = page_address(e->page)+offset;
@@ -854,7 +854,6 @@ static void sctp_init_assoc(struct connection *con)
 
                if (e->len == 0 && e->users == 0) {
                        list_del(&e->list);
-                       kunmap(e->page);
                        free_entry(e);
                }
                spin_unlock(&con->writequeue_lock);
@@ -891,8 +890,10 @@ static void tcp_connect_to_sock(struct connection *con)
                goto out_err;
 
        memset(&saddr, 0, sizeof(saddr));
-       if (dlm_nodeid_to_addr(con->nodeid, &saddr))
+       if (dlm_nodeid_to_addr(con->nodeid, &saddr)) {
+               sock_release(sock);
                goto out_err;
+       }
 
        sock->sk->sk_user_data = con;
        con->rx_action = receive_from_sock;
@@ -1201,8 +1202,6 @@ void *dlm_lowcomms_get_buffer(int nodeid, int len, gfp_t allocation, char **ppc)
 
        if (e) {
        got_one:
-               if (users == 0)
-                       kmap(e->page);
                *ppc = page_address(e->page) + offset;
                return e;
        }
@@ -1231,7 +1230,6 @@ void dlm_lowcomms_commit_buffer(void *mh)
        if (users)
                goto out;
        e->len = e->end - e->offset;
-       kunmap(e->page);
        spin_unlock(&con->writequeue_lock);
 
        if (!test_and_set_bit(CF_WRITE_PENDING, &con->flags)) {
@@ -1270,7 +1268,6 @@ static void send_to_sock(struct connection *con)
                offset = e->offset;
                BUG_ON(len == 0 && e->users == 0);
                spin_unlock(&con->writequeue_lock);
-               kmap(e->page);
 
                ret = 0;
                if (len) {
@@ -1292,7 +1289,6 @@ static void send_to_sock(struct connection *con)
 
                if (e->len == 0 && e->users == 0) {
                        list_del(&e->list);
-                       kunmap(e->page);
                        free_entry(e);
                        continue;
                }