Whamcloud - gitweb
- fixed pssibly using freed och in ll_close_inode_openhandle().
authoryury <yury>
Wed, 8 Nov 2006 08:30:42 +0000 (08:30 +0000)
committeryury <yury>
Wed, 8 Nov 2006 08:30:42 +0000 (08:30 +0000)
lustre/llite/file.c
lustre/lmv/lmv_obd.c

index 585cefb..8307409 100644 (file)
@@ -92,8 +92,8 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp,
         struct md_op_data *op_data;
         struct ptlrpc_request *req = NULL;
         struct obd_device *obd;
+        int rc, clear_ord = 0;
         int epoch_close = 1;
-        int rc;
         ENTRY;
 
         obd = class_exp2obd(ll_i2mdexp(inode));
@@ -142,8 +142,11 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp,
                        inode->i_ino, rc);
         }
 
-        if (!epoch_close && (och->och_flags & FMODE_WRITE))
+        if (!epoch_close && (och->och_flags & FMODE_WRITE)) {
                 ll_queue_done_writing(inode, LLIF_DONE_WRITING);
+                md_clear_open_replay_data(md_exp, och);
+                clear_ord = 1;
+        }
 
         if (rc == 0) {
                 rc = ll_objects_destroy(req, inode);
@@ -155,7 +158,9 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp,
         ptlrpc_req_finished(req); /* This is close request */
         EXIT;
 out:
-        md_clear_open_replay_data(md_exp, och);
+        if (!clear_ord)
+                md_clear_open_replay_data(md_exp, och);
+        
         if (epoch_close || !(och->och_flags & FMODE_WRITE))
                 och->och_fh.cookie = DEAD_HANDLE_MAGIC;
         return rc;
index 7982adb..d2b33e8 100644 (file)
@@ -2534,7 +2534,8 @@ int lmv_clear_open_replay_data(struct obd_export *exp,
         RETURN(md_clear_open_replay_data(tgt_exp, och));
 }
 
-static int lmv_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid,
+static int lmv_get_remote_perm(struct obd_export *exp,
+                               const struct lu_fid *fid,
                                struct obd_capa *oc,
                                struct ptlrpc_request **request)
 {