Whamcloud - gitweb
- Added an 'xid' field to struct niobuf
authorpschwan <pschwan>
Sun, 3 Mar 2002 04:34:22 +0000 (04:34 +0000)
committerpschwan <pschwan>
Sun, 3 Mar 2002 04:34:22 +0000 (04:34 +0000)
- Fixed bug in OST/OSC bulk handling by using this new field
- fixed double free in OST

lustre/include/linux/lustre_idl.h
lustre/include/linux/obd_ost.h
lustre/lib/obd_pack.c
lustre/osc/osc_request.c
lustre/ost/ost_handler.c

index 5f09bf4..73587cc 100644 (file)
@@ -202,6 +202,7 @@ struct niobuf {
         __u64 offset; 
         __u32 len;
         __u32 flags;
+        __u32 xid;
         void *page;
 };
 
index 0609a7f..69dcc60 100644 (file)
@@ -48,7 +48,7 @@ int ost_pack_rep(char *buf1, int buflen1, char *buf2, int buflen2,
 int ost_unpack_rep(char *buf, int len, struct ptlrep_hdr **hdr, union ptl_rep *rep);
 
 void ost_pack_niobuf(void **tmp, void *addr, __u64 offset, __u32 len, 
-                   __u32 flags);
+                     __u32 flags, __u32 xid);
 void ost_unpack_niobuf(void **tmp, struct niobuf **nbp);
 void ost_pack_ioo(void **tmp, struct obdo *oa, int bufcnt);
 void ost_unpack_ioo(void **tmp, struct obd_ioobj **ioop);
index 1ca6133..df237b2 100644 (file)
@@ -236,7 +236,7 @@ void ost_unpack_ioo(void **tmp, struct obd_ioobj **ioop)
 }
 
 void ost_pack_niobuf(void **tmp, void *addr, __u64 offset, __u32 len, 
-                   __u32 flags)
+                     __u32 flags, __u32 xid)
 {
         struct niobuf *ioo = *tmp;
         char *c = *tmp;
@@ -245,6 +245,7 @@ void ost_pack_niobuf(void **tmp, void *addr, __u64 offset, __u32 len,
         ioo->offset = NTOH__u64(offset); 
         ioo->len = NTOH__u32(len); 
         ioo->flags = NTOH__u32(flags); 
+        ioo->xid = NTOH__u32(xid);
         *tmp = c + sizeof(*ioo); 
 }
 
index f6f0a2b..824d36a 100644 (file)
@@ -384,7 +384,7 @@ int osc_brw_read(struct obd_conn *conn, obd_count num_oa, struct obdo **oa,
                         bulk[n]->b_buflen = PAGE_SIZE;
                         bulk[n]->b_portal = OST_BULK_PORTAL;
                         ost_pack_niobuf(&ptr2, bulk[n]->b_buf, offset[n],
-                                        count[n], flags[n]);
+                                        count[n], flags[n], bulk[n]->b_xid);
                         n++;
                 }
         }
@@ -456,7 +456,7 @@ int osc_brw_write(struct obd_conn *conn, obd_count num_oa, struct obdo **oa,
                ost_pack_ioo(&ptr1, oa[i], oa_bufs[i]); 
                 for (j = 0; j < oa_bufs[i]; j++) {
                         ost_pack_niobuf(&ptr2, kmap(buf[n]), offset[n],
-                                        count[n], flags[n]);
+                                        count[n], flags[n], 0);
                        n++;
                }
        }
index 01e4edb..4e128bf 100644 (file)
@@ -371,9 +371,6 @@ int ost_brw(struct ost_obd *obddev, struct ptlrpc_request *req)
                barrier();
        } else {
                 for (i = 0; i < niocount; i++) {
-                        struct ptlrpc_service *srv =
-                                req->rq_obd->u.ost.ost_service;
-
                         bulk = ptlrpc_prep_bulk(&req->rq_peer);
                         if (bulk == NULL) {
                                 CERROR("cannot alloc bulk desc\n");
@@ -381,12 +378,9 @@ int ost_brw(struct ost_obd *obddev, struct ptlrpc_request *req)
                                 goto out;
                         }
 
-                        spin_lock(&srv->srv_lock);
-                        bulk->b_xid = srv->srv_xid++;
-                        spin_unlock(&srv->srv_lock);
-
                        src = &((struct niobuf *)tmp2)[i];
 
+                        bulk->b_xid = src->xid;
                         bulk->b_buf = (void *)(unsigned long)src->addr;
                         bulk->b_buflen = PAGE_SIZE;
                         rc = ptlrpc_send_bulk(bulk, OST_BULK_PORTAL);
@@ -403,6 +397,7 @@ int ost_brw(struct ost_obd *obddev, struct ptlrpc_request *req)
                         }
 
                         OBD_FREE(bulk, sizeof(*bulk));
+                        bulk = NULL;
                 }
 
 #if 0