Whamcloud - gitweb
- call md_clear_open_replay_data() right before freeing och instead of doing
authortappro <tappro>
Thu, 30 Nov 2006 14:15:22 +0000 (14:15 +0000)
committertappro <tappro>
Thu, 30 Nov 2006 14:15:22 +0000 (14:15 +0000)
  that before ll_done_writing(). This fix prevents possible handle loss when
replay happens between open/close and done_writting.

lustre/llite/file.c
lustre/llite/llite_close.c

index 865311e..2ba3265 100644 (file)
@@ -150,15 +150,15 @@ 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 (!epoch_close && S_ISREG(inode->i_mode) &&
             (och->och_flags & FMODE_WRITE)) {
                 ll_queue_done_writing(inode, LLIF_DONE_WRITING);
         } else {
+                md_clear_open_replay_data(md_exp, och);
                 /* Free @och if it is not waiting for DONE_WRITING. */
                 och->och_fh.cookie = DEAD_HANDLE_MAGIC;
-                OBD_FREE(och, sizeof(*och));
+                OBD_FREE_PTR(och);
         }
         
         return rc;
index f91fb63..f39f91b 100644 (file)
@@ -231,6 +231,7 @@ static void ll_done_writing(struct inode *inode)
                 CERROR("inode %lu mdc done_writing failed: rc = %d\n",
                        inode->i_ino, rc);
         }
+        md_clear_open_replay_data(ll_i2sbi(inode)->ll_md_exp, och);
         OBD_FREE_PTR(och);
         EXIT;
 }